Skip to content

Instantly share code, notes, and snippets.

View JGalego's full-sized avatar
🧠
𝙶̶𝙿̶𝚄̶𝚜̶ brains go brrr

João Galego JGalego

🧠
𝙶̶𝙿̶𝚄̶𝚜̶ brains go brrr
View GitHub Profile
@JGalego
JGalego / thermostat-loop.gif
Created October 21, 2026 11:41
Thermostat loop: a toy room, a lagging radiator and a bang-bang thermostat, rendered as a GIF (uv run thermostat_loop.py)
thermostat-loop.gif
@JGalego
JGalego / gratuitous_cardinality.sh
Last active October 20, 2026 12:12
Spot gratuitous cardinality instances!
#!/usr/bin/env bash
# Detect gratuitous cardinality in this project.
#
# 1. Run this script from the repository root to find candidate passages:
# bash tools/gratuitous-cardinality.sh .
# 2. Inspect each match in its surrounding context.
# 3. Classify each as:
# - GRATUITOUS: the number adds no meaningful information.
# - JUSTIFIED: the number conveys substantive information or
# serves a genuine rhetorical, logical, or organizational purpose.
@JGalego
JGalego / cylindrical_rule30.wif
Created October 8, 2026 23:33
🧵 Weaving rule 30 from A New Kind of Science
[WIF]
Version=1.1
[CONTENTS]
WEAVING=true
TEXT=true
THREADING=true
LIFTPLAN=true
[WEAVING]
@JGalego
JGalego / voyage_nano_demo_t.py
Last active October 7, 2026 09:00
Voyage Nano demo adapted from https://huggingface.co/voyageai/voyage-4-nano (transformers)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "transformers",
# "torch",
# "flash-attn"
# ]
# ///
import torch
@JGalego
JGalego / pr13.py
Last active October 7, 2026 10:06
Voyage Nano demo adapted from https://huggingface.co/voyageai/voyage-4-nano (sentence transformers)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "sentence_transformers",
# "torch",
# "transformers>=5",
# ]
# ///
from sentence_transformers import SentenceTransformer
@JGalego
JGalego / go_pro_review.md
Created September 28, 2026 20:03
Review golang codebases like a boss 😎🦫

You are a principal Go engineer performing an exhaustive quality audit of a production-grade Go codebase.

Your goal is to make this project "beyond reproach": idiomatic, correct, maintainable, secure, observable, performant where necessary, and resistant to subtle bugs. Be demanding. Do not merely identify obvious lint issues; look for problems that an expert Go maintainer would catch during a deep review.

Core principles

Evaluate the project against these principles:

  • Prefer simple, idiomatic Go over clever abstractions.
  • Make behavior, ownership, lifetimes, and failure modes explicit.
@JGalego
JGalego / microjev.py
Last active October 4, 2026 08:13
Jev in X LoC
# /// script
# dependencies = ["huggingface-hub", "llama-cpp-python"]
# ///
import math
from llama_cpp import Llama
m = Llama.from_pretrained("Qwen/Qwen3-0.6B-GGUF", "Qwen3-0.6B-Q8_0.gguf", logits_all=True, verbose=False)
choices = {"A": "Legitimate", "B": "Spam", "C": "Phishing"}
opts = "\n".join(f"{k}. {v}" for k, v in choices.items())
email = "Payroll asks for your password on a non-company sign-in page."
@JGalego
JGalego / rljf_grpo.py
Last active October 14, 2026 10:17
RLJF = RLHF - Humans + Jev 🎰 GRPO fine-tuning with TypeSafe's Jev as the reward model
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "trl>=1.13", "peft>=0.21", "transformers>=5.0", "datasets>=4.0",
# "accelerate>=1.0", "torch>=2.4", "typesafe-sdk>=0.7", "python-dotenv>=1.0",
# ]
# ///
"""RLJF: GRPO fine-tuning with TypeSafe's Jev as the reward model.
@JGalego
JGalego / yt2mp4.py
Created September 19, 2026 15:08
🎥⬇️ Download any YouTube video as a local .mp4 with one uv run command - no setup, no pip install
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "yt-dlp",
# ]
# ///
"""Download a YouTube video as a local .mp4 file.
Usage:
@JGalego
JGalego / anti_slop.md
Created September 17, 2026 14:38
Anti-Slop™ 💩 The Claudish & AI-isms Exterminator

Rewrite the text below to remove recognizable AI-generated writing patterns, including patterns commonly associated with ChatGPT, Claude, Microsoft Copilot, Gemini, and other LLM assistants.

Preserve the original meaning, facts, argument, intent, level of certainty, and personality. Do not make the text artificially casual, edgy, simplistic, or sloppy. The goal is not to make it "sound less intelligent." The goal is to make it sound like a real person wrote it directly.

Do not merely substitute synonyms. Rewrite the underlying sentence structures and rhetorical habits when necessary.


1. Remove stock AI rhetorical formulas