Skip to content

Instantly share code, notes, and snippets.

@garthk
garthk / apple-load-keychain.plugin.zsh
Created August 29, 2024 08:02
ZSH plugin to load SSH keys from your macOS keychain
if [[ -o login && -o interactive ]]; then
ssh-add -q --apple-load-keychain
fi
@garthk
garthk / layout_python_hatch.sh
Created August 30, 2024 11:46
layout_python_hatch: direnv config plugin for python projects using hatch
# shellcheck shell=sh enable=all
# ~/.config/direnv/lib/layout_python_hatch.sh
# direnv config plugin for hatch
# https://direnv.net
fail() {
[ "$#" != "0" ] || set -- FAIL
echo >&2 "$@"
return 1
}
@garthk
garthk / annotations.py
Last active September 3, 2024 07:01
Remove annotations from scripts so they work on Python 3.6
from __future__ import annotations
import ast
import sys
from pathlib import Path
__all__ = ["remove_annotations"]
class AnnotationRemovalTransformer(ast.NodeTransformer):