PHP is Web Shell

One of the cooler things about working in a firm founded and run by a lot of dyed-in-the-wool Linux hackers like my current place is that there is a lot of Bash lying around, accumulated over a good 25 years or so. For all their faults, pure shell solutions still set the silver standard for programs which appear almost entirely immune to bit rot. But you know what? So does vanilla PHP....

April 29, 2024

fd + xargs + bat = quick document review

I’ve been on vacation this week, and part of what I’ve been up to is fixing up the Selkouutiset Archive. Like most of my websites these days, SA is powered by Hugo, which means handling a lot of Markdown documents, which means I opted to use an intermediate Git repo as a submodule to actually store the custom-processed documents. After a few tweaks here and there, I found myself wanting to quickly flip through all of the Markdown documents I had generated for each news day....

February 25, 2024

Getting `fzf` to print the preview pane

fzf is an incredibly useful bit of software, if someone shows you how to use it. There’s a lot more to it than just fuzzy-switching directories and fuzzy-searching you shell history – it also comes with a preview pane that updates on every keystroke. Try 1 echo '' | fzf --preview 'echo {q} {q}' and typing something to see how it works. ({q} is the query you type in at the bottom of the screen....

December 6, 2023

Git aliases for fun and profit

haskell-kata’s Quickstart now has this neat little ditty at the start: 1 2 git config --local alias.build '!sh -c \'for file in *.hs; do ghc -o "${file%.hs}-bin" "$file"; done\'' git build Git is the gift that keeps on giving. I was on the hunt for a subdirectory-scoped alias, and I just discovered this incredibly flexible way to create new Git subcommands. History: 2 years ago I read through the 1200 page behemoth Haskell Programming from First Principles....

December 3, 2023

Haskell has a rustup now?

Apparently so.. The resemblence is uncanny. I’ve apparently been out of the FP game too long, I thought Stack was the latest and greatest in abstracting over the toolchain.

December 2, 2023

traceroute uses UDP by default, not ICMP

At least on Linux. Don’t believe me? Run tcpdump -nn -i <interface> 'host example.com' in one shell and traceroute example.com in another. tcpdump will pick up all 3 of {ICMP, UDP, TCP}, and on my machine the pattern is clear: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20:58:47.187086 IP 1.2.3.4.41369 > 93.184.216.34.33434: UDP, length 32 20:58:47.187160 IP 1.2.3.4.39830 > 93....

November 29, 2023

Promoting Blog Tag Reuse with `fzf`

Some more updates to the main repo of this TIL site today, in particular I have added a new fzf-tags.fish script. til uses this script to Scrapes all the YAML tags: frontmatter from all current Markdown posts, Puts me into a multi-select fzf menu containing them, and Puts anything I select into the tags: of the new blog post. Tags form natural breadcrumb trails throughout a blog as it grows organically over time....

November 25, 2023

That damned Debian 10 one-liner I always need to let me `sudo`

1 2 # ⚠️: Reboots your VM. su -c "$(whereis adduser | awk '{print $2}') $(whoami) sudo && $(whereis reboot | awk '{print $2}')" In all its glory! For Debian 10 and up, because Debian 10 is where the sysv to systemd conversion became totalizing. Let’s break down quickly why each part of this is needed: Since we are trying to add ourselves to the sudo group right now, we obviously can’t use sudo....

November 20, 2023