Skip to content

Instantly share code, notes, and snippets.

View cb341's full-sized avatar
🌈

Dani Bengl cb341

🌈
View GitHub Profile
@cb341
cb341 / ip_frame.sh
Created April 12, 2026 09:50
IP Frame Schema Reference
#!/bin/bash
# IPv4 Header Frame Schema - ANSI box drawing
# Grid: 32 bits per row, each bit = 3 chars wide (2 content + 1 separator)
# Total inner width = 32*3 - 1 = 95 chars
R='\033[0m'
B='\033[1;34m'
W='\033[1;37m'
G='\033[1;32m'
Y='\033[1;33m'
@cb341
cb341 / README.md
Last active April 7, 2026 17:05
Minecraft sound effects as Claude Code hooks - every hook event plays a thematic Minecraft .ogg sound with random variation picking. Sounds sourced from Minecraft wiki. Requires macOS (afplay) and .ogg files in ~/Documents/minecraft-claude-code-sounds/ organized by hook name.

Minecraft Sound Effects for Claude Code Hooks

Every Claude Code hook event plays a thematic Minecraft sound. Random variation each time.

Sound Mapping

Hook Minecraft Sound Vibe
SessionStart Chest open Opening a session
SessionEnd Chest close Packing up
@cb341
cb341 / summarize.py
Created March 28, 2026 14:44
map-reduce-conversations
#!/usr/bin/env python3
"""
Map-reduce summarization of conversation chunks using Claude Sonnet.
Usage:
python summarize.py # run full pipeline
python summarize.py --map-only # run map phase only
python summarize.py --reduce-only # run reduce phase only (expects summaries/ to exist)
"""
@cb341
cb341 / describe_json.rb
Created March 14, 2026 16:50
A simple script to analyse JSON schema
#!/usr/bin/env ruby
# describe_json - Parses JSON files and displays a detailed, human-readable
# breakdown of the schema including data types, field names, array sizes,
# and sample values. Supports file arguments or stdin input.
# author: claude-haiku
require 'json'
def show_help
puts <<~HELP
@cb341
cb341 / clean
Created February 28, 2026 17:50
Clean Ruby on Rails cluttered disk
#!/bin/bash
if [[ ! -n "$ANGRY" ]]
then
echo "ANGRY flag not set, skipping.."
exit 1
fi
echo "CLEANING"
@cb341
cb341 / generics.java
Created January 2, 2026 11:57
Problems and Solutions with Java Generics (?)
// 1. RUNTIME ERRORS (RAW TYPES)
// PROBLEM
List list = new ArrayList();
list.add(99);
String s = (String) list.get(0); // ClassCastException at runtime!
// SOLUTION
List<Integer> list = new ArrayList<>();
list.add(99);
// list.add("a"); // Compiler Error: Prevents the crash immediately
@cb341
cb341 / template.rb
Last active October 14, 2025 19:47
SUPER COOL RAILS TEMPLATE
# frozen_string_literal: true
# -----------------------------------------------------------------------------
# Renuo Rails Application Template
# -----------------------------------------------------------------------------
# Purpose:
# Automates the setup of a new Rails project according to Renuo AG conventions.
#
# Features:
# * Enforces Ruby version consistency with `.ruby-version`
@cb341
cb341 / fastcheck.sh
Created August 8, 2025 18:16
A simple script that runs rails linters on files in feature branch. Handy for pre-commit
#!/bin/bash
MAIN_BRANCH="master"
RUBOCOP_CMD="docker compose exec -T app bundle exec rubocop -a"
ERB_LINT_CMD="docker compose exec -T app bundle exec erb_lint -a"
ESLINT_CMD="docker compose exec -T app eslint --fix"
CHANGED_FILES=$(git diff --name-only $MAIN_BRANCH)
process_file() {
@cb341
cb341 / simplecov_parser.rb
Created July 9, 2025 09:15
Vibecoded Tool for processing SimpleCov coverage reports
#!/usr/bin/env ruby
# SimpleCov Coverage Parser
# =========================
#
# Command-line tool to parse SimpleCov HTML coverage reports into text format.
#
# Features:
# - Parse SimpleCov HTML files into structured text output
# - Display overall coverage statistics with file counts and percentages
#!/bin/bash
# Check if a directory to flatten is provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <directory_to_flatten> <target_directory>"
exit 1
fi
SOURCE_DIR="$1"
TARGET_DIR="$2"