Skip to content

Instantly share code, notes, and snippets.

View belyak's full-sized avatar

Andrei Beliak belyak

  • Russian Federation, Saint-Petersburg
View GitHub Profile
@belyak
belyak / statusline-command.sh
Created October 23, 2026 17:16
Reference build of the Claude Code statusline spec (Haiku 5.5, first pass, every check verified independently). Install: *.sh and *.py into ~/.claude; statusline-repair.command.md -> ~/.claude/commands/statusline-repair.md; merge statusline-settings.snippet.json into settings.json; touch ~/.claude/statusline.version. MIT.
#!/usr/bin/env bash
# Main status line: one line, three groups separated by a bold ‖.
# context model/effort/window (session characteristics) + ctx%, tok in/out (live usage)
# cost session-cumulative spend; resets per session
# quota account-wide rate-limit usage (5h/7d); persists across sessions
# Within a group fields are separated by a dim "|"; the heavier "‖" marks a change of data level.
# Width budgets: each field is padded to a fixed width so a value changing size never shifts
# what follows it. Text past its budget is cut with "…"; numbers are never cut.
CYAN=$'\033[36m' YELLOW=$'\033[33m' GREEN=$'\033[32m' BLUE=$'\033[34m'
@belyak
belyak / claude-code-statusline-spec.md
Created October 23, 2026 17:16
Claude Code status line + per-subagent rows: an executable spec with acceptance tests (v4). Build it: claude -p "$(cat claude-code-statusline-spec.md)" --model haiku --permission-mode acceptEdits --allowedTools "Bash,Read,Write,Edit". MIT.

Instructions: recreate my Claude Code status lines

Do everything in this file, then report. There are two independent renderers to build, plus the settings wiring, plus a verification step. Do not skip verification.

If jq, awk, or python3 is missing from PATH, say so and stop — the scripts need them.

All files go under ~/.claude/. Create the directory if it does not exist.

Tasks 1–4 are the status lines. Task 5 is optional: a drift guard that notices when a

@belyak
belyak / mac-cleaner
Created February 6, 2026 23:27
mac-cleaner — Full-forensic macOS disk reclaimer. Zero-dependency Python 3 CLI with curses TUI. Scans APFS snapshots, Docker, VMs, Xcode, caches, AI/ML models, Brew, logs & more.
#!/usr/bin/env python3
"""mac-cleaner — Full-forensic macOS disk reclaimer."""
import argparse
import curses
import dataclasses
import enum
import glob
import os
import re
#!/usr/bin/env python3
import itertools
import math
import os
import unittest
from typing import List, Optional
import yaml
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOHPdA4eFaXbwl8A7HPNXZTeHQJ701yvtxKNcAOvR1ICJP0Fx7xXXHieXh58Nr35hI/fyFqKEFHIT3IAcQgvinJ55cBEGcLCr5OhWsQfiwlvYHaX818zhZnKWZVvG1mDz5JMmGWa8XKDMGJynwZJ0vacAukvcREGnU/yVdnVGFLbmRrjCGMhZVS5HFuVkBcBw9XYOtEtE1vRLCcr+Wa9SKKe0lmKln8mlxkZHbWQLfMmauc9NPEHe32SBccAHL3dfLTGN2Bf7igJgRc4qpi4dqIxwVPFPu39TJSBnpOxRvjK+xdtfWm0MBVdu+5gZvg24Bv/SsT3wZBAOSH0eYdKvv andy@andy-Inspiron-3721
@belyak
belyak / test_complex_function.py
Created January 6, 2018 01:25
Patching many functions for all test case methods
from unittest import TestCase
from unittest.mock import patch, call
from my_project.module import complex_function
class SomeTestCase(TestCase):
# in this test case every method will mock calls to func_1, func_2, func_3, func_4
def setUp(self):
super().setUp()
@belyak
belyak / reverseadmin.py
Created October 29, 2015 13:49 — forked from wolever/reverseadmin.py
Forked from https://gist.github.com/mzbyszewska/8b6afc312b024832aa85 , updated to work with Django 1.8
'''
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys
'''
'''
reverseadmin
============
Module that makes django admin handle OneToOneFields in a better way.
A common use case for one-to-one relationships is to "embed" a model
inside another one. For example, a Person may have multiple foreign