Skip to content

Instantly share code, notes, and snippets.

@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.

American Pancake recipe

I tend to measure this easily by weight... put a bowl on the scales, tare the scale (ie. zero it), and then shove stuff in by weight, taring each time.

  • 130g self-raising flour (or plain flour + 2 tsp baking powder)
  • 1/2 tsp salt (~5g)
  • 2 tbsp sugar (~25g)

Lyrics to “Prisencolinensinainciusol” by Adriano Celentano

Ye de col mais saiwan,
Prisencolinensinainciusol;
Ol rait!

Oui de seim deshus nau hobil de sei menna,
Holre mebbe debe colobos daim;
Brrrrrr - chez a maind beghin de col,
Bebi de stay yeah pih-jo oh.

Movie Haiku

  • I dreamed a dream where
    Crowe could sing! When Oscar nods
    required good acting.

  • Corningstone Lady:
    Stay Classy, Whale's Vagina.
    Scotchy scotch scotch scotch.

My post-rationalisation for this is that when testing fountain pens and inks, it's good to have things to write. Pangrams are traditional, but I really just tend to write “unilluminating minimum aluminium”. And the lyrics to “Prisencolinensinainciusol” is something I've tried several times to write out neatly... one day I'll do it.

  • Ugh. False equivalence makes my bile ooze with extreme prejudice

  • Queen Elizabeth intoxicatedly vowed, "Mick Jagger is perfect!"

  • Just a few expectorant lozenges quickly abbreviated my cough.

  • Alexander Hamilton and Thomas Jefferson's political views quickly begat sleaze

Cabelteiss, cabelteiss,
Tie your cables discreetly;
Neat and tight,
Black or white;
Buy them at Lidl quite cheaply!
Fastener of cable
both fast and slow:
AC power and Ether;
Cabelteiss, cabelteiss,
@tomgidden
tomgidden / update_dns
Created November 30, 2022 13:18
Low-dependency bash script to upsert/delete current Droplet public and private IPs in DigitalOcean DNS
#!/bin/bash
STATE=$1
TOKEN=$2
TOKEN=${TOKEN:-$DIGITALOCEAN_TOKEN}
HOSTNAME=$(hostname)
PRIVATE_IP_BASE=10.123.
PRIVATE_DOMAIN=internal.example.com
@tomgidden
tomgidden / lyap-ansi.py
Last active March 12, 2022 11:40
2D Lyapunov in Python using ANSI terminal colors
#!/usr/bin/env python3
import math
from sys import stdout
import shutil
w,h = shutil.get_terminal_size()
a0 = 3.0
a1 = 4.0