More in Ruby
Random picks
Inspect a TLS certificate from the command line
Networking
Prints the subject, issuer and validity dates without opening a browser.
A test that fails for the right reason
Testing
Assert on the message, not merely that something threw. A typo raising TypeError would otherwise pass.
Find slow queries in Postgres
Databases
Ranks statements by total time spent. Needs the pg_stat_statements extension enabled.
Rename a batch of files with a pattern
Shell
Strips a prefix from every file in a directory using shell parameter expansion, no rename utility required.
List branches merged into main
Git
Finds the branches that are safe to delete, and the ones that are not.
Generate a strong random secret
Security
For session keys and tokens. Never reach for a password generator or a UUID for this.
Retry a fetch with exponential backoff
JavaScript
Backs off on each failure and adds jitter, so a recovering service is not hit by every client at the same moment.
Deep clone a value
JavaScript
structuredClone handles Dates, Maps, Sets and cycles, which JSON round-tripping quietly destroys.