Shell
Recovery Paths
4 min Arranging a way back before taking the next step, from shell cleanup to snapshots and atomic publication.
The Send Button
4 min An empty-delimiter heredoc from an old trick list became the send step of a multi-agent shell protocol.
Email-Keyed Git Identity
2 min Selecting a preferred SSH key from Git’s effective email address, with organization-specific identity set by the remote URL.
The last extra argument
3 min In letter.sh’s extended merge form, Bash array slicing moves the last extra argument into pdfcpu’s destination slot.
printf %n
2 min C’s notorious write-through format directive lives on in bash, where one format string yields output and measured byte offsets.
The stateful generator
2 min A bash parameter expansion whose array subscript advances every time it expands.
Pushing terminfo over ssh’s stdin
2 min Fixing ‘unknown terminal type’ by streaming terminfo through ssh’s stdin and compiling it remotely, with no separate copy step.
td
2 min A tmux session keyed by a raw directory path, with extra commands smuggled through a trailing semicolon.
atexit for bash
3 min A LIFO exit-handler stack from jira-nice, with a nonstandard signal map and a broken pop-by-count path.
The repo is the .jira.d
2 min jira-nice makes its own checkout the go-jira config directory with one symlink, and inherits a parent repo’s Jira defaults with one extra glob path.
shutils.jq
3 min Turning jira-nice’s JSON options into Bash declarations, with a saved JSON copy and some sharp limits on what can cross the boundary.
Escaped spaces in tmux’s terminfo
1 min Twelve escaped spaces interrupted tmux’s SGR capability; removing them restored the intended terminal control sequence.
Truecolor escapes in diff-so-fancy
1 min Bold plus truecolor foreground and background exceeded diff-so-fancy’s seven-field escape-sequence limit.
The q Family
2 min About thirty git aliases built on a grammar: q queries, suffix letters add verbs, doubling escalates, a trailing q quiets, and a bang means force.
diff-so-fancy Without the Pipeline
2 min A git pager that runs diff-so-fancy inside less via LESSOPEN and degrades to plain less on machines that don’t have it.
Exit 99
2 min Dotfiles that fast-forward themselves at login and re-exec the running shell, coordinated by one exit code.
The FETCH_HEAD Throttle
2 min date -r FETCH_HEAD as the entire last-fetch database: no state file, a 12-hour window, and an epoch backdate to force retries.
cognito
3 min A tiny shell private mode that stops history, makes up-arrow forget, and hides its own switches.
mkdir elects one builder
3 min Atomic directory creation elects one builder, but every error is treated as a lost race and losers continue before the winner is ready.
Where Shell Hides Bugs
4 min Three latent shell bugs from my own repos: a config knob wired to nothing, a readability cleanup that inverted a boot flow, and a bashism hidden by discarded error output.
The polyglot activate script
2 min zippy’s bin/activate was six lines valid in both bash and Python, and sourcing it executed itself to print its own exports.
[b]in
2 min Wrapping one letter in a character class turns every PATH candidate into an existence test.
$JAVA_OPTS is an argv problem
2 min One variable string becomes one argument or several depending on who tokenizes it—verify the argv, not the config text.
Process substitution as a pipe endpoint
2 min A successful read-write open retains a process substitution’s pipe for independently launched producers and consumers.
Dropping a job from Bash’s table
2 min A Bash idiom let an outer subshell finish while a grandchild kept running; it was a narrow SSH workaround, not portable daemonization.
Sourcing generated shell is still execution
2 min Using /dev/stdin avoids eval’s call-site quoting hazard and keeps generated code inspectable; it does not reduce the injection surface.
Appending compressed logs
1 min An old mirror script appended complete gzip members, letting each run add compressed output without reopening the previous stream.
The prompt that asks the kernel
2 min A bashrc derived container identity from /proc/self/cgroup and prefixed the prompt with VPS[name]—no environment variable involved.
The directory is the dispatch table
3 min vps-lxc discovered its subcommands by listing a directory, with one sed filter as the entire registration policy.
Containers in 2010
6 min vps-lxc: templates as btrfs subvolumes, containers as writable snapshots, and the host-local image model I built around them.
A cleanup stack in Bash
3 min vps-lxc registers cleanup handlers in an array and unwinds them newest-first on fatal errors or signals.