Skip to content

Instantly share code, notes, and snippets.

@kommander
kommander / bun-stdin-close-repro.js
Created April 27, 2026 16:33
Bun spurious stdin close repro
#!/usr/bin/env bun
import { join } from "node:path"
import { pathToFileURL } from "node:url"
const RESOURCE_PATH = join(import.meta.dir, ".bun-stdin-close-tiny-repro.txt")
const RESOURCE_URL = pathToFileURL(RESOURCE_PATH).href
const PALETTE_QUERY = Array.from({ length: 256 }, (_, index) => `\x1b]4;${index};?\x07`).join("")
const RESET_SEQUENCE = "\x1b[?2026l\x1b[?1003l\x1b[?1002l\x1b[?1000l\x1b[?1006l\x1b[?2004l\x1b[?1049l\x1b[?2031l\x1b[?25h\x1b[0m"
@kommander
kommander / colors.sh
Created November 24, 2025 20:27
output terminal palette colors as hex
#!/usr/bin/env bash
# Put terminal into raw mode to capture OSC responses
stty -icanon -echo min 0 time 1
# Create temp file
tmp=$(mktemp)
# Send OSC 4 queries for all 256 colors
for i in {0..255}; do
@kommander
kommander / multilevel_prefetch.patch
Created October 1, 2011 23:11
A patch to add multi level prefetch to persistencejs, a javascript ORM.
From b6b903a3f6f9c1d5113bf98baab12bbfa009dadf Mon Sep 17 00:00:00 2001
From: Sebastian Herrlinger <sebastian@formzoo.com>
Date: Fri, 16 Sep 2011 13:36:58 -0700
Subject: [PATCH 1/3] Hack: Multi Level Prefetch
---
lib/persistence.store.sql.js | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
mode change 100644 => 100755 lib/persistence.store.sql.js