Skip to content

Instantly share code, notes, and snippets.

@rightson
rightson / statusline.sh
Created March 30, 2026 23:33
~/.claude/statusline.sh
#!/bin/bash
# Claude Code Status Line — single jq call, no loops
# Format: 🌿 <branch> | 📁 <folder> | <Model> [████░░░░] ~XX% | 📈 5h XX% | 🏷 vX.X.X
# Single jq: parse all fields + build colored bar, tab-separated
IFS=$'\t' read -r MODEL CWD PCT RATE_5H VERSION BAR RL_COLOR < <(
jq -rj '
def bar:
(.context_window.used_percentage // 0 | floor) as $pct |
($pct * 20 / 100 | if . > 20 then 20 elif . < 0 then 0 else . end | floor) as $filled |
@rightson
rightson / CLAUDE.md
Created March 23, 2026 15:05
Example top-level ~/.claude/CLAUDE.md

Spec-Driven Development

  • Spec First: All new features must have a corresponding spec file in specs/.
  • Pre-Implementation Check: Before starting implementation, read the relevant spec and confirm status: active.
  • Spec Format: Include frontmatter with status (draft | active | done) and the created date.
  • Lifecycle Management: Update the spec status to done once the feature is completed.
  • No Spec, No Work: If a spec is missing, do not start work; ask me if a spec should be created first.
@rightson
rightson / claude.vba
Last active April 14, 2025 05:25
VBA test
Option Explicit
' Global variable to track if an update is being processed
Private IsProcessingUpdate As Boolean
' ===== Worksheet Events =====
' Triggered when worksheet changes
Private Sub Worksheet_Change(ByVal Target As Range)
' Avoid recursive triggers
@rightson
rightson / coolpc_tui.py
Last active December 22, 2024 12:37
Better coolpc (original site's UX is horrible)
import requests
import os
import argparse
import json
import re
from datetime import datetime
from bs4 import BeautifulSoup
def fetch_or_load_html(url, cache_file='coolpc_cache.html', force_refresh=False):
"""
@rightson
rightson / mongo-copy.js
Created October 1, 2024 01:09
MongoDB Database Copy Script (alternative to mongodump/mongorestore)
// MongoDB Refactored Copy Script with Modular Functions and Index Copying
// This script copies all collections and their indexes from a source database to a target database without using mongodump.
// === Configuration ===
// Source MongoDB connection details
const sourceConfig = {
host: "source_host", // e.g., "localhost"
port: 27017, // e.g., 27017
username: "sourceUser", // Source DB username
@rightson
rightson / basesf_utility.py
Last active March 7, 2024 03:24
Base 64 Converter
import argparse
import base64
import zipfile
import os
def convert_exe_to_base64_and_zip(input_file, output_path):
"""Converts an EXE file to Base64, zips the encoded content, and renames the archive to .b64.zip."""
with open(input_file, 'rb') as file:
binary_data = file.read()
base64_encoded_data = base64.b64encode(binary_data).decode('utf-8')
@rightson
rightson / scan-ipv4.sh
Last active February 17, 2024 08:45
Scanning IPv4 addresses in use
if [ "$#" -eq 0 ]; then
targets="70 71 79 91 92 93 94"
else
targets=$*
fi
echo -e "Targets to scan:\n $targets"
in_use=()
for suffix in $targets; do
@rightson
rightson / example-query.js
Last active January 9, 2024 12:49
example query
db.collection.aggregate([
{
$addFields: {
nonEmptyValues: {
$filter: {
input: { $objectToArray: "$Status" },
as: "status",
cond: { $ne: ["$$status.v.value", ""] }
}
}
@rightson
rightson / docker-load.py
Last active June 17, 2023 05:57
docker pull/load from CLI
import tarfile
import subprocess
import json
import sys
image = sys.argv[1]
# Create a dictionary for the image manifest
manifest_dict = {
# Minimize current window
xdotool windowminimize $(xdotool getactivewindow)
# Make current window always on top
wmctrl -r :ACTIVE: -b toggle,above
# Undo aways-on-top window
wmctrl -r :ACTIVE: -b remove,above