-
#home assistant
After a fair bit of digging I found it’s possible using the Philips Hue Bluetooth application to factory reset the bulbs without needing to purchase a hub or remote. This has enabled me to repair my Zigbee devices in Home Assistant through Zigbee2MQQT as I’ve migrated away from Phoscon.
-
#ssl
Chrome 58 onwards doesn’t permit self signed SSL certificates which rely on the ‘Common Name’ - you’ll receive a
ERR_CERT_COMMON_NAME_INVALID
error. Going forward it requires using the ‘Subject Alt Name’ being set. The following is an example of how to generate a self signed certificate for*.website.dev
on a Mac and add it to the Keychain.openssl req \ -newkey rsa:2048 \ -x509 \ -nodes \ -keyout server.key \ -new \ -out server.crt \ -subj /CN=*.website.dev \ -reqexts SAN \ -extensions SAN \ -config <(cat /etc/ssl/openssl.cnf \ <(printf '[SAN]\nsubjectAltName=DNS:*.website.dev')) \ -sha256 \ -days 3650 sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./server.crt
-
#git
Rename the current branch with the
-m
flag.git branch -m <new_branch_name>
-
#vim
The
I
flag makes this case sensitive.:%s/find/replace/gcI
-
#nunjucks
You have to use brackets in the statement if the outcome is conditional.
'bar' if aExpression else ('baz' if bExpression)
-
#css
white-space: pre-wrap;
ensures that white space and newlines in content captured from a<textarea>
are retained. -
#hugo
In hugo the “anchorize” function helped in adding a unique ID to each TIL entry for linking purposes.
-
#git
It’s difficult to remember what each git stash contains, but you can add more context by providing a message e.g.
git stash save "message goes here"
-
#node.js
In most REST based Express.js applications, nesting routers as middleware is commonplace. To keep the parent
req.params
, you need to add{ mergeParams: true }
in to the child router.// blog.js router.use('/:id/comments' commentsRoutes); // comments.js const router = express.router({ mergeParams: true }); router.get('/', (req, res) => { console.log(req.params.id); });