Skip to content

Instantly share code, notes, and snippets.

@leighklotz
leighklotz / gist:8533118f5d3f755e374518f739d3fd3b
Last active April 5, 2026 00:53
git emacs multfiile commit

In vanilla Emacs (without Magit), the vc (Version Control) library acts as a thin wrapper around Git. Unlike Magit, which has a specialized "staging" workflow, vanilla vc follows the standard Git logic: you must add files to the index (stage them) before you commit them.

Here are the two best ways to do this using only built-in features.

Method 1: Using Dired (Best for multiple files)

If you have many files to commit, the most efficient way is to use vc-dir (which is just Dired with version control information enabled).

  1. Open the directory: Open the folder containing your files in Dired (C-x d).
  2. Identify changes: Look for files marked with M (Modified) or A (Added/Untracked).
  3. Mark the files:
@leighklotz
leighklotz / apple-bash-zsh-wireguard-emacs-ghosttty.md
Last active March 31, 2026 18:49
Summary of much pain trying to use bash and wireguard on a mac

Reclaiming macOS: Fixing Ancient Bash & WireGuard CLI

This guide fixes the friction between modern terminal tools and macOS's restricted system environment (Signed System Volume, GPLv3 licensing locks, and App Store sandboxing).

1. Install Modern Runtimes

Apple's /bin/bash is version 3.2 (2007). Modern scripts (like wg-quick) require Bash 4+. Install the latest via Homebrew:

brew install bash wireguard-tools

2. Fix the "Moving Cursor" Delete Key (Ghostty/Terminfo)

Newer terminals like Ghostty use definitions that root doesn't know, causing the Delete key to move the cursor forward. Compile the terminfo for the root user:

@leighklotz
leighklotz / earthquakes.py
Created December 21, 2025 20:56
Graph count of earthquakes over time
#!/usr/bin/env python3
# https://chatgpt.com/share/69485ed1-f5e8-800c-8396-70818473789c
"""
Weekly count of earthquakes M>=3.0 in Northern California for 2025.
Data source: USGS Earthquake Catalog (ComCat) FDSN Event Web Service.
https://earthquake.usgs.gov/fdsnws/event/1/
This script:
- Queries events in a lat/lon bounding box for 2025
@leighklotz
leighklotz / logging.sh
Last active April 3, 2025 21:23
Bash Logging
#!/bin/bash
# Check if the script is being sourced or directly executed
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "This script is intended to be sourced, not executed directly." >> /dev/stderr
exit 1
fi
COLOR_RED='\e[1;31m'
COLOR_YELLOW='\e[1;33m'
@leighklotz
leighklotz / extract-bbox.py
Created March 29, 2025 05:45
Extract tiles from a Zip of OSM tiles, for Meshastic, APRS, etc.
#!/usr/bin/env python3
# $ ./extract-bbox.py --zipfile OxedOSM_USA_0-13.zip --depth 13 --center-lat 37.123456 --center-lon -122.876543 --radius 10
import os
import zipfile
import argparse
from math import floor, pi, tan, cos, log
@leighklotz
leighklotz / dmesg.txt
Created January 26, 2024 20:23
RPI5 X1002 MP32 failures
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x414fd0b1]
[ 0.000000] Linux version 6.1.0-rpi7-rpi-2712 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24)
[ 0.000000] random: crng init done
[ 0.000000] Machine model: Raspberry Pi 5 Model B Rev 1.0
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000018000000, size 320 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000000000-0x00000000ffffffff]
[ 0.000000] DMA32 empty
@leighklotz
leighklotz / dmesg.txt
Created January 26, 2024 19:53
RPI5 X1002 MP32 failures
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x414fd0b1]
[ 0.000000] Linux version 6.1.0-rpi7-rpi-2712 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24)
[ 0.000000] random: crng init done
[ 0.000000] Machine model: Raspberry Pi 5 Model B Rev 1.0
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000018000000, size 320 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000000000-0x00000000ffffffff]
[ 0.000000] DMA32 empty
@leighklotz
leighklotz / openworld.txt
Created January 20, 2024 00:15
Open World Prompt
The AI considers the possibility of new information and knowledge that may not have been encountered during training, in accordance with the Open World Hypothesis.
@leighklotz
leighklotz / list-branches.sh
Created September 27, 2023 16:46
list-branches.sh
#!/bin/bash
for branch in $(git branch | sed -e 's/[*]//')
do
echo -ne "${branch}\tis contained in these branches:\t"
git branch --contains "${branch}" | tr '\n*' ' ' | sed -e "s/\<${branch}\>//"
echo
done