Skip to content

Instantly share code, notes, and snippets.

## Explaining My Work (writeups, status updates, summaries of what I did)
When I write to the user ABOUT work on a codebase — what I changed, what I found, what a test proves, why something failed — the reader was NOT in the work with me and does not share the vocabulary I built up doing it. This is a hard default:
- **Meaning before name.** Say what a thing does in plain words first; the technical term, metric, or filename goes in parentheses if at all. "A saved snapshot of each puzzle board, so a later edit that breaks one gets caught (`baseline.json`)" — NOT "21 goldens in baseline.json".
- **Plainify.** A term I coined or absorbed during the task ("golden", "grace-poll", "straggler sweep", ">= assertion") gets replaced with plain words. No undefined insider terms.
- **A number is evidence, not the point.** Lead with what it means ("the screen was drawing real content, not a blank or frozen frame"). Never a bare "0.207 → 0.06" with no labels.
- **Say why it matters to the user.** Tie each item to somethi
# Data Model
Defines every data structure in the project. A rebuild AI reads this to recreate the exact project file format and in-memory model.
## Project File Format
Serialized as **MessagePack** (via `rmp-serde`). The schema below is defined in Rust-struct notation but represents the canonical format.
---
@bitbutter
bitbutter / generate_tileset_collision_polygons.gd
Last active February 13, 2026 19:23
Auto-generates collision polygons from tile pixel alpha. 1. Add to your project. 2. Tune the params at the top of the script. 3. Right click the script in FileSystem tab, choose "Run".
@tool
extends EditorScript
## Auto-generate collision polygons from tile pixel alpha.
## Run from Script Editor: File > Run (Ctrl+Shift+X)
## Path to the TileSet resource to process.
const TILESET_PATH := "res://game_specific/resources/tilesets/greentileset.tres"
## Physics layer index to assign collision polygons to.
@bitbutter
bitbutter / SignalGroup.gd
Last active November 17, 2025 09:06
SignalGroup. Wait for all of, or any of, an array of signals.
'''
Based on https://shaggydev.com/2025/06/12/godot-awaiting-signals/
# usage
var sigs=[
get_tree().create_timer(0.1).timeout,
get_tree().create_timer(0.1).timeout,
get_tree().create_timer(0.1).timeout,
]
@bitbutter
bitbutter / SignalWaiter.gd
Created July 8, 2024 08:25
A godot 4 class. Waits for multiple signals to be received before continuing
class_name SignalWaiter
signal AllFinished
# Internal variables
var _active_nodes = {}
var _signal_connections = {}
var _callables = []
## External method to add a node, its callable, and the signal to listen for.
@bitbutter
bitbutter / create_embeddings.py
Created July 30, 2023 16:53
create embeddings from tweets, then semantic search them
import json
import spacy
import zipfile
import os
import pickle
# File paths
zip_path = r"pathtotwitterarchive.zip" # Path to zipped twitter archive
extract_path = r"somepath\twitter_data" # Path to extract twitter data
embeddings_path = r"somepath\tweet_embeddings.pkl" # Path to save embeddings
@bitbutter
bitbutter / knowledge_extractor.py
Created April 24, 2023 14:46
A python console program that uses Chroma and OpenAI to query text files
import chromadb
import openai
import os
from tqdm import tqdm
import tiktoken
from chromadb.errors import NotEnoughElementsException
import re
from colorama import Fore, Style
# Instructions (assumes Windows OS)
@bitbutter
bitbutter / kindle_tana_paste_from_book_name.py
Last active March 7, 2023 09:13
Python script to be called by Espanso trigger, for importing kindle hightlights to Tana. Put this in C:\Users\[username]\AppData\Roaming\espanso\scripts
import json
import sys
sys.stdout.reconfigure(encoding='utf-8')
import io
import os
import traceback
from datetime import datetime
import re
booktitle = os.environ['ESPANSO_BOOKTITLE']
clippings_file = "E:/documents/My Clippings.txt"
@bitbutter
bitbutter / kindle_get_book_titles_from_clippings.py
Last active March 7, 2023 09:13
Python script to be called by Espanso trigger, for importing kindle hightlights to Tana. Put this in C:\Users\[username]\AppData\Roaming\espanso\scripts
import sys
sys.stdout.reconfigure(encoding='utf-8')
from datetime import datetime
# Open the clippings file and read its contents
with open("E:/documents/My Clippings.txt", "r", encoding="utf-8") as f:
contents = f.read()
# Split the contents into separate notes
notes = contents.split("==========\n")
@bitbutter
bitbutter / base.yml
Last active March 7, 2023 09:13
Espanso trigger for importing kindle highlights from connected device to Tana. Append this trigger to the file at [username]/AppData/Roaming/espanso/match
# append this to [username]/AppData/Roaming/espanso/match
- trigger: kindle_import_book_from_clippings
replace: "{{output}}"
vars:
- name: booktitles
type: script
params:
args:
- python