Skip to content

Instantly share code, notes, and snippets.

@ahgraber
ahgraber / alt-text.md
Last active April 5, 2026 15:05
How I Use AI (Apr 2026) - Prompts
mode agent
description Create alt-text for images in markdown files
tools
editFiles
search
usages
changes
fetch

Instructions

Describe this figure so a reader who cannot see it understands both what it depicts and what it communicates. The description should be detailed enough that someone could reproduce or redraw the figure from the text alone.

@ahgraber
ahgraber / _README.md
Last active April 7, 2026 18:19
How I Use AI (Apr 2026) - Hooks

Claude Code Configuration

Security hooks

All hooks live in hooks/ and are symlinked into ~/.claude/hooks/ by Home Manager. They run as Claude Code lifecycle events and exit with one of three codes:

Exit code Meaning
0 Allow (or ask-mode: present a permission dialog)
@ahgraber
ahgraber / README.md
Created December 30, 2023 16:50
Editing Customize TimeMachine Exclusions

Customize TimeMachine Exclusions

Add exclusions by dirname

find $(pwd) -type d -name <NAME> -maxdepth 3 -exec tmutil addexclusion {} \;

Automate exclusions

@ahgraber
ahgraber / loc.sh
Created March 1, 2023 14:17
Get lines of code across multiple repos
#!/bin/bash
## assumes "multiple repos" are all in the same parent directory, which is also the current working directory
# set up git
for dir in ./*/; do
dir=${dir%*/} # remove the trailing "/"
cd "$dir"
echo "$dir"
git fetch -p && git pull
@ahgraber
ahgraber / README.md
Last active January 16, 2023 14:11
Clean up GitHub Actions workflow runs

Cleanup legacy GitHub Actions workflow runs

Python utility to delete GitHub Actions runs for a repository, based on parameters. The GitHub UI currently allows removal of individual workflow runs, but this becomes tedious with a bulk of previous runs. Credit: https://gist.github.com/magnetikonline/2242eb18bf8890e9fc72b3c3ef41bd93

Usage

  1. Create a Personal access token allowing the workflow scope:
  2. Execute the script against a target GitHub repository (with optional parameters).
@ahgraber
ahgraber / latest.md
Last active May 19, 2022 13:17
Latest github release
@ahgraber
ahgraber / open-in-vscode.md
Last active February 25, 2022 14:43
Open folder in VSCode

Steps

  1. Launch Automator
  2. Create New Document
  3. Create a new Quick Action (Select "Quick Action")
  4. Add the Action Workflow receives current files or folders in Finder
  5. If desired, add custom image/icon (see comment below)
  6. Add a new Run Shell Script action to the workflow.
  7. Configure the Workflow
@ahgraber
ahgraber / ! Managing conda envs.md
Last active October 15, 2025 03:30
Sensible SOP for managing conda envs on MacOS

Creating / Managing conda envs

Rules / SOPs:

  1. Don't work in base environment
  2. Use mamba as a solver
  3. Create default environments with pinned packages, and clone / update the default envs as needed
@ahgraber
ahgraber / Apple Silicon + emulation.md
Last active August 28, 2025 12:56
Apple arm64 and x86 emulation

Working with Apple arm64 architecture

For most applications, native vs. emulated modes do not need to be user-managed. However, for development purposes, managing the entire stack's architecture may become necessary.

Emulated terminal environment

For an x86 (Rosetta-emulated) environment, create an emulated Terminal.app:

  1. Open Finder