PHP String Functions in Bash: A Cheat Sheet
The index to the Bash function library: every PHP string function with its pure-Bash equivalent, short tested snippets, and when to use awk or sed instead.
Archive
The index to the Bash function library: every PHP string function with its pure-Bash equivalent, short tested snippets, and when to use awk or sed instead.
Writing Bash builtins in C: the .def format, compiling into bash vs enable -f, what my old awie-bash code got wrong, and a tested loadable port with timings.
Extra iptables matches and targets the kernel never shipped: country blocking with geoip, a TARPIT decoy port, port knocking, and the psd scan detector I ported.
Temp files and stale locks left behind by failed scripts are avoidable. Tested trap patterns for EXIT, INT, TERM and ERR, plus mkdir and flock locks.
One column for both address families: INET6_ATON() and INET6_NTOA(), IPv4-mapped addresses, correct sorting, indexed range queries and MariaDB's native INET6 type.
Export with WP-CLI, rebuild with a small Node script, keep every old URL working: what I learned relaunching this site as static HTML after dropping 1,600 posts.
Spread copies one level, the JSON trick breaks dates, maps and cycles, and structuredClone() fixes most of it. Tested examples, including what it still cannot clone.
A tested getopts skeleton for Bash scripts: flags, options with values, required options, error handling, and a manual loop for --long options.
A persistent WordPress object cache for hosting without Redis: each entry is a PHP file that OPcache keeps compiled. How it works, and what it did on a test site.
Store IPv4 addresses as INT UNSIGNED and test CIDR membership with a bitmask or, much faster on a big table, an indexed BETWEEN range on network and broadcast.