Skip to content

Instantly share code, notes, and snippets.

View ivorpad's full-sized avatar
🇪🇸
Working from Spain

Ivor ivorpad

🇪🇸
Working from Spain
View GitHub Profile

Hammerspoon: ⌘⇧4 Screenshot → File + Clipboard (debug log + fix)

Goal: pressing ⌘⇧4 should save a region screenshot to ~/Downloads and put the PNG on the clipboard. Out of the box macOS only saves the file (no clipboard). This note captures the debugging journey, the wrong hypotheses, the real root cause, the working fix, and the diagnostic toolkit — so it can be re-debugged or reproduced later.

TL;DR

  • You cannot reliably steal ⌘⇧4 from macOS mid-session. The screenshot hotkeys (com.apple.symbolichotkeys) are registered into the live WindowServer session at login. Disabling one on disk does not take effect until the next login. Restarting SystemUIServer does not reload it either.
  • So the winning design is Plan B — stop fighting the key: let macOS own ⌘⇧4 (it saves the file), and have Hammerspoon watch ~/Downloads and copy each new screenshot PNG to the clipboard. No logout, no hotkey race, reboot-proof.
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import base64
import json
import mimetypes
import os
import re
import shlex
// ab-batch-type: Fast keyboard typing for canvas-based web apps via agent-browser daemon.
// Sends all keystrokes through the daemon's keyboard action (trusted CDP events, single event path).
//
// Usage:
// node <this-script> "text" Tab "text" Enter ... # args mode
// echo '"text" Tab "text" Enter ...' | node <this-script> # stdin mode (unlimited size)
//
// Stdin mode reads all input, splits on whitespace (respecting "quoted strings"),
// and processes identically to arg mode. Use for large payloads that exceed shell
// argument limits.
@ivorpad
ivorpad / tmux-clean
Created February 13, 2026 06:20
tmux-clean: Perl filter to strip TUI chrome from tmux capture-pane output (ANSI, box-drawing, Claude Code UI)
#!/usr/bin/env perl
use utf8;
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
my $blank = 0;
while (<STDIN>) {
# strip ANSI escape sequences
s/\e\[[0-9;]*[a-zA-Z]//g;
s/\e\][^\a]*\a//g;
#!/usr/bin/env bun
/**
* Pre-compaction context extractor.
* Parses the Claude Code transcript JSONL, extracts key context
* (user corrections, decisions, important state), and calls claude -p
* to produce a structured summary saved to .claude/compact-context.md
*/
import { readFileSync, writeFileSync, mkdirSync, appendFileSync } from "fs";
import { join, dirname } from "path";
@ivorpad
ivorpad / SKILL.md
Created January 26, 2026 13:53 — forked from kieranklaassen/SKILL.md
Claude Code Swarm Orchestration Skill - Complete guide to multi-agent coordination with TeammateTool, Task system, and all patterns
name orchestrating-swarms
description Master multi-agent orchestration using Claude Code's TeammateTool and Task system. Use when coordinating multiple agents, running parallel code reviews, creating pipeline workflows with dependencies, building self-organizing task queues, or any task benefiting from divide-and-conquer patterns.

Claude Code Swarm Orchestration

Master multi-agent orchestration using Claude Code's TeammateTool and Task system.


@ivorpad
ivorpad / mcp-conductor-sop.md
Created October 22, 2025 13:01
SOP: Adding Custom MCP Servers to Conductor (Claude Code)

SOP: Adding Custom MCP Servers to Conductor (Claude Code)

Overview

This guide provides step-by-step instructions for adding custom MCP (Model Context Protocol) servers to Conductor when the UI doesn't provide a built-in option.

Prerequisites

  • Conductor (Claude Code) installed
  • Terminal access
  • jq command-line JSON processor installed
  • MCP server package details (npm package name or command)

DEEP-RESEARCH: INFINITE PARALLEL MULTI-AGENT RESEARCH COMMAND

Think deeply about this infinite research task. You are about to orchestrate a sophisticated parallel multi-agent research system where each agent explores unique, non-overlapping angles of any topic.

ARGUMENTS PARSING

Parse the following arguments from "$ARGUMENTS":

  1. topic - The research topic to investigate
  2. num_agents - Number of parallel research agents (3-10, default 5)
  3. max_iterations - Number of iterations (1-N or "infinite", default "infinite")
process.env.ALACRITTY_LOG
process.env.ALIYUN_REGION_ID
process.env.ANTHROPIC_API_KEY
process.env.ANTHROPIC_AUTH_TOKEN
process.env.ANTHROPIC_BASE_URL
process.env.ANTHROPIC_BETAS
process.env.ANTHROPIC_CUSTOM_HEADERS
process.env.ANTHROPIC_MODEL
process.env.ANTHROPIC_SMALL_FAST_MODEL
process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION_AWS_REGION
{
"messages": [
{
"content": "Hello! I see you need help with interview analysis. Could you please provide more details about the interview or the specific task you want to accomplish? For example, are you looking to analyze interview transcripts, summarize key points, assess candidate responses, or something else? Let me know how I can assist you best!",
"additional_kwargs": {},
"response_metadata": {
"finish_reason": "stop",
"model_name": "gpt-4.1-2025-04-14",
"system_fingerprint": "fp_799e4ca3f1",
"service_tier": "default"