Skip to content

Instantly share code, notes, and snippets.

@mizchi
mizchi / terminal-browser-architecture-ja.md
Created September 23, 2026 17:17
terminal-browser の構成: Pixel、CDP、chaosbringer による共有プレビュー

Written by AI as draft


terminal-browser のコアはどこにあるか — Pixel、CDP、chaosbringer の構成

terminal-browser は、文字でページを近似するブラウザではない。Chromium が描いたページをターミナルに表示し、ターミナルからのマウス・キーボード入力をブラウザへ渡すアプリである。表示には Kitty graphics protocol を使う。公式 README

この仕組みを再利用したい場合、描画エンジンを terminal-browser から改めて抜き出す必要はない。中核は既に @zenbu-labs/pixel として分かれている。

@mizchi
mizchi / README.md
Created September 21, 2026 14:22
MoonBack router optimization: reproducible benchmarks, Mars comparison, and raw measurements

MoonBack router benchmark evidence

Supporting measurements for the MoonBack path traversal optimization. The PR contains only the router implementation and regression tests. This gist keeps the benchmark infrastructure and detailed analysis separate from library changes.

  • evaluation.md: full results, interpretation, and limitations.
  • http.json: all 120 HTTP samples, latency output, versions, binary hashes.
  • router-before.txt, router-after.txt: retained-result microbenchmark output.
  • benchmark-harness.patch: optional benchmark fixtures, scripts, and just tasks.

Claude に bendlang/bend をいじらせて、自分が聞きたいことを聞きながら、紹介記事を書いて、と書かせたもの


bendlang の紹介

Bend という言語を初めて触った日に、初見の感想として、名前も聞いたことがない人向けに書きます。

以下のコードは全部 Bend 2.0.23 (HEAD 75cb8f3e) で型検査と実行を確認したものです。

@mizchi
mizchi / jev_client.mbt
Last active September 17, 2026 11:23
jev_client.mbt
pub struct Client {
api_key : String
base_url : String
}
///|
pub fn Client::new(api_key : String) -> Client {
{ api_key, base_url: "https://api.typesafe.ai", }
}
@mizchi
mizchi / sprite-sheet.ts
Created September 10, 2026 12:36
sprite-sheet.ts: standalone Node.js 24+ sprite sheet splitter, alignment and PNG/GIF export, with optional OpenAI image generation
#!/usr/bin/env node
// SPDX-License-Identifier: Apache-2.0
/**
* sprite-sheet.ts — 透過スプライトシートの分割・位置合わせ・PNG/GIF出力
*
* 必要環境: Node.js 24以降。コードはこの .ts ファイル1枚だけで実行できます。
* 実行時の依存: pngjs 7.0.0 / gifenc 1.0.3(Python・ffmpeg・ビルド不要)。
*
* 1. このファイルを作業ディレクトリに保存し、同じ場所で依存をインストール:
* pnpm add pngjs@7.0.0 gifenc@1.0.3
@mizchi
mizchi / README.ja.md
Last active September 4, 2026 14:29
Generating small SIMD WebAssembly with Zig 0.16 / Zig 0.16で小さなSIMD WebAssemblyを生成する

Zig 0.16で小さなSIMD WebAssemblyを生成する

English version: README.md

Zigの@Vectorを使うと、SIMDカーネルを型安全に記述しつつ、wasm32-freestandingから手書きWATに近い小さなWebAssemblyを生成できる。ただし、ベクトル型で書いたことはSIMD命令の生成を保証しない。Wasm SIMDを明示的に有効化し、出力されたモジュールを検査し、後処理ごとのサイズを実測する必要がある。

このガイドはWASIアプリケーション全体ではなく、ブラウザから呼ぶ小さなleaf kernelを対象にする。コマンドとバイト数は次の環境で確認した。

  • Zig 0.16.0
  • wasm-tools 1.245.1
@mizchi
mizchi / src_index.ts
Created September 1, 2026 10:02
cfos-workspace-core.ts
import { DurableObject } from "cloudflare:workers";
import { Hono } from "hono";
interface AppRecord {
code: string;
version: number;
}
export interface Env {
WORKSPACES: DurableObjectNamespace<Workspace>;
@mizchi
mizchi / README.md
Last active August 25, 2026 10:49
MoonBit JS backend: prebuilt Wasm SIMD fast-path investigation and reproducible benchmark

JS から prebuilt Wasm SIMD を呼ぶ実験

MoonBit JS ターゲットの Bytes と同じ Uint8Array を入力とし、単一バイトの miss scan を比較する最小実験です。

本題のend-to-endサンプルは moonbit-demo/main.mbt です。MoonBit自身をJSへ コンパイルし、extern "js" グルーから埋め込み済みWasm SIMDを呼びます。

cd experiments/js-wasm-simd/moonbit-demo
@mizchi
mizchi / README.md
Last active August 22, 2026 07:20
WalTier: the execution flow of src/wal.rs modelled in Quint, and four issues it turned up

WalTier execution flow, in Quint

A model of src/wal.rs written while reading danthegoodman1/waltier, and the four issues it turned up. Each issue has its own PR against the repo; this gist is what those PRs link to for the reasoning.

# issue PR
1 reconcile runs when nothing was committed danthegoodman1/waltier#1
@mizchi
mizchi / README.md
Created August 14, 2026 12:45
Quint model of celld's alarm wake-entry gate (denoland/celld#146)

celld wake-entry model

A small Quint model of the alarm wake-entry gate in celld v0.2.0 (3f22aedd1ea4d413b93e84afb1ce385f04be84f1), written while investigating denoland/celld#146.

The safety property is the externally visible half of alarm liveness: