Skip to content

Instantly share code, notes, and snippets.

View statico's full-sized avatar

Ian Langworth ☠ statico

View GitHub Profile
@statico
statico / gpu.cpp
Last active August 11, 2026 02:40
Trick to tell AMD and Nvidia drivers to use the most powerful GPU instead of a lower-performance (such as integrated) GPU
#ifdef _WIN32
// Use discrete GPU by default.
extern "C" {
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
// http://developer.amd.com/community/blog/2015/10/02/amd-enduro-system-for-developers/
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
@statico
statico / useModals.tsx
Created December 19, 2021 18:26
Chakra UI await-able alert, confirm, and prompt modal dialogs
/*
* Usage:
* const { alert, confirm, prompt } = useModals()
* alert("Hey!") // awaitable too
* if (await confirm("Are you sure?")) ...
* const result = await prompt("Enter a URL", "http://")
*/
import React, {
createContext,
@statico
statico / levoit-lv-pur131-esphome.md
Created August 3, 2026 00:14
Levoit LV-PUR131 air purifier → ESPHome: reverse-engineered fan PWM, wiring, and config

Levoit LV-PUR131 → ESPHome

Replace the control electronics in a Levoit LV-PUR131 air purifier with an ESP32 that runs ESPHome. The result is a local Home Assistant fan entity. No cloud account, no vendor app, and no WiFi module in the original product.

This document holds measured numbers, a wiring diagram, the reason for every component, and the ESPHome configuration.

@statico
statico / generate-post-image.sh
Created July 2, 2026 20:04
spacemolt image generator
#!/usr/bin/env bash
# Generate a SpaceMolt-style image with Gemini nano-banana-pro.
#
# Usage:
# GEMINI_API_KEY=... ./generate-post-image.sh "a lobster captain inspecting a cargo manifest"
# GEMINI_API_KEY=... ./generate-post-image.sh -o out.jpg "prompt..."
#
# Style is loaded from patreon-post-style.json next to this script.
set -euo pipefail
@statico
statico / Playwright MCP inside a Nono Sandbox.md
Created April 15, 2026 23:33
Playwright MCP inside a Nono Sandbox

Playwright MCP inside a Nono Sandbox

  1. Add --open-port 8931 to the nono args
  2. npx @playwright/mcp@latest --headless --isolated --browser chrome --port 8931
  3. claude mcp add --scope user --transport http playwright http://localhost:8931/mcp
@statico
statico / Playwright MCP + Claude Code + nono.sh Sandbox (macOS).md
Created April 9, 2026 05:25
Playwright MCP + Claude Code + nono.sh Sandbox (macOS)

Playwright MCP + Claude Code + nono.sh Sandbox (macOS)

Problem

Browsers cannot launch inside nono.sh sandboxes on macOS. The Seatbelt kernel sandbox blocks Mach IPC (bootstrap_check_in) and xattr syscalls that browsers require for multi-process communication.

What we tested:

@statico
statico / How codewiki.google Works.md
Created March 30, 2026 03:28
How codewiki.google Works

How codewiki.google Works

Stack: Angular app with Three.js embedded directly (~1MB in the JS bundle). No GSAP, no Lottie, no external animation libraries.


1. Cube Split/Assemble Animation

Three.js + scroll-driven interpolation. The cube is not one mesh breaking apart — it's two sets of PlaneGeometry faces (split state vs. assembled state) with the visible cube interpolating between them:

@statico
statico / math-tutor.html
Created March 12, 2026 00:45
Math Tutor - single page HTML app for 9-year-old level math practice
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Math Tutor</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
@statico
statico / Reverse-Engineering the Quicken for Mac (2007-era) QDF Bundle Format.md
Created March 9, 2026 20:03
Reverse-Engineering the Quicken for Mac (2007-era) QDF Bundle Format

Reverse-Engineering the Quicken for Mac (2007-era) QDF Bundle Format

Background

A Quicken for Mac data file (circa 2007-2008, Quicken Mac 2007) was provided as a macOS bundle directory with no working copy of Quicken available to export from. The goal was to extract transaction data (dates, payees, check numbers, memos, and amounts) into a CSV.

Bundle Structure