Skip to content

Instantly share code, notes, and snippets.

View tomgidden's full-sized avatar

Tom Gidden tomgidden

View GitHub Profile
@tomgidden
tomgidden / common_getopts.zsh
Last active October 1, 2026 00:05
Boilerplate zsh option parsing of --help, --verbose, --dry-run, --force
#!/usr/bin/env zsh
# ^^ although a shebang's not required for a library script...
# https://gist.github.com/tomgidden/8894dffa4ab6fa8b76f6660fca1cf539
# Usage in script:
# source "${0:A:h}/common_getopts.zsh"
# but don't pass any args or it won't work!
#
@tomgidden
tomgidden / expunge_googleupdate
Last active October 1, 2026 00:24
Remove and attempt to lock down Google Software Update (keystone) jobs
#!/bin/zsh
# https://gist.github.com/tomgidden/6cfc0e2a3faa0300edd86e36c35a18f7
# or: curl -fsSL https://unflab.app/get | sh -s -- expunge_googleupdate
set -eu
emulate -L zsh
zparseopts -D -E v=verbose n=dry_run
[[ -n $dry_run ]] && verbose=-v
@tomgidden
tomgidden / colors.zsh
Created September 17, 2026 15:39
Reworking of zsh/colors with terminal detection and dark color scheme detection
#!/bin/zsh
set -eu
main() {
colors_init
echo "\$COLOR=$COLOR"
echo "\$DARK=$DARK"
echo "\$COLOR_RGB=$COLOR_RGB"
@tomgidden
tomgidden / NFS automount on macOS.md
Last active September 18, 2026 10:26
NFS automount on macOS Golden Gate
@tomgidden
tomgidden / expunge_adobecc
Last active October 1, 2026 00:22
Script to kill off all Adobe Creative Cloud jobs on macOS
#!/bin/zsh
# https://gist.github.com/tomgidden/6a9f083988f7d4505d4e38674d416c04
# or: curl -fsSL https://unflab.app/get | sh -s -- expunge_adobecc
PROCESS_NAMES=(
"ACCFinderSync"
"Adobe Acrobat DC"
"Adobe Acrobat"
"Adobe After Effects"
@tomgidden
tomgidden / docker-compose@.service
Created October 19, 2024 03:18
systemd file for docker compose, with added dereference of symlinks
[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service network-online.target autofs.service
[Service]
Type=oneshot
RemainAfterExit=true
WorkingDirectory=/etc/docker/compose/%i
ExecStart=/bin/sh -c 'cd "$(dirname $(realpath /etc/docker/compose/%i/compose.yml))" && docker compose up -d --remove-orphans'
@tomgidden
tomgidden / a4_graph_paper.pdf
Last active September 30, 2024 10:31
Emergency A4 graph paper
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomgidden
tomgidden / Terminal window colour from context
Last active June 20, 2024 00:40
.zshrc file (or /etc/zshrc) to automatically change terminal colour and prompt for different tabs/windows or remote hosts
### ------------------------------------------------------------------------
### Terminal window colour from context
### https://gist.github.com/tomgidden/f6e11571d4f6e52faa45ebecc4d18a7b
# https://www.xfree86.org/current/ctlseqs.html
# Italic: "\x1b[38;2;3m"
# Bright: "\x1b[38;2;0m"
tty_color () {
local C=$1
@tomgidden
tomgidden / mitigate_CVE-2024-2961.sh
Last active May 10, 2024 15:18
Shell Script or Ansible playbook to mitigate issues with CVE-2024-2961
#!/bin/sh
# Test if CN-EXT charsets are enabled
if ( iconv -l | egrep -q 'CN-?EXT' ); then
# Comment out CN-EXT charsets in gconv-modules config
find /usr/lib* \( -path '*/gconv-modules' -o -path '*/gconv-modules-extra.conf' \) \
-exec sed '/^\([^#].*\)\?\(CNEXT\|CN-EXT\)/ s/^/###mitigate_CVE-2024-2961: /g' -i {} \;
# Rebuild gconv-modules.cache

"If I whisk it awwww, could you bweak my fawwww?

Howdowahruh? Howdowahbrie? I am naahrrimam suffocating.

I wannafewah. Rufuwahblah.

Tell me is this wuhuhkifiuhlah.