Skip to content

Instantly share code, notes, and snippets.

@qpwo
qpwo / pr691-gist-placeholder.txt
Created August 24, 2026 19:33
pr691-real-headful-chromeshots
x
@qpwo
qpwo / PERFECTREACT.tsx
Created August 22, 2026 21:17
PERFECT REACT
/** Search and Lookup pages. */
import React from 'react';
import type { Case } from './db';
import type { ApiResponse } from './api';
import { store } from './store.ts';
function onSearchChange(e: React.ChangeEvent<HTMLInputElement>) {
store.set('search_query', e.target.value);
}
@qpwo
qpwo / how-to-split-ts-tsx-mjs.c
Created August 20, 2026 13:24
how-to-split-ts-tsx-mjs.c
//bin/sh -c 'sum=$(cksum < "$0" | tr " " -); o=${TMPDIR:-/tmp}/how-to-split-ts-tsx-mjs-$sum; [ -x "$o" ] || ${CC:-cc} -O3 -Wall -Wextra $(pkg-config --cflags libgit2) "$0" -o "$o" $(pkg-config --libs libgit2) || exit; exec "$o" "$@"' "$0" "$@"; exit
#include <git2.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@qpwo
qpwo / fill_in_the_gaps.py
Created August 12, 2026 06:07
not a bad mask filler
import pathlib as _pl; print(_pl.Path(__file__).read_text()); print("END_OF_SOURCE")
import sys, pathlib, time, math, pickle
import numpy as np
import jax
import jax.numpy as jnp
import optax
VOCAB = 256
CTX = 1024
BATCH = 96
//bin/sh -c 'o=${0%.c}; [ "$o" -nt "$0" ] || ${CC:-clang} -O3 -march=native -o "$o" "$0"; exec "$o" "$@"' "$0" "$@"; exit
// source: http://smalldatum.blogspot.com/2016/01/summary-of-advantages-of-lsm-vs-b-tree.html
#define _GNU_SOURCE
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
@qpwo
qpwo / safe.asm
Last active July 28, 2026 11:03
safe assembly thingy
; WOWNEAT/3. Intel AMD64 plus bnd. No language runtime operations.
; Full-width pointer moves preserve hidden authority. Integer writes clear it.
; Every imported entry is verifier-described in section .wowneat.abi.
; Linux x86-64 SysV register order is used for direct calls.
; Verifier must track allocation identity per bnd-tagged pointer through all
; full-width moves and memory loads. When rt.free is called on a pointer, the
; verifier marks that allocation as freed. Any subsequent load or store through
; any pointer whose provenance traces to a freed allocation is a compile-time
; error. This closes use-after-free: stale bnd bounds cannot match a live
; allocation because the verifier rejects the dereference before code emission.
@qpwo
qpwo / john.txt
Created July 25, 2026 12:46
john.txt -- be like john
John speaks in executable units. If a line is not meant for the machine, John marks it so completely that no parser could mistake it for work. He never lets explanation and action bleed together, and he keeps every turn small enough that the next fact can still change his mind.
John verifies the exact thing he is touching before he touches it. He names the real file, the real symbol, the real build path, the real binary, and the real output artifact. John distrusts memory, guesses, and near-matches; he checks the concrete object in front of him.
John knows that one clean observation is worth ten clever theories. He separates what was seen from what was inferred, and he does not promote a suspicion into a conclusion until the artifact, disassembly, log, or output actually says so in plain sight.
John changes one hinge at a time. He inspects on one turn, edits on the next, and judges after that. He does not bunch six uncertainties into one heroic move, because John knows that stacked ambiguity turns every resul
@qpwo
qpwo / gpt-5-5-thought-leak.txt
Created June 7, 2026 21:38
gpt 5.5 thought leak
heredoc. Hmm.
Need no markdown. Need no unicode. Need strong direct but not necessary. Could include "# appending bounded lines; no solver code, no cheating path." and commands.
Need maybe use cat >> file simpler but developer likes heredit. Let's use:
heredit << 'HD'
APPEND better-super-model.txt <<'EOF'
76. internal deliberation tasks
@qpwo
qpwo / example_spec.txt
Created December 11, 2025 13:45
example_spec.txt
spec_app_patterns: implement four preact rendering patterns: client-only, csr-in-ssr, ssr-in-csr, and ssr-only.
spec_app_language: use typescript with jsx for all components and server logic.
spec_structure_flat: all source code files must live in the project root directory, not in subdirectories like 'src'.
spec_tooling_runner: a single `./run` bash script must be the entry point for all build and development tasks, replacing npm scripts.
spec_tooling_bundler: use esbuild to bundle both the client-side (to `public/client.js`) and server-side (to `server.js`) code.
spec_tooling_typechecker: use the typescript compiler (`tsc`) for static type checking, invoked via `./run tsc`.
spec_verification_self_test: the express server must perform a self-test on startup by fetching all its own routes.
spec_verification_fail_fast: if any self-test fetch fails, the server process must immediately exit with a non-zero status code.
spec_verification_complete: the task is done when `./run tsc` passes and `./run serve` starts
@qpwo
qpwo / _myatari.py
Last active September 29, 2025 06:25
atari realtime rl runner
#!/usr/bin/env python3
import torch, gymnasium as gym, numpy as np, time, sys, threading, os, random
import torch.multiprocessing as mp
from torch import Tensor
from bg_record import log_step, bind_logger, log_close
# torch.set_num_threads(1)
NUM_PROCS = 16