Skip to content

Instantly share code, notes, and snippets.

View mibmo's full-sized avatar

mib mibmo

View GitHub Profile
@mibmo
mibmo / blame.txt
Last active June 24, 2026 21:46
Linux contributors by blame lines (as of 2026-06-24 / f0e6f20cb52b14c2c441f04e21cef0c95d498cac)
Linus Torvalds: 1883161
Alex Deucher: 1193532
Hawking Zhang: 1140328
Aurabindo Pillai: 585590
Ian Rogers: 507801
Huang Rui: 478023
Mauro Carvalho Chehab: 390796
Qingqing Zhuo: 296302
Oded Gabbay: 291204
Roman Li: 266472
@mibmo
mibmo / lines.rs
Created June 16, 2026 19:37
Producing &str iterator directly from byte slice
use std::collections::BTreeMap;
fn main() {
let bytes = br#"abc16fee4a15025735ed443159143e258914450d556a8db4f07379611fb8cc56 *mbdump-cdstubs.tar.bz2
c2c437a2d17f5e07d1010b36b4006762c4fc854ac909780ebc0972f52bf8cf8f *mbdump-cover-art-archive.tar.bz2
ba13337eb23b8bffb7265a7247bb293d60bb80de2eee25f00cb23dabffeb58d9 *mbdump-derived.tar.bz2
986e9067195a587ede599d3f8f6097e4677e0a1cd4df728b965e7b17967aff16 *mbdump-documentation.tar.bz2
db340002bb98395411e4fa22cf14be4c5af399dba83775eb4c38def1cbf031af *mbdump-editor.tar.bz2
ab9a94486383c67b7959ffdb30f9eb367e72688e1c6ec49c01348c8823f65afc *mbdump-edit.tar.bz2
3e62162eefba082b215838f98ca775584deaf2765e2a5441b55b8b1499b213ef *mbdump-event-art-archive.tar.bz2
@mibmo
mibmo / flag.css
Last active June 11, 2026 12:24
wavey flag in pure CSS
.flag {
--stagger-delay: 100ms;
--loop-time: 500ms;
--billow: 20px;
--columns: 5;
--roundedness: 1em;
--size: 200px;
height: var(--size);
width: calc(round(var(--size)/var(--columns), 1px) * var(--columns) * 2);
@mibmo
mibmo / elements.json
Last active May 27, 2026 09:26
Chemical elements and some metadata in machine-readable JSON. Sourced from Wikipedia, May 2026
{
"header": {
"z": "Atomic number",
"symbol": "Symbol",
"element": "Element",
"group": "Group",
"period": "Period",
"block": "Block",
"atomic_weight": "Atomicweight[a](Da)",
"density": "Density[b][c](g/cm3)",
@mibmo
mibmo / get_flac_duration.sh
Created February 26, 2026 15:51
Get duration of FLAC file
ffprobe -show_streams -select_streams a -v quiet "input.flac" | grep -oP '^duration=\K[0-9.]+$'
@mibmo
mibmo / pwdSnapshot.sh
Created August 25, 2025 23:15
Get cwd in latest snapshot
function pwdSnapshot() {
echo "/persist/.zfs/snapshot/$(zfs list -t snapshot -o creation,name -pH data/persist | sort --stable --reverse --key=1,1 | cut -d'@' -f2- | head -1)/$PWD"
}
@mibmo
mibmo / semver.nix
Created April 30, 2025 16:52
Semver regex via Nix
let
letter = ''[a-zA-Z]''; # unused; just from semver's spec
positive-digit = ''[1-9]'';
digit = ''[0-9]'';
non-digit = ''[a-zA-Z-]'';
identifier-character = ''[a-zA-Z0-9-]'';
numeric-identifier = ''(0|${positive-digit}${digit}*)'';
alphanumeric-identifier = ''(${non-digit}${identifier-character}*|${identifier-character}+${non-digit}${identifier-character}*)'';
build-identifier = ''(${alphanumeric-identifier}|${digit}+)'';
pre-release-identifier = ''(${alphanumeric-identifier}|${numeric-identifier})'';
@mibmo
mibmo / toPython.nix
Created April 10, 2025 22:13
Convert Nix types into Python data (probably)
let
inherit (builtins)
attrValues
concatStringsSep
foldl'
head
length
mapAttrs
tail
typeOf
@mibmo
mibmo / fix-conflicts.bash
Last active November 5, 2024 04:55
Automatically fix Syncthing conflicts via 3-way merges (requires trashbin versioning or stronger, as well as fd, ripgrep, and git)
#!/usr/bin/env bash
# syncthing share. some parent directory
targetShare="$PWD"
while true; do
if [ -d "$targetShare/.stfolder" ]; then break; fi
if [ "$targetShare" == "/" ]; then
echo "Could not find parent Syncthing share"
exit 1;
fi
@mibmo
mibmo / Cargo.toml
Created July 21, 2024 12:11
Trying some JSON parsing with winnow
[package]
name = "json-parser"
version = "0.1.0"
edition = "2021"
[dependencies]
winnow = { version = "0.6.14", features = ["simd", "debug"] }