Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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.
# 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.
---
## 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