Pragmatism in the real world

2020 in Pictures

As we reach the end of 2020, I continue my tradition of looking back at my year through the photos that I took as I have done every year since 2009. I have been doing a Project 365 for a good few years which acts as a diary too, so I have the opportunity to appreciate what happened this year in my life. This has been quite a year with the pandemic hitting the UK… 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.

Using jenv to select Java version on macOS

When working on OpenWhisk, I discovered that it needed a different Java to the one I had installed. Looking around the Internet, I discovered jenv which shouldn't have surprised me as I use pyenv and I'm aware of rbenv too. As I use Homebrew, these are the commands I used. Firstly install jenv, the latest Java (15 at this time) and any other versions you need. Java 8 and 12 in this example: $ brew… continue reading.

Installing PHP extensions without pecl in PHP 8 Docker images

UPDATE: Since this was published, PR 1087 has been raised and merged with restores pecl to the Docker PHP 8 images. I discovered recently that pecl is no longer shipped in the PHP Docker images for PHP 8. This appears to be related to the deprecation of –with-pear in PHP core as noted in issue 1029. Consider this Dockerfile: FROM php:8.0.0RC5-cli-buster RUN pecl install mongodb && docker-php-ext-enable mongodb If you build, you'll discover the pecl… 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.

Using MailHog via Docker for testing email

I recently needed to modify the emails that a client project sends out. It was set up to send via SMTP and so the easiest way to do this for me was to add a local MailHog instance and point the application at it. Manually running via Docker The quickest and easiest way to do this is via Docker. Manually, we can do: $ docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog This will run MailHog… continue reading.

Dorothy Hodgkin

Dorothy Hodgkin by J.S. Lewinski, 1697.© estate of J.S. Lewinski / National Portrait Gallery, London To celebrate Ada Lovelace Day today, I want to highlight Dorothy Hodgkin, a British chemist who made amazing discoveries with X-ray crystallography of molecules. In particular, she confirmed the structure of penicillin and discovered the structure of vitamin B12 and also of insulin. She won the Nobel Prize in Chemistry for her work on vitamin B12, which was described as… continue reading.

Step-debugging linked composer dependencies with PhpStorm

One project I'm working on has multiple separate parts in different git repositories that are brought into the main project using linked composer directories. I needed to get step debugging working in PhpStorm and this is the approach I took.

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.

Recursive PHP lint

There are many scripts that recursively execute php -l on a set of files or directories. This is mine: #!/usr/bin/env bash set -o nounset # Recursively call `php -l` over the specified directories/files if [ -z "$1" ] ; then printf 'Usage: %s …\n' "$(basename "$0")" exit 1 fi ERROR=false SAVEIFS=$IFS IFS=$'\n' while test $# -gt 0; do CURRENT=${1%/} shift if [ ! -f $CURRENT ] && [ ! -d $CURRENT ] ; then echo… continue reading.