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
  • 02:46 (UTC -05:00)
  • X @pmarreck
  • LinkedIn in/petermarreck
View GitHub Profile
@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]
@pmarreck
pmarreck / ocr_system_prompt.bash
Created April 2, 2025 02:11
An OCR system prompt for an LLM
export const OCR_SYSTEM_PROMPT = `
Convert the following document to markdown.
Return only the markdown with no explanation text. Do not include delimiters like \`\`\`markdown or \`\`\`html.
RULES:
- You must include all information on the page. Do not exclude headers, footers, charts, infographics, or subtext.
- Return tables in an HTML format.
- Logos should be wrapped in brackets. Ex: <logo>Coca-Cola<logo>
- Watermarks should be wrapped in brackets. Ex: <watermark>OFFICIAL COPY<watermark>
- Page numbers should be wrapped in brackets. Ex: <page_number>14<page_number> or <page_number>9/22<page_number>
@pmarreck
pmarreck / jpegxl.bash
Created March 3, 2025 18:09
jpegxl: a bash function to make conversions to/from jpegxl easier!
#!/usr/bin/env bash
### jpegxl: a bash function to make conversions to/from jpegxl easier!
# Silence function - runs a command silently but preserves exit code
silence() {
"$@" >/dev/null 2>&1
return $?
}