Pragmatism in the real world

Darkening an image with ImageMagick

I regularly need to darken images for background use behind a title. I've been using a filter in Acorn, but finally decided to make it a script that uses ImageMagick so that I could simplify it all with Alfred. This is the script: darken-image.sh #!/usr/bin/env bash if [ -z "$1" ] then echo "Usage: darken-image [contrast=40]" echo "" exit 1 fi in_filename="$1" amount=${2:-40} # Set output filename to original filename with "-darker" appended extension="${in_filename##*.}" name="${in_filename%.*}"… continue reading.

Updating Flickr metadata using Python

I usually use my rodeo app to upload photos to Flickr, but for various reasons, I recently uploaded some photos directly via Flickr itself. One feature of rodeo that I really like is that it sets the date posted to be the same as date taken which means that they are ordered correctly in my photo stream. As this doesn't automatically, I knocked up a Python script to fix these photos for me. The key… 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.

2023 in pictures

As we finish 2023 and look forward to 20024, I have had an enjoyable time looking back at the photos I took throughout the year. As with the last 10 years, I have managed to take a least one photo every day as part of my Project 365, which allows me to remember what happened during this year of my life and reflect on the year as I usually do. January I like to start… continue reading.

index.md vs _index.md in Hugo

For years, 19ft.com has been a hand-built static HTML website with a smidgen of PHP to set things like dates and include a header and footer to each page. While I haven't yet redesigned it, it seemed prudent to move it to a static site generator before I did so and I chose Hugo, mainly because as a go CLI app, it had no dependencies to worry about. This is a really simple website with… continue reading.

Set a file's created date from YAML front matter in macOS

I have a set of Markdown files with YAML front matter that contains a created property containing the date that the file was created. Due to various machinations, the file creation date no longer matches this date, so I thought I'd fix this. Setting created date of a file On macOS, to change a file's creation date you use SetFile which is installed as part of Xcode. Irritatingly, it uses US format dates: SetFile -d… 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.

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.