Pragmatism in the real world

Building Go binaries for different platforms

One nice thing about Go is that it can cross-compile which allows me to use my Mac to build binaries for different operating systems. This is increibly useful for providing binaries for Rodeo, my command line Flickr uploader. To do this we set the GOOS and GOARCH environment variables before calling go build. For example to build for x64 on Linux, I do: version=`git describe –tags HEAD` env GOOS=linux GOARCH=amd64 go build \ -ldflags "-X… continue reading.

Setting the version of a Go application when building

When I was building Rodeo, my command line Flickr uploader, one thing I wanted to do was set the version number that you see when you type rodeo -v to the correct version when I build the application for release. The basic process I wanted was: Tag git repository with new version number and push Build rodeo with that version without editing any files Upload binary I've emphasised the important part. I don't want to… continue reading.

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: 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.