The personal blog of Sam McLeod

Defaulting git clone to shallow (depth=1)

Before adding this to my shell config, I would manually add –depth=1 to all my git clones. I never saw the value in downloading the entire source history and (at times incorrectly) committed files to my local machine unless I was cloning the repo for the purpose of backing it up. It seems strange to me that git doesn’t have a config option to set this as default behaviour. My hack for this is a simple zsh/bash function that can wrap git commands - and as such add clone depth if it’s not specified. function git_wrapper() { # If invoked by another function, alias or xargs, interpret it as normal if [[ -n ${FUNCNAME[*]} ]] || [[ -n $ALIASES ]] || [[ -n $XARGS ]]; then command git "$@" return fi # clone with depth=1 if no depth is not specified if [[ $1 == "clone" ]] && [[ $* !

How likely would you be to block a company from asking you to rate everything they do?

I’m tired of getting emails from companies asking me to rate their products and servicesIt feels like you can’t even buy a coffee these days without being asked if you would recommend the coffee shop to a friend or colleague. “How likely would you be to recommend us to a friend or colleague?” “Rate our service from 1-10” “How did we do?” “How was your experience?” It’s a simple question, and it’s a simple score. It’s also a simple way to annoy your customers and end up in their spam folder. What is NPS?NPS stands for Net Promoter Score.

Escaping the Time Trap: Why Estimating Effort, Not Time, Leads to Greater Success

Many organisations - while branding themselves as “Agile” - continue to make the mistake of estimating project velocity based on time than effort. This flawed approach equates to measuring the team’s ability to estimate time, rather than focusing on the actual effort needed to complete tasks. This isn’t to say that time isn’t important - quite the opposite. Time is often a critical factor in delivery. However, it’s important to understand that time is a constraint and a metric - not a unit of work. Managers want to know how much time a project or deliverable will take - but often aren’t interested in the complexity of the work.

Open Budgeting - Subscriptions & Licences

Budgeting for Subscriptions & LicensesTransparently tracking my financial expenses spent on subscriptions and licenses. I’m doing this in the interest of exploring subscription fatigue and to help others who might interested in doing similar. Recurring Expenses Expense Cost (Yearly) Category Required/QoL Want To Cancel/Replace Usefulness Satisfaction Frequency 1Blocker $12 Security/Privacy Required No Critical High Yearly 1Password $55 Security Software Required Yes Critical Medium ^1 (Was high before v8) Monthly Amazon Prime $85 Utilities QoL Yes High Medium Yearly Apple iCloud $54 Backup Software Required No Critical High Yearly Apple Music $130 Entertainment Required No High High Yearly Aus.Social $24 Entertainment/Donation QoL No Medium High Monthly Backblaze $96 Backup Software Required No Critical Medium 2 Yearly Bear $22 PKM Required No/Maybe High Medium Yearly BetterTouchTool $8 Utility QoL No High High 2 Yearly Fastmail $81 Utility QoL No Critical High Yearly Github CoPilot $120 Coding/Writing Tool QoL No High High Yearly Infuse $14.

Don't buy into the myth of group brainstorming

Numerous research shows that group “Brainstorming” isn’t just ineffective - it has a negative correlation with quality, produces less results and reinforces biases. Studies have shown the negative effects to be especially apparent in person (as opposed to remote/online). By contrast “Brainstorming” alone / asynchronously produces higher quality results, surprisingly - with less biases. HBR - Why Group Brainstorming is a Waste of Time Open for Ideas - Science shows Brainstorms don’t work. Why do we still use them? Psychological Science - There’s a Better Way to Brainstorm The group dynamic of brainstorming is a “social trap” - where the group is incentivised to agree with each other, rather than produce the best ideas.

Energy, Sustainability and Deployment Frequency

Deployment / Delivery FrequencyI often end up needing to advocate for more frequent delivery/deployments with clients. Abstract Frequency = Energy, Energy = Sustainability There’s the usual benefits commonly discussed such as improved feedback, reduced risk, well understood processes, maintainable dependencies etc… however what’s often missed entirely is how it relates to the health and sustainability of the team. Note: I use the term “Delivery” and “deployment” interchangeably throughout this post. How We Get Our Energy I like to think of how get my energy throughout the day/week/month/year in terms of “wins”. “Wins”I get the majority of my energy from “wins”.

Zsh Configuration and Plugins - Part Two

Zsh Configuration and Plugins - Part two You can find the first post in this series here. FunctionsMany of my functions start out as aliases and then I convert them to functions when I need to add more functionality. You can find these in 9-function.rc. pdfcompress () { gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile="$1".compressed.pdf "$1"; } function echoerr() { printf "%s\n" "$*" >&2; } Navigation fcdInteractive cd using fzf function fcd() { local dir; while true; do # exit with ^D dir="$(ls -a1p | grep '/$' | grep -v '^.

Github Not-So-Reusable Actions

Github Actions is a “BYOBE” (Bring Your Own Bloody Everything) offering that provides basic CI with surprisingly convoluted configuration to Github. The product as a whole is an exercise in frustration, one of the worst parts is the lack of reusability and the complexity required to achieve it. Github’s concept of reusable workflows on Github Actions is clearly a cobbled together afterthought. There’s no one way to reuse workflows - you can’t simply include / inherit FROM another workflow and no support for standard YAML anchors/aliases1. Reusable Workflows Composite Actions Composite ActionsComposite actions are a way to combine multiple steps into a single step.

YAML Anchors and Aliases

The YAML Spec defined a simple way to reuse values in YAML documents by means of Anchors and Aliases. Anchors (&) are used to define a value. Aliases (*) are used to reference a value. Overrides (<<:) are used to merge values. ExampleThis may look more complicated at first, but once you know what it’s doing it’s very simple and can greatly reduce the amount of duplication in your YAML files and with that the risk of config drift and copy/pasta errors. simple-anchor: &hw "echo Hello World" env: &env-common - MY_ENV_VAR_1: "my value 1" - MY_ENV_VAR_2: "my value 2" - MY_ENV_VAR_3: "my value 3" with: &with-common my-input: "my value" my-secret-input: ${{ secrets.

Zsh Configuration and Plugins - Part One

As of 2022, I’ve been using zsh as my primary shell for 14 years. Over that time I’ve experimented with and accumulated a lot of configuration, scripts, hacks, plugins and themes. I’ve settled on a configuration that I’m mostly happy with, over this series I’m going to share my current setup. I store all of my configuration in a git repository available here: zsh-bootstrap Star Fork File StructureI’ve organised my setup into a few different files. Installationbootstrap_shell.sh- Used to install the shell, configuration, plugins and homebrew packages when first setting up a new macOS machine/VM. Configuration zshrc - The main zsh config file, it sources the following (.

Encourage Your Peers To Contribute To Open Source

Contributing to Open Source is important to the quality and maintainability of the software and engineering communities we rely on every day - so why is it that so many developers/engineers never participate? I frequently cross paths who may have been in tech for some time - but don’t contribute to Open Source projects. Their Github/GitLab accounts are bare with almost no activity. They don’t add to or fix problems find the answers to in documentation - even log bug reports. Most companies don’t do enough to contribute back to open source projects. It’s not just that they don’t provide time for their employees to contribute, they don’t even encourage it let alone educate people on how to do it, or why it’s important.

Making Work Visible - Avoid DMs

We create more value by having conversations in public instead of behind closed doors. This is a blurb I add to the teams wiki page. Avoid sending DMs/PMs for support and technical questions We value making work visiblePart of this is achieved by us making an effort to ensure we’re asking for support and technical questions by starting a thread in our squads (or the relevant) room - instead of via of direct messaging (or calling) an individual. This helps with: Sharing knowledge amongst the team. Identifying common problems that others might be having or aware of. Balances support to prevent any individual getting overloaded.