Targeted Use of GNU Tools on macOS using direnv

󰃭 2024-11-28 | #bash #macos

Working with bash scripts on macOS often leads to an interesting predicament. MacOS ships with the BSD variants of sed, date, base64 and others that diverge just enough from their GNU counterparts to cause incompatibilities.

Take sed for example:

# GNU (Linux) version - works fine
sed -i 's/foo/bar/' file.txt

# macOS version - fails
sed -i 's/foo/bar/' file.txt
# Error: sed: 1: "file.txt": undefined label 'ile.txt'

# macOS version - requires an extension
sed -i '' 's/foo/bar/' file.txt

There are similar stories for date

Continue reading 

DIY kubectl plugins as aliases

󰃭 2024-10-27 | #bash #k8s #kubernetes #zsh

The Problem

I often find myself googling for some kubectl command that I have used before but can’t quite recall. If I thought long enough about it, I could usually construct most of these, but I like to choose where I deploy my brain cycles carefully, and repetitive CLI commands are not usually at the top of my list of things I want to think deeply about. For example, the command for pulling the initial admin password from a freshly deployed ArgoCD. The command is not that complex:

Continue reading 

DevOps Is A Culture Not A Function

󰃭 2024-10-25 | #DevOps #essay #infra #rant

DevOps is not a function, it is not a team, it is not a role. There, I said it. Click bait deployed. I am by no means the first to express this sentiment (and I urge you to go and read There Is No Such Thing as a DevOps Engineer to get a far more cogent analysis than I will offer here), but having recently been involved with clients that have a DevOps Team and are hiring for DevOps Engineers, I feel it is a point worth revisiting.

Continue reading 

Shrink Your Symbol Fonts

󰃭 2024-10-14 | #fonts #performance #web #woff2

Create a Custom Font Subset with Just the Glyphs You Need

Imagine you’re sprucing up your website. You want crisp, scalable icons for RSS, Twitter, Instagram, and/or GitHub. You are no designer and you don’t want to mess around creating SVGs, so you opt for a symbol font - an excellent choice if I do say so myself. But then you realise it’s a whopping 900KB and includes glyphs for just about everything under the sun. All you need a handful of symbols, maybe SVGs were not such a bad idea after all…

Continue reading 

Git Aliases for the Lazy and Grug Brained

󰃭 2024-10-09 | #cli #git

I’ll admit that I am lazy, have a terrible memory and generally fit the archetype of the grug brained developer. As such I endeavour to make my life as easy as possible, ideally with as little effort as possible. Usually this manifests as me doing some work up front to make my life easier later on, and in fact this has turned out to be a corner stone of my my career to some extent, essentially automating myself out of a job is my job (or at least a good part of it).

Continue reading 