Skip to content

Instantly share code, notes, and snippets.

View mkreyman's full-sized avatar
🏃‍♂️
Building cool stuff, serving customers, and enjoying every moment of it...

Mark Kreyman mkreyman

🏃‍♂️
Building cool stuff, serving customers, and enjoying every moment of it...
View GitHub Profile
@mkreyman
mkreyman / README.md
Created September 18, 2026 03:18
mutate.sh -- prove a test can actually fail before you believe its green. Break the code, run the test, watch it go red. Exit code is inverted: 0 = believable, 1 = the test cannot fail.

mutate.sh -- prove a test can actually fail

Break the code on purpose. Run the test. If it doesn't go red, its green never meant anything.

./mutate.sh <file> --old '<working text>' --new '<broken text>' -- <your check command>

The exit code is inverted, deliberately:

@mkreyman
mkreyman / claude-code-kb-hooks.md
Created August 4, 2026 17:20
Two Claude Code hooks that make an agent actually use your knowledge base: a gate that blocks questions until it has searched (verified against the session log), and a capture hook that publishes what a session learned on end/compact.

Two hooks that make a coding agent actually use your knowledge base

A knowledge base your agents ignore is a folder. These are the two Claude Code hooks that changed that for me: one makes searching cheaper than asking, the other makes writing things down automatic.

Both are generalized -- set KB_SEARCH_TOOL to whatever your KB's MCP search tool is called.


@mkreyman
mkreyman / 2026-07-07-dna-cross-analysis.gist.md
Created July 7, 2026 17:50
Reproduce a $600-style genetic methylation panel (MTHFR/MTR/MTRR/COMT/AHCY) from a raw consumer-DNA file — informational, not medical advice

Methylation Panel Report from Raw DNA (23andMe / MyHeritage / AncestryDNA)

Usage:

# Download your raw DNA export from 23andMe, MyHeritage, AncestryDNA, or FTDNA
# Then run:
python3 analyze_methylation.py your_raw_dna.csv --name "Your Name"

# Outputs:
# - Text report to stdout
@mkreyman
mkreyman / adversarial-multi-agent-code-review.md
Created July 2, 2026 02:45
Adversarial multi-agent code review — the pipeline + the actual reviewer/adversary prompts (disprove-first verification, hostile second round, author never approves its own work)

Adversarial multi-agent code review (that actually filters false positives)

How I review code -- including AI-written code -- with a squad of AI agents, without drowning in confident-but-wrong findings. Product-agnostic. I run it in Claude Code with parallel sub-agents, but the shape ports to any setup where you can run more than one agent.

The one rule

The agent (or person) that wrote the code never reviews or approves it. Reviewers and the verifier are separate from the author. Everything below exists to enforce that.

Why not just "AI, review my PR"

@mkreyman
mkreyman / cli.js
Created December 31, 2025 17:04
Claude Code 2.0.76 cli.js for LSP patch debugging
This file has been truncated, but you can view the full file.
#!/usr/bin/env node
// (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
// Version: 2.0.76
// Want to see the unminified source? We're hiring!
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
import{createRequire as Ez9}from"node:module";var Vz9=Object.create;var{getPrototypeOf:Hz9,defineProperty:CF1,getOwnPropertyNames:Dz9}=Object;var Fz9=Object.prototype.hasOwnProperty;var l=(A,Q,B)=>{B=A!=null?Vz9(Hz9(A)):{};let G=Q||!A||!A.__esModule?CF1(B,"default",{value:A,enumerable:!0}):B;for(let Z of Dz9(A))if(!Fz9.call(G,Z))CF1(G,Z,{get:()=>A[Z],enumerable:!0});return G};var U=(A,Q)=>()=>(Q||A((Q={exports:{}}).exports,Q),Q.exports);var M5=(A,Q)=>{for(var B in Q)CF1(A,B,{get:Q[B],enumerable:!0,configurable:!0,set:(G)=>Q[B]=()=>G})};var O=(A,Q)=>()=>(A&&(Q=A(A=0)),Q);var LA=Ez9(import.meta.url);var zz9,cfA;var $F1=O(()=>{zz9=typeof global=="object"&&global&&global.Object===Object&&global,cfA=zz9});var Cz9,
@mkreyman
mkreyman / DynamoDbWriter.js
Created July 17, 2019 19:53 — forked from mike-hogan/DynamoDbWriter.js
Nodejs DynamoDB writer with exponential back off
"use strict";
var fs = require('fs');
var path = require('path');
var AWS = require('aws-sdk');
var util = require('util');
var stream = require('readable-stream');
var _ = require('lodash');
version: "3.3"
services:
neo4j:
image: neo4j:latest
tty: true
environment:
- NEO4J_AUTH=none
- NEO4J_dbms_unmanaged__extension__classes=org.neo4j.graphql=/graphql
- NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
- NEO4J_apoc_import_file_enabled=true
@mkreyman
mkreyman / donate-bitcoin.html
Created July 9, 2018 01:22 — forked from joar/donate-bitcoin.html
Quick and dirty bitcoin donation button, as seen on https://gobblin.se
<style>
.donate-button {
text-align: center;
}
.donate-button .bitcoin-address {
font-size: 1.5em;
}
</style>
<div class="donate-button">
@mkreyman
mkreyman / map_to_struct.ex
Last active June 23, 2018 04:04
Creating a struct from a map with string keys
def to_struct(kind, attrs) do
struct = struct(kind)
Enum.reduce Map.to_list(struct), struct, fn {k, _}, acc ->
case Map.fetch(attrs, Atom.to_string(k)) do
{:ok, v} -> %{acc | k => v}
:error -> acc
end
end
end