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.

Creating montages with ImageMagick

When creating my Year in Pictures post I decided that I wanted a montage of all the photos I had taken. In previous years, I've done this by taking a screenshot in an application where I try to set the zoom level correctly to get something acceptable. This time, I decided to do it properly and guessed that ImageMagick could help. After googling, I came up with this process: Export all images from Photos into… continue reading.

Getting a Bundle ID using an Alfred File Action

For some automation that I"m writing, I need to get the Bundle ID for some Mac applications. The easiest way to do this is with AppleScript: osascript -e 'id of app "{Application Name}"' This can easily be turned into a bash script such as `bundle-id-of` like this: #!/usr/bin/env bash osascript -e 'id of app "'"$1"'"' And we can now obtain the bundle id on the command line: Using Alfred As I'm lazy and don't want… continue reading.

Use ExifTool to remove private data in images

I'm a huge fan of ExifTool for manipulating EXIF data in images as it really is the Swiss Army knife for all things metadata related with images. Recently, I wanted to strip some privacy-related metadata from some photos; specifically location, people and keywords. That is, I wanted to keep the title, the camera settings, the creator, and so on, but remove information that pertains to people and place. This is the script that I wrote:… continue reading.

Installing Xdebug on PHP 8.1 installed with Homebrew

I have recently set up a new M2 MacBook Air and as usual, installed Homebrew and then installed PHP. Homebrew is always up to date, so it installed PHP 8.1 for me. Again, as usual, I installed Xdebug using pecl install xdebug. This whirrs and clicks for a while downloading and compiling the xdebug.so and then fails with: rob@ardent ~ $ pecl install xdebug downloading xdebug-3.1.5.tgz … Starting to download xdebug-3.1.5.tgz (232,070 bytes) … Build… continue reading.

BBEdit Hosts File Syntax Highlighting

While editing my Hosts file in BBEdit, I wondered how hard it would be to create syntax highlighting for it. A quick google later, I discovered that I needed to create a Codeless Language Module and this is my first attempt: To install, download Hosts.plist and copy to your iCloud Drive's BBEdit/Application Support/Language Modules directory, restart BBEdit and you're done. I've kept it really simple and just highlight comments and the IP address, but it… continue reading.

OpenConnect on Mac

One of my clients has recently moved to AnyConnect VPN and I've been having routing problems with the official Mac client. As my colleagues on Linux on the project have not had these issues, I investigated and installed the OpenConnect client. These are my notes after scouring the Internet to set it up how I want it. Installation I used Homebrew: $ brew install openconnect OpenConnect is a CLI tool. If you want a GUI… continue reading.

MailTrackerBlocker

One thing that has annoyed me about receiving email is so-called tracker pixels. These usually 1x1px transparent images that are remotely loaded into HTML email enable the sender to track information about be. A good resource about them is No To Spy Pixels. As such I've tended to run my email clients with remote resource loading disabled, which isn't the best experience as a surprising number of legitimate email even display the call-to-action link as… continue reading.

Syncing macOS Keychain certificates with Homebrew's OpenSSL

One of my clients runs their own Composer repository for some packages which is hosted on internal system where the SSL is signed by an internal root CA cert. I installed the relevant certificates into my Keychain, but Composer complained about not being able to trust the certificate. I use the Homebrew version of PHP which links to Homebrew's OpenSSL, so I realised that OpenSSL wasn't looking at the keychain, but instead at its own… continue reading.

Completely reset Apple Watch's Mac auto-unlock

Recently, the ability for my Apple Watch to automatically unlock my Mac started failing on Big Sur betas and then on my main Catalina installation. I'm not sure, but it's possible that updating to WatchOS 7 caused it, though it might have been related to re-pairing to fix the battery life issues I was having. Or, of course, some other software gremlin! Whatever, it was annoying. Scouring the Internet, I discovered what to do in… continue reading.