Skip to content

Instantly share code, notes, and snippets.

View gatopeich's full-sized avatar
🧟‍♂️
hacking since 1987

gatopeich

🧟‍♂️
hacking since 1987
View GitHub Profile
@gatopeich
gatopeich / PYTHON_STYLE_GUIDE.md
Created June 9, 2026 10:49
Python Style Guide and Development Conventions

Code Style Guide and Development Conventions

General Style Philosophy

  • NEVER ADD COMPLEXITY until you are 100% sure it is required. No "just in case" wrappers, separators, fallbacks, extra regex passes, defensive checks, helper functions, or speculative state. Run the actual code, observe the exact failure, then fix the specific cause. Adding constructs that "might help" hides the real problem and creates compounding feedback loops where downstream code compensates for upstream additions.
  • Less is more: prefer concise code, only add complexity when strictly necessary.
  • Encapsulate related data and behavior into classes, hiding internal details.
  • Abstract common patterns into reusable functions and classes.
  • Write self-documenting code: meaningful names, minimal comments.
  • Eliminate redundant code through refactoring and reuse.
@gatopeich
gatopeich / tmux-tabs
Last active June 10, 2026 17:32
Like Claude Squad, without fuss: A vertical TMUX sidebar to track all your Agent sessions at a glance
#!/usr/bin/env python3.12
"""
tmux-tabsvertical window sidebar for tmux.
Shows all tmux windows in a narrow left pane with bell highlights and terminal
titles. Click any window to switch to it. Automatically follows focus when a
new window is opened (e.g. via F2 in byobu).
Usage:
Run `tmux-tabs` in any tmux paneit splits off a 25%-wide left sidebar and
@gatopeich
gatopeich / 01_cpu_mem_bars
Last active May 13, 2026 08:24
TMUX/Byobu status bar: CPU+MEM usage bars in only 4 chars
#!/usr/bin/env python3
# Byobu custom status script: CPU + MEM as colored UTF-8 block chars.
# Install: place in ~/.byobu/bin/01_cpu_mem_bars and chmod +x
# Enable: add 'custom' to tmux_right in ~/.byobu/status
#
# Integration — vanilla tmux (~/.tmux.conf):
# set -g status-right '#(~/.byobu/bin/01_cpu_mem_bars)%H:%M:%S'
#
# Integration — byobu (~/.byobu/profile.tmux):
# source $BYOBU_PREFIX/share/byobu/profiles/tmux
@gatopeich
gatopeich / claude-chooser.sh
Last active April 3, 2026 23:54
Claude Code Chooser - TUI project picker and launcher for Claude Code
#!/bin/sh
# Claude Code Chooser - TUI project picker and launcher for Claude Code
# Lists recent projects, browse directories, toggle dangerous mode, set extra args,
# then exec's claude in the chosen directory.
#
# https://gist.github.com/gatopeich/2b4e805f44791fc817bc043eb82ecaac
# Author: gatopeich @ github
#
# Recommended: latest kitty + tmux. Uses exec + tmux remain-on-exit so the
# shell process is replaced by claude and the pane stays open after exit
@gatopeich
gatopeich / xseticon.py
Last active March 15, 2026 09:08
xseticon.py - Set X11 window icon using ctypes and PIL (no extra deps)
#!/usr/bin/env python3
"""Set X11 window icon from a PNG file using ctypes (no dependencies beyond PIL).
https://gist.github.com/gatopeich/9d0c61cae0a4e01b23b0afc543c27fbb
Author: gatopeich @ github
"""
import ctypes
import ctypes.util
import sys
from PIL import Image
@gatopeich
gatopeich / statusline-command.sh
Created January 30, 2026 09:45
Claude Code status line script - shows CWD, model, context %, cost, API time, and tmux pane title
#!/bin/bash
# Claude Code Status Line Script
# Shows: CWD (cyan), Model ID (orange), Context Usage (blue), Money Spent (yellow), API Response Time (green)
# Enable debugging by setting DEBUG_STATUSLINE=1
DEBUG=${DEBUG_STATUSLINE:-0}
# Color codes
CYAN='\033[36m'
@gatopeich
gatopeich / 50-gamepad.conf
Created February 5, 2023 16:33
Sample gamepad configuration Xorg with hints to use as Mouse+Keyboard for Minecraft
# Gamepad configuration for general use, and emulating mouse+keys for Minecraft
Section "InputClass"
Identifier "Gamepads"
Driver "joystick"
MatchIsJoystick "on"
#MatchDevicePath "/dev/input/js*"
#MatchProduct "GAME"
# Map arrow pad (axis 5 & 6) to cursor keys left right up down
Option "MapAxis5" "keylow=113 keyhigh=114"
@gatopeich
gatopeich / Mapping keys and mouse to gamepad
Created February 5, 2023 10:26
Mapping keys and mouse to gamepad with Linux UDEV system
This is something I never had the time to put together.
Today I asked openai.org and it provided a nice walk-through...
QUESTION> How can I map gamepad buttons to keys and mouse with UDEV?
To map gamepad buttons to keyboard and mouse inputs with UDEV, you will need to create a udev rule file to specify the mapping. Here are the steps:
Identify the gamepad device name: Run ls /dev/input/by-id to see a list of all input devices connected to your system. Look for the one that corresponds to your gamepad and note its name, e.g. /dev/input/by-id/usb-<VENDOR_ID>-<PRODUCT_ID>.
Create a udev rule file: Create a new file in /etc/udev/rules.d/ with a descriptive name, e.g. 99-gamepad-mapping.rules.
@gatopeich
gatopeich / merge_bash_history.sh
Last active February 2, 2023 09:25
Merge and keep bash history from different folders and processes
#!/bin/bash
# BASH history merger by Agustín F. Pozuelo (c) 2023
# Merge history files from multiple sessions, removing duplicate commands
# TODO: Maintain order of commands in the most recent appearances
# BASH history merger.
# I use this to maintain history of my many BASH sessions
# Each session writes history to a separate file
# Running this from inside .bashrc, the 10 most recent sessions are merged together
@gatopeich
gatopeich / Wii from SD card in 2020.md
Created July 12, 2020 12:34
Run Wii games from SD card in quick, safe and easy steps (2020 mini guide)

After spending days following some obsolete or incomplete or just too long and specific guides, here is my take on setting up a Wii in the year 2020

  1. Format SD card with 1 partition of 32kb clusters: sudo mkdosfs /dev/sdXX -s 128 -F 32. Up to 32GB SD-HC should work fine, despite what was said in old forums
  2. Install BootMii + HBC with LetterBomb: https://wiibrew.org/wiki/LetterBomb
  3. BACKUP your NAND with BootMii to be safe from bricking: https://sites.google.com/site/completesg/how-to-use/bootmii This is mostly for peace of mind though
  4. Install cIOS 249 base 56 v10 beta52 on slot 249 and base 57 on slot 250. This is the most complex step, be careful to follow the instructions here: https://sites.google.com/site/completesg/backup-launchers/installation