More in Security
Compare secrets in constant time
Security
A plain === leaks how much of the token matched through its timing. This does not.
A starting Content-Security-Policy
Security
Blocks inline script and restricts everything to the origin. Tighten from here rather than loosening from nothing.
Security headers for an Express app
Security
The handful worth setting even when you are not using a framework that sets them for you.
Generate a strong random secret
Security
For session keys and tokens. Never reach for a password generator or a UUID for this.
Generate an SSH key and add it to the agent
Security
Ed25519 rather than RSA: shorter, faster, and no key-size decision to get wrong.
Random picks
Which indexes is nobody using?
Databases
Lists indexes that have never been scanned, which are pure write cost. Check against a long uptime before dropping any.
Make some properties optional
TypeScript
Composes the built-in helpers rather than writing a second interface that will drift from the first.
Inspect a TLS certificate from the command line
Networking
Prints the subject, issuer and validity dates without opening a browser.
Make a shell script fail loudly
Shell
The four lines that turn a script from 'carries on after an error' into 'stops at the first problem'.
Run promises with a concurrency limit
JavaScript
Keeps a fixed number of jobs in flight rather than firing a thousand requests at once.
Recover a branch you deleted
Git
The reflog remembers where HEAD has been for about ninety days, so a deleted branch is almost never really gone.
Show what a merge will do before doing it
Git
Lists the commits and the files a merge would bring in, so a surprise is less likely.
Copy text to the clipboard
JavaScript
The modern API needs a secure context and a real user gesture, so the failure path matters as much as the success one.