Last active
March 10, 2026 05:42
-
-
Save yuxi-liu-wired/f4076b6f636d59a53b7e84d41d64397e to your computer and use it in GitHub Desktop.
DESTROY ALL ASCII FROM CLAUDE CODE -- ESPECIALLY CLAUDE'S FACE!!!. To install: `curl -fsSL 'https://gist.githubusercontent.com/yuxi-liu-wired/f4076b6f636d59a53b7e84d41d64397e/raw/d4f3e268bd5a6956b9e4ab63e34b8b132a98c0e9/erase_ascii_claude_code.sh' | bash`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # claude-dehat: Remove ASCII art from Claude Code binaries. | |
| # Install: curl -fsSL <gist-url>/claude-dehat.sh | bash | |
| # | |
| # Installs a PATH wrapper that patches each new Claude Code binary | |
| # before it launches. No systemd, no watcher, no race conditions. | |
| set -euo pipefail | |
| PATCHER="$HOME/.claude/erase_ascii_claude_code.py" | |
| STAMP_DIR="$HOME/.local/share/claude/dehat-stamps" | |
| VERSIONS_DIR="$HOME/.local/share/claude/versions" | |
| # --- Find a writable directory earlier in PATH than ~/.local/bin --- | |
| wrapper_dir="" | |
| IFS=: read -ra path_entries <<< "$PATH" | |
| for dir in "${path_entries[@]}"; do | |
| # Resolve ~ and skip ~/.local/bin itself | |
| dir="${dir/#\~/$HOME}" | |
| [[ "$dir" == "$HOME/.local/bin" ]] && break | |
| if [[ -d "$dir" && -w "$dir" ]]; then | |
| wrapper_dir="$dir" | |
| break | |
| fi | |
| done | |
| if [[ -z "$wrapper_dir" ]]; then | |
| echo "ERROR: No writable directory in PATH before ~/.local/bin." | |
| echo "Add a directory like ~/bin or ~/.local/bin2 to PATH before ~/.local/bin." | |
| exit 1 | |
| fi | |
| echo "Wrapper directory: $wrapper_dir" | |
| # --- Write the patcher --- | |
| mkdir -p "$(dirname "$PATCHER")" "$STAMP_DIR" | |
| cat > "$PATCHER" << 'PYEOF' | |
| #!/usr/bin/env python3 | |
| """Patch one Claude Code binary: replace art unicode escapes with zero-width spaces.""" | |
| import os, sys, tempfile | |
| ART_CODEPOINTS = [ | |
| '2580','2584','2588','258C','2590','2591','2592','2593', | |
| '2596','2597','2598','2599','259B','259C','259D','259F', | |
| '2026','273B', | |
| ] | |
| ZWSP = b'\\u200B' | |
| STAMP_DIR = os.path.expanduser("~/.local/share/claude/dehat-stamps") | |
| def main(): | |
| binary = sys.argv[1] | |
| stamp = os.path.join(STAMP_DIR, os.path.basename(binary) + '.dehatted') | |
| if os.path.exists(stamp): | |
| return | |
| with open(binary, 'rb') as f: | |
| data = bytearray(f.read()) | |
| orig_size = len(data) | |
| escapes = [] | |
| for cp in ART_CODEPOINTS: | |
| escapes.append(b'\\u' + cp.upper().encode()) | |
| escapes.append(b'\\u' + cp.lower().encode()) | |
| total = 0 | |
| for esc in escapes: | |
| offset = 0 | |
| while True: | |
| idx = data.find(esc, offset) | |
| if idx == -1: | |
| break | |
| data[idx:idx+6] = ZWSP | |
| total += 1 | |
| offset = idx + 6 | |
| assert len(data) == orig_size | |
| if total > 0: | |
| parent = os.path.dirname(os.path.dirname(binary)) | |
| version = os.path.basename(binary) | |
| backup = os.path.join(parent, version + '.bak') | |
| if not os.path.exists(backup): | |
| with open(binary, 'rb') as f: | |
| with open(backup, 'wb') as g: | |
| g.write(f.read()) | |
| os.chmod(backup, os.stat(binary).st_mode) | |
| fd, tmp = tempfile.mkstemp(prefix='claude-dehat-', dir=parent) | |
| os.close(fd) | |
| with open(tmp, 'wb') as f: | |
| f.write(data) | |
| os.chmod(tmp, os.stat(binary).st_mode) | |
| os.rename(tmp, binary) | |
| print(f"Patched {version}: {total} replacements") | |
| else: | |
| print(f"No art found in {os.path.basename(binary)}") | |
| os.makedirs(STAMP_DIR, exist_ok=True) | |
| open(stamp, 'w').close() | |
| if __name__ == '__main__': | |
| main() | |
| PYEOF | |
| chmod +x "$PATCHER" | |
| # --- Write the wrapper --- | |
| cat > "$wrapper_dir/claude" << 'EOF' | |
| #!/bin/bash | |
| target=$(readlink -f ~/.local/bin/claude) | |
| stamp=~/.local/share/claude/dehat-stamps/$(basename "$target").dehatted | |
| [ -f "$stamp" ] || python3 ~/.claude/erase_ascii_claude_code.py "$target" | |
| exec "$target" "$@" | |
| EOF | |
| chmod +x "$wrapper_dir/claude" | |
| # --- Patch all existing binaries now --- | |
| for bin in "$VERSIONS_DIR"/*; do | |
| [ -x "$bin" ] && python3 "$PATCHER" "$bin" | |
| done | |
| echo "Done. Wrapper installed at $wrapper_dir/claude." | |
| echo "Verify: which claude should show $wrapper_dir/claude" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install: