Skip to content

Instantly share code, notes, and snippets.

View jamesfishwick's full-sized avatar

Mr James W Fishwick jamesfishwick

View GitHub Profile
@jamesfishwick
jamesfishwick / claude-borrow-session.zsh
Last active May 20, 2026 22:14
Borrow a Claude Code session JSONL across CLAUDE_CONFIG_DIRs so the other account's --resume can pick it up. Useful when running multiple Claude Code accounts via the CLAUDE_CONFIG_DIR multi-account pattern.
#!/usr/bin/env zsh
# claude-borrow-session -- surface a Claude Code session JSONL from one
# CLAUDE_CONFIG_DIR ("FROM") inside another ("TO") so the TO account's
# `--resume` picker can pick it up.
#
# Background: Claude Code's CLAUDE_CONFIG_DIR env var lets you run multiple
# accounts side by side, each with its own config dir. Sessions live at
# $CLAUDE_CONFIG_DIR/projects/<encoded-cwd>/<session-id>.jsonl, and `--resume`
# only sees sessions inside the running process's config dir. This helper
# symlinks a single session JSONL from FROM into the parallel path under TO.
@jamesfishwick
jamesfishwick / cli-preferences.sh
Created April 27, 2026 21:53
Claude Code hook: single-source-of-truth CLI preference enforcement (inject + enforce + bootstrap)
#!/usr/bin/env bash
# ~/.claude/hooks/cli-preferences.sh
# Single source of truth for preferred-CLI enforcement.
#
# Four behaviors, one file:
# inject → emit a context block (SessionStart hook)
# enforce → PreToolUse(Bash) gate: blocks banned cmds, fails open if alt missing
# bootstrap → brew-installs any missing alternatives
# list → human-readable table for terminal use
#
@jamesfishwick
jamesfishwick / claude-profiles.md
Last active April 10, 2026 00:49
Multiple profiles for Claude Code using CLAUDE_CONFIG_DIR

Multiple Profiles for Claude Code

Claude Code reads all configuration from a single directory (~/.claude by default). The CLAUDE_CONFIG_DIR environment variable overrides this, redirecting everything -- settings, credentials, CLAUDE.md, project configs, and .credentials.json -- to a different directory.

This gives you completely isolated profiles with separate subscriptions, plugins, hooks, and instructions.

Setup

1. Create profile directories

@jamesfishwick
jamesfishwick / claude-env-setup.md
Created March 14, 2026 00:02
Claude Code environment setup — install modern CLI tools and configure CLAUDE.md

Claude Code Environment Setup

Paste this into a new Claude Code session to install modern CLI tools and configure your CLAUDE.md.


Prompt

You are going to set up my Claude Code environment. Do the following in order:
@jamesfishwick
jamesfishwick / README.md
Last active February 20, 2026 15:41
Minimal Homebrew Auto-Update for macOS - Educational LaunchAgent example for automating Homebrew maintenance

Minimal Homebrew Auto-Update for macOS

A simple, educational example of automating Homebrew maintenance on macOS using LaunchAgents. Perfect for learning macOS automation or for users who want a minimal, auditable alternative to existing solutions.

🤔 Should You Use This?

Most users should use homebrew-autoupdate instead. It's the official, battle-tested solution with thousands of users and comprehensive features.

Use this script if you:

  • Want to learn how macOS LaunchAgents work
@jamesfishwick
jamesfishwick / git-branching-diagram.md
Created February 8, 2021 14:47 — forked from bryanbraun/git-branching-diagram.md
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/0378fda86483def0a9680270c02907a9cbaf7615/template-data.xml
  4. Customize as needed for your team.