Skip to content

Instantly share code, notes, and snippets.

View copyleftdev's full-sized avatar
🎯
Focusing

Don Johnson copyleftdev

🎯
Focusing
View GitHub Profile
@copyleftdev
copyleftdev / types.rs
Created April 12, 2026 02:36
Palimpsest: Seeded PRNG (CrawlSeed)
//! Core domain types shared across all crates.
use rand_chacha::ChaCha8Rng;
use rand_chacha::rand_core::SeedableRng;
use serde::{Deserialize, Serialize};
use url::Url;
use crate::hash::ContentHash;
use crate::time::CaptureInstant;
@copyleftdev
copyleftdev / gist:05bc06a3e9ab8c8c290ee90b36c419c1
Created April 12, 2026 02:36
Palimpsest: Browser Determinism Layer (JS Overrides)
// Palimpsest Determinism Layer (Law 1)
// Injected BEFORE page navigation to ensure all JS execution
// is deterministic for a given seed.
// Freeze Date.now() to the envelope timestamp.
const __palimpsest_base_time = ENVELOPE_TIMESTAMP_MS;
let __palimpsest_time_offset = 0;
Date.now = function() {
__palimpsest_time_offset += 1;
return __palimpsest_base_time + __palimpsest_time_offset;
@copyleftdev
copyleftdev / harness.rs
Created April 12, 2026 02:36
Palimpsest: Determinism Verification Harness
//! Determinism verification harness.
//!
//! Crawls a SimulatedWeb twice with the same seed and asserts
//! bit-identical results. Any divergence is a Law 1 violation.
use std::path::Path;
use std::sync::Arc;
use chrono::Utc;
use palimpsest_core::hash::ContentHash;
@copyleftdev
copyleftdev / lib.rs
Created April 12, 2026 02:36
Palimpsest: ExecutionEnvelope (Sealed Context)
//! palimpsest-envelope: The execution envelope.
//!
//! Every fetch runs inside a sealed context capturing:
//! seed, timestamp, headers, DNS resolution snapshot, TLS fingerprint,
//! and browser config (if applicable).
//!
//! The envelope is immutable after construction. It is the critical
//! abstraction that makes both determinism (Law 1) and replay fidelity
//! (Law 5) possible.
@copyleftdev
copyleftdev / CLAUDE.md
Created April 12, 2026 02:36
Palimpsest: CLAUDE.md (Full Project Instructions)

PALIMPSEST — Deterministic Crawl Kernel

Same input + same seed = identical crawl, identical artifacts, identical replay. Everything bends around this. If we lose this, we've built noise — not history.

What This Is

A crawl kernel, not a crawler. Provides deterministic scheduling, reproducible fetch execution, verifiable artifact generation, replay-grade normalization, and temporal indexing as a first-class primitive. CLI, UI, dashboards are thin skin. The kernel is the product.

@copyleftdev
copyleftdev / git-worktree.sh
Created May 25, 2026 20:20
git worktree — multiple checkouts, one repo
# git worktree — multiple checkouts, one repo
# Run two branches side-by-side without stashing or switching.
git worktree add ../feature-branch feature/my-feature
git worktree add ../hotfix-branch main
# Both share the same .git — no second clone needed.
# List all active worktrees:
git worktree list
@copyleftdev
copyleftdev / git-bisect.sh
Created May 25, 2026 20:20
git bisect run — automated binary search for a regression
# git bisect — binary search your blame
# Manual mode: you tell git good/bad at each step.
git bisect start
git bisect bad # current commit is broken
git bisect good v2.3.0 # this tag was clean
# git checks out the midpoint — test, then:
git bisect good # or: git bisect bad
# repeat ~7 times until git prints the culprit
@copyleftdev
copyleftdev / git-rerere.sh
Created May 25, 2026 20:20
git rerere — reuse recorded conflict resolutions
# git rerere — never resolve the same conflict twice
# Enable once globally, then forget it's there.
git config --global rerere.enabled true
# First time you hit a conflict:
# resolve it manually, then:
git add src/the-file.py
git commit -m "merge: resolved"
# rerere silently records the resolution fingerprint
@copyleftdev
copyleftdev / git-pickaxe.sh
Created May 25, 2026 20:20
git log -S — the pickaxe: find when a string was added or removed
# git log -S — the pickaxe
# Find commits where a specific string's count in a file changed.
# Searches diff content, not commit messages.
# When was this secret added or removed?
git log -S "API_SECRET" --all --oneline
# See the full diff for each match:
git log -S "API_SECRET" -p
@copyleftdev
copyleftdev / git-notes.sh
Created May 25, 2026 20:20
git notes — annotate commits without touching their SHA
# git notes — attach metadata to commits without rewriting history
# Notes live in refs/notes/commits — the commit SHA never changes.
git notes add -m "Deployed to prod at 14:32 UTC, PLAT-482" HEAD
git notes show HEAD
# See notes inline in git log:
git log --show-notes --oneline -10