Skip to content

Instantly share code, notes, and snippets.

@jake-stewart
jake-stewart / color256.md
Last active March 9, 2026 20:31
Terminals should generate the 256-color palette

Terminals should generate the 256-color palette from the user's base16 theme.

If you've spent much time in the terminal, you've probably set a custom base16 theme. They work well. You define a handful of colors in one place and all your programs use them.

The drawback is that 16 colors is limiting. Complex and color-heavy programs struggle with such a small palette.

@AndrasKovacs
AndrasKovacs / TwoStageRegion.md
Last active December 25, 2025 23:54
Lightweight region memory management in a two-stage language
@SonoSooS
SonoSooS / DMGCPU.MD
Last active February 20, 2026 13:10
Game Boy CPU internals

This document is intended to document certain inner workings of the CPU.

There have been efforts by emu-russia and gekkio to have the CPU decapped, and so we have the decode ROM accessible to us. This means, that we know exactly what each opcode does (besides some nuanced behavior related to HALT, STOP, and some state management related to interrupts and power saving which are hard to untangle).

Table of contents

@Random832
Random832 / dither.py
Created April 23, 2021 20:38
bayer dithering experiment
import numpy as np
from PIL import Image
import sys
im = Image.open('chart.png')
im2 = np.array(im)
factor = 127 # 84
@generalmimon
generalmimon / github-repos-using-ks.md
Last active January 13, 2026 02:44
List of GitHub repositories containing .ksy files (excluding kaitai-io org)
  • Last updated: 2023-03-20

  • Collected .ksy files on GitHub by this shell script and then filtered unique repos by the following command:

@whitequark
whitequark / jt51_player.cc
Last active January 22, 2021 02:22
JT51 + CXXRTL + VGM = <3 <3
// Step 1: Obtain Yosys from git.
// Step 2: Download jt51 from https://github.com/jotego/jt51.
// Step 3: Build as follows:
// $ yosys jt51/hdl/*.v -b 'cxxrtl -header' -o jt51_core.cc
// $ CFLAGS="-fbracket-depth=2048 -I$(yosys-config --datdir/include)"
// $ clang++ -O3 $CFLAGS jt51_core.cc jt51_player.cc -o jt51_play
// Step 4: Convert as follows:
// $ python3 vgm2tsv.py music.vgm music.tsv
// Step 5: Play as follows (assuming YM2151 clocked at 4 MHz):
// $ ./jt51_play music.tsv music.wav 4000000
@taiki-e
taiki-e / maintenance-status-badges.md
Last active February 18, 2026 17:26
Markdown Maintenance status badges
@abarisani
abarisani / usb_fingerprinting.md
Last active January 5, 2025 22:03
Fingerprinting USB enumeration from different hosts

Introduction

The following information illustrates the differences between macOS, Windows and Linux in USB device enumeration sequence.

Specifically the comparison covers USB Mass Storage device enumeration, implemented with the TamaGo USB driver on a USB armory Mk II running armory-ums.

// The MIT License (MIT)
//
// Copyright (c) 2018 Darrell Wright
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files( the "Software" ), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@withoutboats
withoutboats / constraint-kinds.md
Last active September 6, 2024 20:30
Constraint Kinds in Rust

Notes on adding Constraint Kinds to Rust

Background: Constraint Kinds

a trait can be thought of as a type operator generating a "constraint" - what in Rust would usually be called a bound. For example:

// Declares a new item `Foo` with kind `type -> constraint`
trait Foo { }