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. Enter su -c to switch to root, run a command, and then switch back out. whereis adduser instead of simply adduser because adduser is no longer in the $PATH by default anymore. Tempted to try which adduser? No dice – which only gets you things in the $PATH as well: 1 2 3 andrew@debian-10:~$ which adduser # zip, zilch, nada. andrew@debian-10:~$ whereis adduser adduser: /usr/sbin/adduser /etc/adduser.conf /usr/share/adduser /usr/share/man/man8/adduser.8.gz awk to rip out /usr/sbin/adduser, which - thankfully - at least is still executable. $(whoami) because your name might not be andrew! whereis reboot because I don’t want to have to manually remember to logout and login again.

November 20, 2023

Art of the dotflag -- `.nojekyll`, `.gitkeep` and their ilk

This weekend I’ve been procrastinating playing the long game by getting some nice workflows set up for my TIL content repository and its associated website (cf Context, below). If all goes well, by the time I hit :wq on this TIL, it should invisibly trigger 2 Git commits, a Hugo build, and then appear on the site fully-birthed. One of the more interesting patterns I noticed was the .nojekyll empty file which I had to build to get GH Pages to stop tussling with my Hugo Action for turf. .nojekyll is technically a dotfile, but it doesn’t actually contain any content - its mere existence is enough to change behavior. And that makes their existence a really interesting design affordance offered to us developers by the filesystems we use every day but rarely think about. ...

November 19, 2023

A good place to symlink local builds

I’ve been a big fan of both spaced repetition in general and the Anki spaced repetition system in particular for a long time now. So today, after a fresh new install and blinging out of Ubuntu 23.10, I decided to take the next step, as I often do with programs I use a lot, and try to build and compile it myself. This turned out to be pretty easy! The docs warn that ./run is slower than the non-optimized build, but I don’t notice much of a difference on my machine. It did however leave me with the question: Where should I put the anki symlink to ./run? ...

November 18, 2023

No such thing as a Post-Push Hook

Tonight I was hacking away at some more little automations to make this TIL nice and presentable over at https://til.andrew-quinn.me/. Git has a wonderful system called “hooks” which live under .git/hooks/, come loaded with examples so you can remember how they all work, and – surprisingly – don’t contain a local post-push hook! There’s post-receive, but that expects to be able to run a script on the server side – not helpful when I’m pushing to one of Github’s many, many anonymous boxes. ...

November 18, 2023

Multi-line string literals in Fish

The Fish shell has… interesting syntax for multi-line string literals. The only way I can reliably remember is to literally write them as multi-line literals, which does make a certain kind of brutalist sense: 1 2 3 4 5 6 7 8 9 function kiitos set thankyou '--- kiitos kaynnista ja tervetuloa uduelleen ---' echo $thankyou end kiitos reliably prints ...

November 17, 2023

Today I Learned (TIL) I learn a lot of new things every day. At some point I decided I wanted to have a public record of some of them, so I wrote a shell script to let me open a terminal, type til, and immediately jot down whatever little tidbit I just came across. This repo is the result of that. Quickstart Trouble with all the programs I run in my various .fish scripts? Try Shell Bling Ubuntu, that should contain most of ’em. ...