Pragmatism in the real world

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.

Counting the rows in a SQL Group By query

I recently needed count the number of rows in an SQL query that had a Group By clause. It looked something like this: SELECT account_name FROM events WHERE created_at >= CURDATE() – INTERVAL 3 MONTH GROUP BY account_id This provides a list of account names (28 in my case), but if you try to count them using: SELECT COUNT(account_name) as c FROM events WHERE created_at >= CURDATE() – INTERVAL 3 MONTH GROUP BY account_id You… continue reading.

Keep your iPhone passcode secret

TL;DR: If someone sees you enter your passcode on your phone and then steals your phone, they can lock you out of your Apple account, losing access to all your iCloud data, including photos. Treat your phone passcode as carefully as the secret it is. The problem I heard about "A Basic iPhone Feature Helps Criminals Steal Your Entire Digital Life" by Joanna Stern & Nicole Nguyen on The Talk Show and learnt something new.… continue reading.

PHPUK 2023

I have just returned from the 2023 edition of PHPUK and, as always, found it a valuable conference to catch up with the PHP community and find out what’s happening in the ecosystem. This year, I was accepted to speak on the differences between RPC, REST and GraphQL APIs and was surprised and gratified that the room was at full capacity. Thank you to everyone that attended; I hope that you learnt something useful. I… continue reading.

Successful SOC 2 Type II compliance

A very big part of my work at Covie for the last year has been putting in place the processes required for to achieve SOC 2 Type II compliance. This standard by the AICPA is all about an organisation's security, availability, processing integrity, privacy and confidentiality controls and processes. It's a comprehensive set of requirements covering our product's and organisation's security. Essentially, it shows that the company's processes and systems are designed to keep the… continue reading.

2022 in pictures

We've reached the end of 2022. We're a little bit further from the COVID-19 pandemic and I've travelled more this year too. A bitter-sweet year when a close friend died and I managed to catch COVID-19 again, but fortunately wasn't as affected as last year and recovered more quickly. I continued to take a photo every day though my Project 365 which allows me to appreciate what happened during this year of my life. January… continue reading.

Only display body on error with curl

Sometimes, I only want to display the response from a curl request if it errors – i.e. the status code is 400 or higher. With curl 7.76 or greater this is done using the –fail-with-body parameter: curl -s –fail-with-body \${id} \ -H "Content-Type: application/json" \ –data "@data.json" On success, the return code ($?) is 0 and on failure the body is output with the return code set to 22. Prior to 7.76, you can… continue reading.

Override Nginx media type for a URL

I followed Maarten Balliauw's article on setting up a pointer to my Mastodon account on my own domain at I'm not sure how useful it is and would prefer to have my own domain as the main account. Something to think about at least. When setting up, I realised that it was being served with a Content-Type of application/octet-stream, when it should be application/json. To fix this, I added this to my… 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 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.