Pragmatism in the real world

Prepending to the terminal's prompt

For some work I'm doing, I have been given access to a Linux box that is part of a legacy production system. The first thing I have done is updated the terminal prompt to include the word PRODUCTION in red, by adding this to .bashrc: export PS1="$(tput setaf 1)PRODUCTION $(tput sgr0)$PS1" The nice thing about doing it this way is that I don't have to worry about whatever is in PS1 already. Not the most… continue reading.

Selecting the correct iPhone to mirror in macOS Sequoia

There's a new feature in macOS Sequoia that allows mirroring of your iPhone to your Mac. This is a nice feature that allows you to fully interact with your iPhone as an app on you Mac's desktop. When I upgrade to Sequoia and run the iPhone Mirroring app, it selected Victory, my old iPhone 14 Pro Max which is running an older version of iOS. This didn't work and there is no way within the… continue reading.

Scripting News is 30 years old

Last week, Dave Winer posted that Scripting News turned 30. That's an amazing milestone and Dave's still writing daily. 1994 seems like quite a while ago; the web was only 3 years old! I started blogging in 2003 on a personal domain and added this blog in 2005. I don't write daily though and I tip my hat to Dave. His writing is also really really good. Scripting News was the catalyst for the creation… continue reading.

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.