Pragmatism in the real world

UUID v7

It's common to use a UUID when you need a primary key for your database records. Unlike incrementing numeric keys, it has the advantage that it's not tied to a specific database instance and can be created before insertion into the database. Usually, people use version 4 UUIDs, which contains a lot of randomness to ensure that it's going to be unique and not clash with any other id. Recently, I became aware of version… continue reading.

Keyword substitutions make life easier

I'm a huge fan of making my life easier and one thing I have found really helpful is automatic text substitution. The Mac has a built-in solution, but it's slightly clunky as it uses a popup to confirm that you want to substitute, so I use Keyboard Maestro, however there's many alternatives out there. My personal preference is to prefix all my substitutions with a semicolon as there are no real words that start with… continue reading.

A short primer on SPF, DKIM and DMARC

I use FastMail for my email and as I control my own domain, I needed to set up SFP, DKIM and DMARC on it. These are DNS records that help the email servers put the emails that I send into my recipient's inbox and to mark any forged emails as spam. These are my tidied up notes so that I can find them again when I next need them. SPF SPF is a DNS record… continue reading.

macOS tips and tricks

It's been over a decade since I last updated my article for new users to the Mac, so time for a new one that I can point people too. This article is intended to give a quick and easy introduction to some key things that I think you should know when you move to using macOS. Basics There’s one menu bar for all applications. That is, you can only see the menus for the currently… continue reading.

Command line access to GitLab & GitHub

I've always been a huge fan of the command line and have been using the gh command line tool to access GitHub for a while. My current client uses GitLab and I was delighted to discover that there is a glab CLI tool. As you can imagine, both tools do essentially the same thing: operate on GitHub/GitLab from the command line. The two main uses of gh & glab that I have is creating and… continue reading.

Command line access to the Mac Keychain with keyring

While reading Alex Chan's post about experimenting with the Flickr API, I noticed the call out to keyring by Jason Coombs for accessing the macOS Keychain. The built-in app: security The built-in way to access the keychain from the command line is /usr/bin/security: To create a password: $ security add-generic-password -s FlickrAPI -a rodeo -w redacted-key Note that you need to include the password on the command line in clear test, so it's now in… continue reading.

Reinstall pipx apps after Homebrew Python upgrade

I install Python apps on my Mac using pipx like this: pipx install rst2pdf This will then install rst2pdf into its own isolated environment so that its dependencies do not affect and are not affected by any other Python app I have installed. Internally, it creates a venv at /.local/pipx/venvs/rst2pdf with symlinks to the currently installed python in the bin directory: lrwxrwxr-x@ 1 rob staff 10 24 May 2023 python -> python3.11 lrwxrwxr-x@ 1 rob… continue reading.

Sleeping an external hard drive

One annoyance I had with my external USB hard drives is that they weren't sleeping when idle which makes them noisy. We can't have that! My first port of call was hdparm and its -S parameter: sudo hdparm -S 60 /dev/sdb However this didn't help. Fortunately, I found hd-idle which worked! After installing, you need to edit /etc/default/hd-idle and change the HD_IDLE_OPTS setting from -h to whatever you need. For me, I have set: HD_IDLE_OPTS="-i… continue reading.

Setting up a new hard drive in Linux

I recently added a second SSD to my Linux server and had to look up how to format it and set it up, having not taken notes for the first one. These are the notes I took the second time. This is all done from the command line and the monospace text is to be typed directly – though change the identifiers if requried. sudo lshw -C disk to confirm disk is seen by the… continue reading.

Backing up to an external HDD using rsync

I have a Linux-based server that acts as my Plex server amongst other things. It's fanless and I added an additional SSD for to hold the media data so it is nice and quiet. I'm a little bit of a belt-and-braces person when it comes to backing up my data, so in addition to backing up to the cloud, I also back up the data from the SSD to an external HDD every night using… continue reading.