Skip to content

Instantly share code, notes, and snippets.

View internalsystemerror's full-sized avatar

Gary Lockett internalsystemerror

View GitHub Profile
@internalsystemerror
internalsystemerror / nvm-update.sh
Created June 4, 2025 10:29
Script to automate updates of LTS Node.js version using NVM
#!/bin/bash
set -euo pipefail
# Load NVM (needed in non-interactive scripts)
export NVM_DIR="$HOME/.nvm"
if [ -s "$NVM_DIR/nvm.sh" ]; then
. "$NVM_DIR/nvm.sh"
else
echo "ERROR: NVM not found at $NVM_DIR. Is it installed?"
exit 1
@internalsystemerror
internalsystemerror / git-checkout-default
Last active September 19, 2022 13:57
Switch to the default branch of a specified remote git repository
#!/usr/bin/env bash
set -e
USAGE="Usage:
git-checkout-default <remote>"
# show help if requested
if [ "x$1" == "x-h" ] || [ "x$1" == "x-?" ] || [ "x$1" == "x--help" ]; then
echo "Switch to the default branch of a specified remote git repository."
@internalsystemerror
internalsystemerror / fesd
Last active September 19, 2022 16:52 — forked from legeyda/foreach
Bash script to execute a given command in all subdirectories of the current directory
#!/usr/bin/env bash
set -e
trap "exit" INT
USAGE="Usage:
fesd <command>"
# show help if requested
if [ "x$1" == "x-h" ] || [ "x$1" == "x-?" ] || [ "x$1" == "x--help" ]; then