Skip to content

Instantly share code, notes, and snippets.

View leogdion's full-sized avatar

leogdion leogdion

View GitHub Profile
@leogdion
leogdion / namecheap-gh-pages-dns.py
Created November 3, 2026 19:39
Point a Namecheap-hosted domain at GitHub Pages via the Namecheap API (A/AAAA/www CNAME + verification TXT, preserves other records)
#!/usr/bin/env python3
"""Point a Namecheap-hosted apex domain at GitHub Pages using the Namecheap API.
Namecheap's setHosts call REPLACES every record on the domain, so this script:
1. fetches the current records (getHosts) and saves them to a backup XML file,
2. removes only the records that would conflict with GitHub Pages
(A/AAAA/ALIAS/CNAME/URL/FRAME at @ and www, plus an old challenge TXT record),
3. keeps everything else (MX, other TXT, other subdomains...) unchanged,
4. adds the GitHub Pages A/AAAA records, the www CNAME and (optionally)
the domain-verification TXT record.
@leogdion
leogdion / copy-xcode.sh
Last active October 30, 2026 16:04
Copy the newest Xcode .xip and exported simulator SDK bundles to the Downloads folder of multiple Macs over SSH, with upfront logins and per-machine progress bars
#!/bin/bash
#
# Copy the newest Xcode .xip and any exported simulator SDK bundles to the
# Downloads folder of one or more machines over SSH. Everything else visible in
# each remote Downloads folder is first moved to a dated folder in that
# machine's Trash, or to a dated folder inside Downloads if that fails. If any
# file could not go to the Trash, the copy still runs with a warning and existing
# files are left alone, with a new item of the same name copied under a -new
# suffix. Otherwise re-running resumes interrupted transfers and skips files that
# are already up to date.
@leogdion
leogdion / swift-automation-links.md
Last active October 19, 2026 18:29
Building Scalable Swift Automation: From CI to App Store Distribution: Links & Resources
@leogdion
leogdion / simclean.sh
Created September 14, 2026 16:20
delete simulator devices and runtimes for a given OS major version
#!/usr/bin/env bash
#
# simclean.sh — delete simulator devices and runtimes for a given OS major version.
#
# ./simclean.sh 27 # dry run, all platforms
# ./simclean.sh 27 --apply # actually delete
# ./simclean.sh 27 --apply --platform iOS
# ./simclean.sh --sweep --apply # only clean unavailable devices / broken runtimes
#
set -euo pipefail
#!/usr/bin/env bash
#
# deploy-xcode.sh — install Xcode + simulator runtimes on a remote Mac,
# pulling the files from another machine.
#
# The xip extracts to Xcode.app (release) or Xcode-beta.app (beta);
# whatever comes out overwrites that same app in /Applications.
#
# Usage:
# ./deploy-xcode.sh <target-machine> <source-machine> <source-path>
Set up versioned, in-repo agent memory for this project — two stores, both committed to git.
First, create `.claude/agent-notes.md` as an append-only running log of my corrections and standing always/never directives, seeded with a self-describing header that says: read it at the start of every session before doing work; append one line per directive proactively (without being asked) whenever I make a correction or give an always/never instruction; newest lines at the bottom; one line per entry; and when a directive supersedes an earlier one, update or remove the stale line rather than leaving both.
Second, create `.claude/memory/` as this project's memory store, seeded with a `.claude/memory/MEMORY.md` index that explains the convention: one markdown file per project-scoped fact worth remembering (decisions, constraints, gotchas, context not derivable from the code or git history), each with a one-line entry in the index; update or delete memory files that turn out to be wrong rather than leaving stale one
@leogdion
leogdion / create_compound_clip.sh
Created July 12, 2026 20:22
Creates a Compound Clip from the Source Video for FCP
#!/bin/bash
# Function to process a single MP4 file
process_mp4() {
local INPUT_FILE="$1"
local OUTPUT_FILE="${INPUT_FILE%.*}.fcpxml"
echo "Processing: $INPUT_FILE"
# Get filename without extension
@leogdion
leogdion / rename.sh
Last active June 17, 2026 19:45
Rename Podcast Clips
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./rename.sh "EAS-207. " [--apply]
# Dry-run by default; pass --apply to actually rename.
prefix=""
apply=0
for arg in "$@"; do
case "$arg" in
@leogdion
leogdion / cleanup-pr-caches.yml
Created June 14, 2026 22:37
GitHub Actions: auto-delete a PR's stranded caches when the PR closes
# .github/workflows/cleanup-pr-caches.yml
#
# Deletes all GitHub Actions caches scoped to a PR's merge ref as soon as the
# PR closes (merged or not). Those caches live on refs/pull/<N>/merge and can
# NEVER be restored by any other branch, so after the PR closes they are pure
# dead weight that otherwise lingers until 7-day-inactivity or LRU eviction.
#
# Drop this file into each repo at: .github/workflows/cleanup-pr-caches.yml
name: Cleanup PR caches
@leogdion
leogdion / compare-mkv.sh
Created May 31, 2026 14:39
Compare all MKV files in a directory to find the real movie among near-identical Blu-ray rip playlists
#!/usr/bin/env bash
#
# compare-mkv.sh — Compare all MKV files in a directory to find the real movie
# among near-identical Blu-ray rip playlists.
#
# Usage: ./compare-mkv.sh (operates on the current directory)
#
# Requires: ffprobe, ffmpeg (from FFmpeg). On macOS: brew install ffmpeg
set -euo pipefail