Shell
-
pushd/popd for scripts that cd into many directories
A directory stack so scripts do not leak working directories between steps.
-
Shell retry with exponential backoff and jitter
A copy-pasteable retry function for flaky network calls in CI and deploy scripts.
-
Portable sed -i across GNU and BSD
The one invocation that does not blow up on macOS or Linux.
-
Parallel xargs with an actual progress indicator
xargs -P plus a named pipe to print 'M of N done' without buffering the output.
-
Bash trap for cleaning up a temp directory
The five-line top-of-script pattern I use in every non-trivial bash tool.
-
rsync invocation that is actually safe to resume
The flag combo I copy into every backup job so half-done transfers do not corrupt files.
-
AWK script that sums a column with a header
The awk one-liner I keep forgetting, with the one option that made it robust.
-
TIL: fzf's --preview can run arbitrary shell commands
The --preview flag is way more flexible than I realized.
-
Find files modified today across multiple repos
A shell one-liner I run every morning to remember what I was touching yesterday.
-
TIL: jq's recurse operator finds things in arbitrarily-nested JSON
Turns out .. is jq's recursive descent, like XPath's //. Wish I'd known this years ago.