Skip to content

Instantly share code, notes, and snippets.

View tommythorn's full-sized avatar

Tommy Thorn tommythorn

View GitHub Profile
@tommythorn
tommythorn / gist:5ca01bf52d541101662f076e1b449f13
Created October 23, 2026 15:53
mlc on 256 GiB DDR4-3200 (ECC) in 8-sticks EPYC 7443P
Intel(R) Memory Latency Checker - v3.13
*** Unable to modify prefetchers (try executing 'modprobe msr')
*** So, enabling random access for latency measurements
Measuring idle latencies for random access (in ns)...
Numa node
Numa node 0
0 95.3
Measuring Peak Injection Memory Bandwidths for the system
Bandwidths are in MB/sec (1 MB/sec = 1,000,000 Bytes/sec)
@tommythorn
tommythorn / gist:129f5c93db491d5f4bff6d6202f429d4
Created September 3, 2026 07:03
claude-mtplx wrapper to streamline running Claude Code against mtplx
#!/usr/bin/env bash
# claude-mtplx — run the Claude Code CLI against a locally served MTPLX model.
#
# Starts the MTPLX server if it isn't already listening, then execs `claude`
# with the Anthropic-compatible endpoint pointed at it. Any arguments are
# passed straight through to claude, e.g.:
#
# claude-mtplx # interactive session
# claude-mtplx -p "explain this" # one-shot
# claude-mtplx --mtplx-stop # stop the server and exit
@tommythorn
tommythorn / gist:37535a29fcf5fa031b46d1a09edcc0a4
Created July 29, 2026 07:42
Simple bf16 compression pre-filter
/* filtbf16 - byte filter for bf16 tensor data; prefix to any compressor.
*
* filtbf16 < W | zstd -12 > W.filtbf16.zst
* zstd -d < W.filtbf16.zst | filtbf16 -d > W
*
* Rotates each little-endian bf16 word left by 1 so its 8-bit exponent becomes
* byte-aligned, then de-interleaves into an exponent plane and a mantissa|sign
* plane. The exponent plane holds ~2.7 bits of entropy and compresses; the
* mantissa plane is white noise and does not. Blocked, so memory is bounded
* and the pipe stays streaming. No header: the transform is its own inverse
@tommythorn
tommythorn / gist:070f689735231c46beaa24a6a55aaea6
Last active February 23, 2026 18:54
Bind Option-Space to U+202f (Narrow No-Break Space) to property typeset values and units, eg. 10 kg
# Highly opinionated: The correct typesetting of values with units according
# to most standards (incl. American Physics Society) requires separating the
# value and unit with a _thin_ unbreakable space. Executing the below will
# globally rebind Option-Space on macOS from Non-Break Space (U+00A0) to
# Thin Non-Breaking Space (U+202F)
# Tommy Thorn, 20260223
mkdir -p ~/Library/KeyBindings
cat > ~/Library/KeyBindings/DefaultKeyBinding.dict <<EOF
/* Option-Space to Thin Non-Breaking Space (U+202F) */
#from storage import getmount
from kmk.keys import KC
from kmk.kmk_keyboard import KMKKeyboard
from kmk.modules.split import Split, SplitType, SplitSide
from kmk.scanners import DiodeOrientation
from kmk.hid import HIDModes
from kmk.modules.holdtap import HoldTap
import board
keyboard = KMKKeyboard()
| "OS Build Version" = "21G217"
+-o J313AP <class IOPlatformExpertDevice, id 0x100000216, registered, matched, active, busy 0 (84188 ms), retain 32>
| | | | "perf-states" = <0000000090010000007b9a175402000000a4781f7a0200000054ea2aac020000001f13370703000000ea3b436103000080bb2c4ca9030000>
| | | | "gfx-shared-region-base" = <0080f7ff0b000000>
| | | | "gpu-num-perf-states" = <06000000>
| | | | "AGXParameterBufferMaxSizeEverMemless" = 574881792
| | | | "AGXParameterBufferMaxSizeNeverMemless" = 287440896
| | | | "gpu-core-count" = 8
| | | | "AGXParameterBufferMaxSize" = 862322688
| | | | "GPUConfigurationVariable" = {"gpu_gen"=13,"num_gps"=4,"num_cores"=8,"core_mask_list"=(255),"num_frags"=8,"num_mgpus"=1}
@tommythorn
tommythorn / pingpong.rs
Created May 10, 2022 06:02
Failed attempt at Using Stakker
use stakker::*;
use std::time::{Duration, Instant};
struct Foo {
bar: Actor<Bar>,
}
impl Foo {
pub fn init(cx: CX![], bar: Actor<Bar>) -> Option<Self> {
call!([cx], run());
@tommythorn
tommythorn / evil.c
Created April 4, 2020 22:30
RVC Decoder aka. GCC destroyer
// RVC decoder, Copyright (C) 2020 Tommy Thorn
/* This file is based on RVC.scala, licensed under Apache License Version 2.0 */
// *** WARNING ***
// This is work-in-progress
// Released just to show how it totally destroys GCC (~ 2 lines/s and
// 6 GiB working set)
#include <stdint.h>
#include <stdio.h>
@tommythorn
tommythorn / README.txt
Created January 14, 2020 20:24 — forked from dabeaz/README.txt
PyCon India 2019, Code from Keynote Presentation by @dabeaz
Code from PyCon India 2019 Keynote Talk
David Beazley (https://www.dabeaz.com)
======================================
This code is presented "as is" and represents what was live-coded
during my closing keynote presentation at PyCon India, Chennai,
October 13, 2009. I have made no changes to the files.
Requires: Python 3.6+, numpy, pygame
@tommythorn
tommythorn / bakergc.html
Created February 11, 2018 00:14
Baker Real-Time GC
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title>
<style>
body {
font-family: arial;
margin: 0;