More in Text Processing
Replace text across a whole project
Text Processing
ripgrep finds the files, sed edits them in place. The dry run first is not optional.
Pretty-print and query JSON
Text Processing
jq for the common cases: reformat, pick a path, filter an array, and reshape.
Extract matches with a regular expression
Text Processing
grep -o prints only the matching part, which turns grep into a crude extractor.
A regular expression for ISO 8601 dates
Text Processing
Matches a date, optionally with a time and a zone. Deliberately strict about separators.
Sort and deduplicate lines by a field
Text Processing
Sorts on the second column and keeps the first row of each group.
Rewrite a CSV column with perl
Text Processing
A one-liner that upper-cases the second field of every row, leaving the rest alone.
Random picks
A README that people actually read
Data Formats
The order matters more than the length: what it is, how to run it, how to develop on it.
Generate a strong random secret
Security
For session keys and tokens. Never reach for a password generator or a UUID for this.
YAML anchors to avoid repeating yourself
Data Formats
Define a block once, merge it into each service. Changing the base changes all of them.
Responsive images that do not blow the bandwidth budget
Web & CSS
srcset lets the browser pick; sizes tells it how wide the image will actually be rendered.
Visually hidden, still read aloud
Web & CSS
Hides a label from sight while leaving it in the accessibility tree. display:none would remove it from both.
Which DNS records does a domain have?
Networking
dig with +short strips everything but the answer.
Safe navigation and fetch in Ruby
Ruby
&. stops at nil; fetch raises rather than returning nil when a key is genuinely required.
RAII file handling in C++
Systems
The stream closes itself when it leaves scope, whether the function returns normally or throws.