~/.sqliterc

TL;DR: echo '.mode box' > ~/.sqliterc SQLite is a great database (although often overlooked) with a bit of annoying CLI defaults. For instance: sqlite> select * from Album limit 10; 1|For Those About To Rock We Salute You|1 2|Balls to the Wall|2 3|Restless and Wild|2 4|Let There Be Rock|1 5|Big Ones|3 6|Jagged Little Pill|4 7|Facelift|5 8|Warner 25 Anos|6 9|Plays Metallica By Four Cellos|7 10|Audioslave|8 Three columns, two of them are numbers, and yet things are hard to read....

199 words

Authorize SSH keys

How often have you asked or have been asked to provide public SSH keys in order to get authorized into given server or Git repository? I’ve heard horror stories of people providing private keys, by mistake. GitHub and GitLab ease this process greatly, but are not advertising it well enough. You can append .keys to the URL of your profile in order to receive the public keys you have on your account in a format to directly pipe it into ~/....

93 words

find tricks

Tasks I tend to forget how to perform with find(1) . Delete matched files The most trivial one: find <path> [..] -delete (e.g. find . -name foo -delete). However, depending on the OS -delete might not be available. In that case, see the next one. Execute command with matched files find <path> [..] -exec <cmd> '{}' \; is executed once for each matched file and the relative path to it is replaces '{}' and I always forget that \;, which might be omitted depending on a bunch of weird shell-isms (e....

219 words

Generate password

pwgen [length] [count] By default it generates a bunch of passwords in columns. However with args it can be ustructed to generate one fairly long secret (64 characters): pwgen 64 1 It has fairly good number of ways to configure what and how exactly to generate. The downside of this approach is that pwgen(1) is probably not installed by default on your machine. /dev/urandom Reading directly from /dev/urandom is the way to go on pretty much any UNIX these days (or fallback to /dev/random, although both are the same except on Linux) without having to install anything....

218 words

git bisect

git bisect provides easy to use binary search approach in order to find a bad commit. This tip assumes you know how it works is in general, but always forget what the commands are precisely. Prepare a single command that tries to reproduce the bug (e.g. script, test) off tree. Bisect is about to start jumping around, so it can’t be in the tree. git bisect start: begin the bisect session....

144 words

SSH into an ancient machine

TL;DR: ssh -oHostKeyAlgorithms=+ssh-rsa -oRequiredRSASize=1024 <user>@<host> Have you ever tried to SSH into an old machine, say a managed switch, UPS or router from the previous decade only to get declined with the following error: Unable to negotiate with <host>: no matching host key type found. Their offer: ssh-rsa,ssh-dss It’s frustrating, isn’t it? OpenSSH implements all of the cryptographic algorithms needed for compatibility with standards-compliant SSH implementations, but since some of the older algorithms have been found to be weak, not all of them are enabled by default....

187 words

What is my IP?

I’m using a page setup by Jason A. Donenfeld, which he uses to illustrate setting up WireGuard : https://zx2c4.com/ip Even have it as an alias in my dotfiles : alias myip='curl -s https://zx2c4.com/ip | head -n1'

36 words