Skip to content

Instantly share code, notes, and snippets.

@siraben
siraben / README.md
Created June 24, 2026 21:51
Smallest bootable NixOS ISO (~91 MiB) — continuing https://natkr.com/2026-06-19-nixos-but-smol/ (183→91 MiB), boots to an autologin root shell

smallest-iso

An aggressively minimized, bootable NixOS ISO, continuing where natkr's "NixOS but smol" left off. The post took a stock minimal ISO from 458 MiB → 183 MiB. This takes that 183 MiB result and pushes it much further while keeping it a real NixOS system that boots to an autologin root shell.

Build & verify

@siraben
siraben / fix.patch
Last active May 12, 2026 05:01
m2-planet segfault
diff --git a/cc_core.c b/cc_core.c
index 1890595..cddb43b 100644
--- a/cc_core.c
+++ b/cc_core.c
@@ -273,13 +273,16 @@ void function_call(struct token_list* s, int is_function_pointer)
emit_push(REGISTER_BASE, "Protect the old base pointer");
emit_push(REGISTER_LOCALS, "Protect the old locals pointer");
- emit_move(REGISTER_TEMP, REGISTER_STACK, "Copy new base pointer");
-
@siraben
siraben / endian-test.sh
Created April 3, 2026 19:41
Big-endian testing, reproducibly
#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p qemu gcc "pkgsCross.mips-linux-gnu.stdenv.cc" "pkgsCross.mips-linux-gnu.stdenv.cc.libc.static" "pkgsCross.s390x.stdenv.cc" "pkgsCross.s390x.stdenv.cc.libc.static"
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/ac62194c3917d5f474c1a844b6fd6da2db95077d.tar.gz
# Big-endian testing with QEMU user-mode emulation and Nix cross-compilers.
# Reproduces: https://www.hanshq.net/big-endian-qemu.html
set -euo pipefail
@siraben
siraben / rk4.nix
Last active April 7, 2023 21:11
Implementation of sine function in Nix using fourth-order Runge-Kutta
{ lib ? (import <nixpkgs> {}).lib }:
with lib;
let
# Fourth-order Runge-Kutta method
rk4 = f: x0: y0: z0: h:
let
k1_y = z0;
k1_z = f x0 y0 z0;
@siraben
siraben / owner.sol
Created November 6, 2022 22:54
Example Solidity contract with an owner field
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Owner
* @dev Set & change owner
*/
contract Owner {
@siraben
siraben / factorial.txt
Last active September 25, 2022 18:32
Recursive descent parsing in Cool
((\f. (\x. (f \v. ((x x) v)) \x. (f \v. ((x x) v))) \r. \n. i(n,o,m(n,(r d(n))))) x)
@siraben
siraben / cbv.cl
Created September 8, 2022 18:52
Call-by-value λ-calculus interpreter in Cool
-- Call-by-value lambda calculus in cool
(*
data Expr = Var Str
| Abs Str Expr
| App Expr Expr
| Sub1 Expr
| Mul Expr Expr
| Add Expr Expr
| Ifz Expr Expr Expr
*)
@siraben
siraben / Proving insertion sort in Coq.pdf
Last active July 13, 2022 01:50
Proving insertion sort correct easily in Coq
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE TypeOperators #-}
module ExtALaCarte where
@siraben
siraben / vandy_covid.ipynb
Last active February 22, 2022 16:25
Web scraping Vanderbilt's COVID-19 dashboard
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.