Pragmatism in the real world

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.

Uploading to Flickr directly from Mac Finder

I upload lots of pictures to Flickr and sometimes I just want to point at a file in Finder and upload it. Fairly recently, macOS introduced Quick Actions to Finder and this seemed like the ideal way to have a quick and easy way to upload an image to Flickr. To do this, the easiest way is to use Automator and call through to my Rodeo command line tool to do the actual upload. Start… continue reading.

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: #!/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.

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.

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.

Add TouchID authentication to sudo

Now that I have a TouchID enabled Mac, I want to be able use TouchID for sudo access. There's a pam module available, so it just needs enabling: Edit /etc/pam.d/sudo Add a new line under line 1 (which is a comment) containing: auth sufficient (Leave all other lines in this file.) That's it. Now, whenever you use sudo, you have the option of using TouchID to authenticate. Scripting it It turns out that whenever… 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.

Keyboard control of Big Sur notification alerts

With the release of Big Sur, my scripts for keyboard control of macOS notification alerts stopped working. With a bit of experimentation and help from Google, I have written new ones. Closing an alert To close a notification alert on Big Sur, conceptually we want to press the X button that appears when you hover over it. The AppleScript to do this is: activate application "NotificationCenter" tell application "System Events" tell process "NotificationCenter" set theWindow… continue reading.

Add Apple Watch authentication to sudo

Note: This article was written in for Intel Macs (not Apple Silicon) that do not have TouchID. If you have a modern Mac, then I recommend Add TouchID authentication to sudo.   Since 1Password added Apple Watch unlock I've wondered if there are other situations when I need to enter my password where it instead require a click of my Watch instead. I recently came across an article about how to make sudo work with… continue reading.

Prevent an external drive from auto mounting on macOS

I have an external drive attached to the USB hub on my Thunderbolt Display that I use to clone my laptop's internal drive every night using the schedule feature of SuperDuper!. At the appointed time, SuperDuper! will mount the external drive, clone the internal drive and then unmount the external drive again which is very convenient. However, whenever I plug in my laptop, the drive automatically mounts. This doesn't particularly worry me, but when I… continue reading.