Skip to content

Instantly share code, notes, and snippets.

View pmarreck's full-sized avatar

Peter Marreck pmarreck

  • formerly senior engineer @ desk.com, chief engineer @ thredup.com, software engineer @ lifebooker.com. Director of Engineering @ addigence.com, currently available
  • Long Island, NY
  • 15:58 (UTC -05:00)
  • X @pmarreck
  • LinkedIn in/petermarreck
View GitHub Profile
@pmarreck
pmarreck / ZIG_RECENT_API_CHANGES_2025.md
Created February 14, 2026 15:23
Zig 0.15.x Update Language Guide (for humans and LLMs)

# Zig API Reference for 2025 (0.14.0 - 0.15.x)

Purpose: Quick reference for LLMs and developers writing fresh Zig code in 2025. Focus on "how to do things correctly now" rather than migration from old APIs.

Current Version: Zig 0.15.x (as of late 2025)

Sources:

@pmarreck
pmarreck / jj_cheatsheet.md
Created February 13, 2026 14:10
jujutsu "cheatsheet" for git devs- note: may need frequent updates as the jj API is still in flux

Jujutsu (jj) Quick Reference

Basic Operations

Commits

# Update the description of the current change and create a new empty change on top
jj commit -m "Commit message"

# Edit the description of the current commit
@pmarreck
pmarreck / CLAUDE.md
Last active February 7, 2026 21:18
My current AGENTS/CLAUDE.md

Agent Briefing

Bit about me: <redacted personal info that is easily googleable anyway lol>

Your role: Functional, TDD-first, curiosity-prodding developer who balances correctness, performance, and clarity. Act as a precise pair programmer; when tradeoffs arise, list brief pros/cons and pause for direction.

Important: Refer to me as "Peter" in conversation, not "the user".

Curiosity cue: after each reasoning step, ask yourself: “What am I missing? What are the alternative designs? What could break, or be broken into? How might this be simpler or more concise?”

Work Rhythm

@pmarreck
pmarreck / flatmap_shared_copy_fix.patch
Created February 6, 2026 18:39
Erlang/OTP flatmap size-in-header fixes (from Peter's Claude) - 5 bugs fixed, otp_build all passes
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c
index e09a2ab51c6..6487f830794 100644
--- a/erts/emulator/beam/copy.c
+++ b/erts/emulator/beam/copy.c
@@ -1589,9 +1589,8 @@ Uint copy_shared_perform_x(Eterm obj, Uint size, erts_shcopy_t *info,
switch (MAP_HEADER_TYPE(hdr)) {
case MAP_HEADER_TAG_FLATMAP_HEAD : {
flatmap_t *mp = (flatmap_t *) ptr;
- Uint n = flatmap_get_size(mp);
- ASSERT(n <= MAP_SMALL_MAP_LIMIT);
@pmarreck
pmarreck / mkdir-custom.bash
Created November 26, 2025 13:43
mkdir but takes a -c/--cd argument that cd's into the new directory
# I got tired of this pattern: mkdir -p path/to/dir && cd path/to/dir
# So now mkdir will take a -c or --cd argument to do it all at once.
mkdir-custom () {
local do_cd=false;
local mkdir_args=();
local target_dir="";
function show_help ()
{
cat <<-'EOF'
@pmarreck
pmarreck / asteroids.html
Created July 30, 2025 00:54
The very first output of the prompt "Write a self-contained HTML, CSS and Javascript page implementing Asteroids" sent to the new model GLM-4.5-Air-q5-hi-mlx running on an M4 128GB. Runs great!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asteroids Game</title>
<style>
* {
margin: 0;
@pmarreck
pmarreck / vtt.lua
Last active July 26, 2025 16:28
Visual Terminal Timer, a timer written in LuaJIT that slowly fills your terminal with blocks (and responds to terminal resize events)
local ffi = require("ffi")
local bit = require("bit")
ffi.cdef([[ struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
int ioctl(int fd, unsigned long request, ...);
@pmarreck
pmarreck / rm-safe.bash
Last active July 9, 2025 17:25
rm-safe: a safer rm, inspired by Solaris' safer rm
#!/usr/bin/env bash
# rm-safe: A safer 'rm' that moves files to trash
# Version: 4.0 (Refactored with integrated tests)
set -uo pipefail
# --- Configuration ---
readonly SCRIPT_VERSION="4.0"
readonly OS="$(uname)"
readonly USER_ID="$EUID"
@pmarreck
pmarreck / find_github_forks_with_file.bash
Last active July 3, 2025 17:52
A way to search all forks of a Github project to see if any of them already have a certain file, such as a flake.nix (the default)
#!/usr/bin/env bash
# find_github_forks_with_file
# Default values
REPO=""
FILE_TO_SEARCH="flake.nix"
MAX_JOBS=10
SCRIPT_NAME=$(basename "$0")
# Help function
@pmarreck
pmarreck / name-value-to-table.lua
Created April 14, 2025 22:37
name-value-to-table (in Lua) to convert name=value pairs (such as the output of env) into a pretty-printed table
#!/usr/bin/env luajit
--[[
name-value-to-table-lua: Read lines like FOO=bar and emit a pretty table.
Supports -i/--input <file> (or - for stdin), -o/--output <file> (or - for stdout),
--help, --test, and optional --key-width <n> --val-width <n>.
]]
local function print_help()
io.stdout:write([[Usage: name-value-to-table-lua [-i file] [-o file] [--key-width N] [--val-width N]