The most interesting problems live at the boundaries, between disciplines, cultures, and systems of thought.
Born in Morocco and raised in Abu Dhabi, I graduated from UC Berkeley with a degree in Computer Science and a minor in Jewish Studies. Growing up across cultures gave me an early sense that the most interesting problems don't stay inside their lane. They live at the edges of technology, institutions, and power.
My technical work spans reinforcement learning, game theory, and large-scale software systems. The thread running through it is decision-making under uncertainty: how algorithms, organizations, governments, and adversaries behave when information is incomplete and failure compounds. I'm drawn to the moments when a system has to act anyway.
Growing up in the Middle East made these questions concrete. The region doesn't let you believe that elegant ideas are enough. Coordination fails even when everyone can see it failing, and that gap between what systems should do and what they actually do is where I've always wanted to work.
What that looks like in practice is software for messy, high-stakes environments. Tools that connect fragmented data, AI reasoning, and human judgment so serious organizations can act with more clarity than they otherwise would. The engineering and the geopolitics feel, to me, like the same problem at different scales.
reedcode
ReedCode
ai
agent inference research · NVIDIA Dynamo
ai systems
A coding-agent harness and a GPU research project on how agents use inference servers. It uncovered two bugs in NVIDIA Dynamo: my fix for one is merged upstream, and my fix for the other cuts an agent session's prefill by up to 46%.
Python
Rust
NVIDIA Dynamo
vLLM
Docker
github
https://github.com/reedyalouh2/ReedCode
merged dynamo fix
https://github.com/ai-dynamo/dynamo/pull/16608
Coding agents resend a long, growing context on every turn: the system prompt, the tool definitions, the whole conversation and each new tool result. Inference servers keep already-processed prefixes in a KV cache so they don't recompute them, and NVIDIA Dynamo goes further, warming the cache for an agent's next request while its tool is still running. Whether any of that actually saves work depends on what the server renders, computes and reuses, which almost nobody measures.
A minimal coding agent that reads files, edits code and runs commands in Docker workspaces, instrumented to record tokens, cache hits, timing and task results for every model call. I ran it against hosted models, direct vLLM and my own Dynamo deployment of Qwen3-8B on an A100, then replayed captured sessions under controlled conditions to see exactly what the server computed and what it reused. The traces exposed two bugs in Dynamo; I confirmed both on GPU, patched them in Dynamo's Rust code and took both upstream.
Instrumented agent
The harness runs a read, edit and shell tool loop against hosted APIs, vLLM or Dynamo. Harbor builds each Docker workspace and scores the result with the task's verifier, and every call is logged with its tokens, cache hits and timing.
Controlled replays
Saved sessions replay against the GPU server with conditions interleaved and their order rotated: warmup off, stock and fixed, three times each. Prefill counts repeated exactly in every condition, so the differences belong to the server, not to noise. The whole 18-trial GPU study cost about $2.37.
Wasted warmups
Dynamo's speculative prefill built its warmup from the message text alone, dropping the tool definitions and template settings, so the warmup parted ways with the real request before most of the context. Sessions paid 62–85% more prefill and kept up to 2.4 GiB of cache that nothing read. The fix keeps those fields, making the warmup an exact prefix of the next request.
Ignored thinking setting
Dynamo's Anthropic-compatible endpoint dropped an explicit thinking: disabled, so Qwen3 kept reasoning anyway. My fix passes the caller's choice through to the chat template and is merged into Dynamo. Replaying four long Claude Code requests, it cut generated tokens by 74% and response time by 65%.
Waste that looks like success
Nothing errored. The warmups ran, the answers were right and the cache looked busy. The bug only shows when you compare what the server rendered with what it later reused, block by block.
Every template is different
Restoring the dropped fields gave exact prefixes for the Nemotron and GPT-OSS templates, but Qwen also needed an explicit tool-continuation boundary in the renderer before its warmups lined up.
Hybrid models
Models that mix attention with recurrent layers can't reuse a cached prefix the usual way. In one case stock routing credited a worker with 3,264 tokens it could not reuse; my prototype selector tracks both kinds of state and chose a worker with 2,720 usable ones.
Measuring before building
Across 42 tool continuations, a corrected warmup would have prepared a median of only 80 extra tokens, so I dropped a planned scheduling policy instead of optimizing a workload with little to win.
recursive-discovery
Recursive Discovery
research
autonomous math search · exact verification
research tooling
An autonomous search system for a problem open since 1956, the zero-error capacity of the 7-cycle. It hunts for large codes under a hard compute budget, checks every answer exactly, and can hand the search to an LLM whose programs run sandboxed with metered spending. Built at the Crusoe Recursive Agents Hackathon.
Python
ShinkaEvolve
Crusoe inference
macOS sandbox
github
https://github.com/reedyalouh2/recursive-discovery-hackathon
demo
https://reedyalouh2.github.io/recursive-discovery-hackathon/
In 1956 Shannon asked how much information a noisy channel can carry with no chance of error. For a channel whose confusable symbols form a 7-cycle the answer is still unknown: it lies somewhere between 3.2578 and 3.3177. Lower bounds come from explicit constructions, sets of codewords where no two can be confused, and finding large ones is a huge combinatorial search. Handing that search to an autonomous agent only helps if every result can be checked and every dollar of compute is accounted for.
A search harness where every step is bounded and checkable. An iterated local search, after Andrade, Resende and Werneck, builds independent sets in strong powers of C7 under a fixed budget of neighbor-list scans, and an exact verifier checks every answer as data. Around that core: experiment history, deterministic replay, a tuning experiment judged on held-out seeds, and an adapter that lets ShinkaEvolve, an LLM-driven program-evolution framework, propose whole new search programs, each run in a locked-down sandbox with its spending reserved and capped before any model call.
The puzzle
In d dimensions a point is a list of d digits from 0 to 6, and two points are confusable when every digit differs by at most 1 around the cycle. A set of k points with no confusable pair proves the capacity is at least the d-th root of k. In two dimensions at most 10 points fit; the artifact lets you try.
Bounded local search
(1,2)-swaps trade one chosen point for two, forced insertions knock the search out of local optima, and an acceptance rule sometimes keeps a worse set to keep exploring. Work is counted in neighbor-list scans, so every run has a hard, deterministic budget.
Exact checking
The verifier confirms with exact integers that every pair differs by 2 to 5 (mod 7) in some coordinate, rejects malformed or duplicate points, and never executes candidate code.
Tuning, tested fairly
Evolutionary and random search tuned the local search's five settings over 192 runs each on tuning seeds, then the winners were frozen and compared on 20 separate held-out seeds. Random-search settings beat the defaults on all 20, even when the defaults got 10.6× the scans per run.
Running untrusted code
LLM-written programs run under a deny-by-default macOS sandbox: no network, no child processes, writes only to a scratch folder, and limits on CPU, memory and time. An independent guardian kills and cleans up any candidate that outlives its evaluator.
Capped spending
Only a local metering proxy holds the API key. It reserves each request's worst-case cost before forwarding it, settles the real usage afterward, and stops at the run's budget or a shared $50 cap.
Fair comparisons
The protocol was frozen before any evaluation, tuning and held-out seeds never overlap, every arm gets the same scan budget, and results are paired by seed with exact sign tests. A stricter control also gives the defaults the tuning's compute.
Results you can trust
Every construction is re-checked by the verifier, every evaluation's certificate is kept, and offline runs replay exactly from their recorded configuration and seed.
nimbleprobe
NimbleProbe
security
agentic red-team simulation
Python · Containers · Local LLM
An agentic red-team simulation framework: a local LLM plans investigations from real host telemetry inside a containerized lab, then writes a remediation report.
https://spuz.me/blog/zine/n4753c_h4ck47h0n_2
AI Dialogue Mapping Platform
ai
deployed AI system
ai-dialogue-mapping-platform
ai systems
A deployed platform that interviews each participant before a difficult group conversation, maps where they agree and disagree, and hands the facilitator a brief.
full-stack web
LLM prompting
structured synthesis
People walk into hard conversations with disagreements they haven't named. They use the same word to mean different things, hold different assumptions, and guess wrongly about what others think. Facilitators usually discover this halfway through the meeting.
Before the meeting, each participant has a short adaptive interview with an LLM that follows up on what they actually said. Answers are stored in a structured form, tagged by the concepts they touch, so participants can be compared concept by concept. The platform then pulls out shared ground, real tensions, and words people define differently, and writes a facilitator brief that keeps minority views visible.
Adaptive intake
Each follow-up builds on the previous answer, so a vague reply gets a concrete second question instead of the next item on a script.
Structured answers
Every answer is stored with the concepts it touches and the participant's stance, not as a wall of text.
Concept by concept
Lining participants up on the same concept shows agreement, disagreement, and words that mean different things to different people.
Facilitator brief
Shared ground, tensions, definition gaps, and questions to open with, ready before the meeting starts.
Uneven depth
Some people write a paragraph and others a word, and the comparison can't favor whoever wrote more.
Minority views
A view held by one person can matter most in the room, so the synthesis must never average it away.
Not flattening disagreement
A summary that makes everyone sound aligned is worse than no summary at all.
Usable fast
The facilitator needs something readable minutes before the meeting, not a dashboard to study.
Sanctions-Evasion Network Analysis
data
intelligence workflow
sanctions-evasion-network-analysis
data tools
An entity-graph workflow that takes an analyst from a single name to the hidden relationships, risk indicators, and a briefing-ready explanation.
graph analysis
analyst UI
entity resolution
Sanctions evasion hides in relationships: a customer's vessel meets another at sea, that vessel's owner shares a director with a listed company. Analysts usually see these as disconnected tables, which makes the path hard to find and harder to explain to a reviewer.
A workflow that connects entity, trade, and financial relationships into one graph organized around the steps an investigation actually takes: search for a name, expand its connections, inspect each entity, triage the paths by their risk indicators, and summarize the finding as a brief. The demo runs on synthetic data so nothing sensitive is exposed.
One graph
Companies, vessels, people, and banks become nodes; ownership, directorships, payments, and transfers become edges.
Step-by-step expansion
The graph grows outward one hop at a time, so it stays readable as the investigation widens.
Risk indicators
Shared addresses, transfers at sea, transponder gaps, and free-zone ownership are flagged where they occur.
Briefing output
The path, the evidence, and the open questions are summarized for a reviewer.
Ambiguous names
Entities with similar names have to be told apart before any path is trusted.
Clutter
Dense graphs bury the important path, so expansion is deliberate and paths are highlighted.
False positives
A path to a listed entity is a lead, not a verdict, and the brief has to say what still needs checking.
Explainability
Every conclusion has to trace back to specific relationships a reviewer can verify.
x-devrel-pulse
X DevRel Pulse
data
developer intelligence · signal classification
data tools
Turns public developer posts about the X API into ranked, explainable triage signals: what is broken, how badly, who should own it, and what to ask the developer next.
Python
X API
SQLite
xAI / Grok
github
https://github.com/reedyalouh2/x-devrel-pulse
Developer posts mix production outages with tutorials, praise, and idle questions. A DevRel or platform team needs to find the few posts where someone is actually blocked, understand the problem, and route it to the right owner without reading everything.
A pipeline that pulls posts through X API Recent Search (or an offline set), classifies each one with a deterministic rule engine, stores the structured signals in SQLite, and ranks the highest-signal issues, with an optional Grok summary on top. The classifier scores topic, pain, and severity separately, so "love the new API" and "losing events in prod" can never land in the same bucket, and every decision carries the evidence that produced it.
Topic
Weighted rules per category, from 5 for a defining phrase like next_token to 1 for shared vocabulary. Each rule fires once per post, so repeating a word cannot inflate a score.
Pain and severity
Separate rule sets detect whether the author is blocked (errors, regressions, confusion) and how bad it is (production impact, a blocked launch, lost data).
Score and urgency
Pain is 40% topic strength, 35% pain signals, and 25% severity, discounted when a topic is only mentioned or the post reads like promotion.
Routing
Each category maps to an owner (Docs, SDK, Platform, Support, or GTM), a fix to ship, an action, and a follow-up question; production impact escalates the action.
'author' is not 'auth'
Word-boundary rules keep substrings like author from triggering the auth category; the evaluation has a case for exactly this trap.
Mentions are not pain
A post that only mentions a topic is discounted, so tutorials and praise stay at low urgency.
Posts with two problems
A second category has to reach 35% of the primary's score and an absolute floor, so real secondary issues appear without noise.
Explainability
Every signal lists the evidence it matched and a rationale, so a reviewer can see why a post was routed where it was.
Sequential Game Analysis Infrastructure
research
research engineering
sequential-game-analysis-infrastructure
research tooling
Rust and Python infrastructure for solving adversarial, turn-based games by exhaustive search, and for making the results readable.
Rust
Python
state-space search
memoization
Solving a game means searching every position reachable from the start, and that space grows explosively. Raw solver output is also hard to read: knowing a position is a win says little about what a strategy looks like or why it works.
Compact state encodings so positions are cheap to store and compare, exhaustive search that classifies every position as a win, loss, or draw for the player to move, and caching so positions reached by different move orders are solved only once. Evaluation utilities and visualizations then turn the solved space into views of strategy, outcomes, and policy structure.
State encoding
Each position is packed into a compact key, which makes caching and duplicate detection cheap.
Exhaustive search
Every reachable position is visited and labeled a win, loss, or draw under perfect play.
Avoiding repeated work
A cache of solved positions means a position reached by many move orders is solved once.
Readable output
Outcome classes and strategy comparisons are rendered as views instead of raw tables.
State explosion
Even modest games have far too many positions for naive search, so every redundancy matters.
Duplicate positions
Different move orders reach the same position, and symmetric positions behave identically.
Interpretability
A solved game is millions of labels; turning that into insight takes deliberate visualization.
Very large trees
Views have to summarize structure without trying to draw every node.
Multilingual Review Classification System
ai
applied ML system · multilingual classification · analyst triage
multilingual-review-classification-system
ai systems
A text classifier that sorts noisy, emoji-heavy social posts in English, Spanish, and Korean into homegoods, beauty, or other.
Python
scikit-learn
TF-IDF
SMOTE
linear SVM
Posts exported from Instagram and Reddit arrive messy: titles and bodies in separate columns, emoji that carry meaning, links and handles that add noise, labels named differently in every dataset, and far fewer beauty posts than anything else. A classifier trained on that as-is learns the noise and neglects the smallest class.
A pipeline that cleans the data before any modeling. It merges title and body into one input, turns emoji into words so they still count, strips links and handles, maps every dataset's labels onto three categories, and drops English and Spanish filler words. The text becomes TF-IDF features over single words and word pairs, SMOTE rebalances the classes, and a linear SVM is trained and evaluated on stratified splits for each language.
Emoji as words
A lipstick or frying-pan emoji is often the clearest signal in a short post, so emoji become words instead of being thrown away.
Words and pairs
TF-IDF over single words and two-word pairs keeps phrases like "lip tint" together and down-weights words that appear everywhere.
Rebalancing
SMOTE synthesizes extra examples of the smaller classes so the model doesn't learn to ignore beauty posts.
Linear SVM
A linear separator suits sparse, high-dimensional text features and stays quick to retrain as data grows.
Overlapping categories
Homegoods shares everyday shopping language with both other categories: in Spanish it blurs with other, in Korean with beauty.
A small beauty class
With the fewest examples, beauty recall could suffer while overall accuracy still looked fine, so every class is scored on its own.
Three languages, three schemas
The Spanish and Korean exports used different columns and label names, so each needed its own cleanup before the shared pipeline.
Platform shift
Reddit posts are long and descriptive while Instagram captions are short and emoji-heavy, and one model has to handle both.
2048 Game Logic Engine
software
game logic · state transitions
2048-game-logic-engine
software design
The core logic of 2048 in Java: tilting the board, merging tiles, scoring, and detecting when the game is over.
Java
game logic
state transitions
2048 looks simple, but its rules are subtle. Tiles slide as far as they can, equal tiles merge, a tile created by a merge can't merge again in the same move, and the game has to know when no move is left.
Every tilt is broken into four independent lines, each read from the edge the tiles move toward. One short routine handles a line: drop the gaps, merge equal neighbors once, and pad with blanks. A direction mapping turns the same routine into all four moves, and separate checks find empty cells, the largest tile, and whether any move remains.
Lines, not tiles
Treating a tilt as four one-dimensional lines keeps every rule in one place instead of spread across many cases.
Merge once
A merge consumes both tiles, so the new tile is never compared again in the same tilt.
Direction mapping
Each direction only changes which cell is the leading edge, so one routine serves all four.
End of game
The game ends when the board is full and no two neighbors are equal.
Three in a row
Three equal tiles merge into one doubled tile and one unchanged tile, not a single tile.
Four in a row
Four equal tiles make exactly two merges.
Moves that change nothing
A tilt that doesn't move anything shouldn't count as a move or add a tile.
Scoring
Each merge adds the new tile's value, and only once per merge.
Deque Data Structure Library
software
data structures
deque-data-structure-library
software design
A generic double-ended queue in Java, built twice: as a circular, resizing array and as a doubly linked list with a sentinel.
Java
generics
data structures
The same interface, add and remove at either end, can sit on very different memory layouts. Each has its own traps: an array has to wrap around and resize without losing order, and a linked list has to handle empty and one-item cases without special code everywhere.
Two implementations behind one generic interface. The array version keeps a front index and maps item i to slot (front + i) mod capacity, doubling when full and halving when a quarter or less is used. The linked version uses a circular sentinel so every add and remove rewires the same way. Both support iteration and equality by contents, and a max variant takes a comparator.
Circular indexing
The front and back wrap around the array, so adding or removing at either end is one write.
Geometric resizing
Doubling when full and halving when sparse keeps every operation fast on average and memory proportional to size.
Sentinel node
A permanent node before the first item and after the last removes the special cases for empty lists.
Equality by contents
Two deques are equal when they hold the same items in order, whichever way they're stored.
Wraparound
Indices that run off either end of the array have to wrap correctly in both directions.
Order across a resize
Copying into a bigger or smaller array must keep the items in their logical order.
Stale references
Removed slots are cleared so the deque never keeps old objects alive.
Removing to empty
Going from one item to none has to leave both structures valid and reusable.
Linguistic Analytics Engine
data
time series + graph backend
linguistic-analytics-engine
data tools
A Java engine that combines word-usage history with a graph of word meanings to answer questions like “which kinds of animal were written about most between 1900 and 1950?”
Java
time series
directed graphs
HTTP
How often a word was used over time is a time series. How words relate in meaning, like a beagle being a kind of dog, is a graph. Interesting questions need both at once, without flattening either one.
Three layers. A time-series layer parses yearly word counts and normalizes them by the total words written each year. A graph layer builds a directed graph of synonym sets and their “is a kind of” links, handling words that appear in several sets. A query layer intersects the more specific terms under several words and ranks them by usage over a chosen range of years. A command-line tool and a small HTTP server built on the standard library sit on top.
Normalized history
Raw counts are divided by the total words written each year, so years with more text don't drown out the rest.
Graph of meanings
Each synonym set is a node, and edges point from a general term to more specific ones.
Shared terms
Queries over several words keep only the terms that sit under every one of them.
Ranking
Results can be cut to the k most-used terms over a range of years, then listed alphabetically.
Words with several meanings
One word can belong to several synonym sets, and every one of them has to be searched.
Duplicates
Different paths through the graph can reach the same word, which must appear only once.
Missing years
Words absent in some years still need consistent sums and comparisons.
Defensive copies
Histories are returned as copies, so callers can't accidentally change the stored data.
Procedural World Generation Engine
software
game systems · large codebase
procedural-world-generation-engine
software design
A seeded tile-world engine in Java that generates explorable maps of rooms and hallways, with movement, collision, and save and load.
Java
procedural generation
seeded randomness
game state
A generated world should feel random, yet the same seed must rebuild exactly the same map, or nothing can be tested or reloaded. The layout also has to stay playable: rooms can't overlap, every room must connect, and walls have to enclose every walkable tile.
All randomness flows from one generator seeded from the input, so room sizes, placements, and hallway turns are fully determined by the seed. Rectangular rooms are placed without overlap, joined by width-one L-shaped hallways, and wrapped in walls. An avatar and target are placed on the floor, movement checks for collisions, and the game state saves and reloads into the same world.
One seeded source
Every random decision draws from the same seeded generator, so a seed is a complete description of a world.
Rooms and hallways
Rooms are placed only where they don't overlap, then consecutive rooms are joined by L-shaped hallways.
Walls
Every walkable tile gets walls around it, so the world is always enclosed.
Play and persistence
Scripted inputs drive movement for repeatable testing, and saving stores just the seed and positions, enough to rebuild everything.
Overlapping rooms
Candidate rooms that collide with existing ones are rejected, which shapes how dense a map can get.
Connectivity
A validator confirms every floor tile is reachable, so no room is ever cut off.
Exact replays
Any extra or reordered random call changes the whole world, so the order of decisions is fixed.
Movement
Moves into walls are ignored, and the avatar can never leave the walkable area.
Hog Strategy Simulator
ai
simulation · decision strategy · higher-order functions
hog-strategy-simulator
ai systems
A simulator for a two-player dice race to 100, and strategies that read both scores to decide how many dice to roll, including when to roll none at all.
Python
Monte Carlo simulation
higher-order functions
Each turn a player chooses how many dice to roll, from zero to ten. More dice raise the total but risk a bust: a single 1 makes the whole turn worth 1 point. Rolling zero dice scores from the digits of both players' scores, and landing on certain numbers jumps a player ahead to the next prime. The rules interact, so the best move depends on both scores, not just the odds.
The rules as small functions that compose. Dice are zero-argument functions, so fair dice and scripted test dice are interchangeable, and a strategy is any function from the two scores to a number of dice. An averaging wrapper replays any function thousands of times to estimate its expected value, which drives the sweeps over dice counts and the win rates between strategies. The final strategy checks the zero-dice payoff first, including any prime jump, then plays safer while ahead and riskier while behind.
Turn rules
Rolling scores the sum unless a 1 appears. Rolling zero dice scores three times the gap between the opponent's tens digit and your ones digit, and at least 1.
Prime Jump
After every turn, a score with exactly three or four factors jumps to the next prime.
Strategies as functions
Each strategy maps the two scores to a number of dice, so strategies can be built, wrapped, and compared like any other value.
Monte Carlo evaluation
An averaging wrapper replays a turn or a whole game thousands of times to estimate expected scores and win rates.
Rules that interact
A zero-dice payoff can land on a jump number, so a move's true value is only known after both rules apply.
Risk versus average
Six dice give the best average turn, but with a lead a smaller, safer gain can be the better move.
Fair comparisons
Going first is an advantage, so every match-up is played from both seats and averaged.
Digit edge cases
Equal digits make zero dice worth 1 rather than 0, and scores under 10 have a tens digit of 0.
Typing Autocorrect & WPM Tool
software
text processing · UX logic
typing-autocorrect-and-wpm-tool
software design
A typing-speed test with live accuracy and words-per-minute scoring, plus an autocorrect that fixes near-miss words without touching unrelated ones.
Python
string algorithms
recursion
A typing tool has to measure people fairly, counting speed and accuracy the same way every time, and its autocorrect has to fix obvious slips without “correcting” words that were typed on purpose.
Accuracy compares typed words position by position against the prompt, and speed counts every five characters as a word. Autocorrect measures how far a typed word is from each dictionary word using recursive difference functions, picks the closest, and leaves the word alone when even the closest is beyond a set limit. Progress reports support racing several typists at once.
Words per minute
Every five typed characters count as one word, divided by the elapsed minutes.
Accuracy
Each typed word is compared with the prompt word in the same position.
Edit distance
The fewest single-letter swaps, insertions, and deletions that turn one word into another.
Correction limit
Only words within the limit are corrected; anything farther is left as typed.
Pruning the search
Recursive difference functions stop early once a word is already past the limit, instead of exploring every edit.
Ties
When two words are equally close, the earlier one in the word list wins, so results are predictable.
Extra or missing words
One skipped word shifts every later comparison, and the score has to handle that consistently.
Case and punctuation
Input is normalized so capitalization and stray symbols don't count as typos.
Ants Tower Defense Engine
software
object-oriented game system
ants-tower-defense-engine
software design
The game logic for a tower-defense game in Python, where ants defend a colony from bees, built as a set of interacting classes.
Python
object-oriented design
inheritance
game loops
The game's behavior comes from many kinds of objects acting on each other: places linked into tunnels, ants with different costs and abilities, bees that move and sting, food, and win and loss conditions. Adding a new kind of ant shouldn't mean rewriting the turn loop.
A class hierarchy where shared behavior lives once: every insect has health and a place, every ant has a cost and blocks bees in its place, and each specialized ant overrides only its action or its stats. Places form linked tunnels from the colony to the hive. A turn loop lets every ant act, then every bee, then checks whether the colony or the bees have won.
Linked places
Each place knows the next one toward the colony, so movement and range checks walk the tunnel.
Inheritance
Subclasses change only what makes them different, such as a thrower's range or a wall's health.
Targeting
Throwers search outward from their place for the nearest bee within their range.
Containers
Some ants can hold another ant in the same place and protect it from stings.
Several bees in one place
Targeting and damage need consistent rules when bees share a place.
Removing insects mid-turn
An insect that dies during a turn must leave the board without breaking the loop that's iterating over it.
Range limits
Short- and long-range throwers ignore bees outside their range.
Protection
A container and the ant it holds must interact correctly when either one is hurt or removed.
Scheme Interpreter
systems
programming languages
scheme-interpreter
low-level systems
A Scheme interpreter in Python, built around the classic read, eval, apply loop, with lexical and dynamic scope, special forms, and a REPL.
Python
interpreters
parsing
environments
An interpreter has to turn text into data, then evaluate that data in the right environment. Procedure calls create new frames, special forms like if and define must not evaluate their arguments the normal way, and scope rules decide which binding a name refers to.
A tokenizer and parser that turn source into nested pairs, an environment model of chained frames, and a recursive eval/apply pair at the core. Eval looks up symbols, returns self-evaluating values, dispatches special forms, and otherwise evaluates the operator and operands before handing them to apply. Apply runs built-ins directly, and user procedures by creating a child frame and evaluating the body there.
Read
Source becomes tokens, then nested pairs, so code and data share one representation.
Eval
Symbols are looked up through the chain of frames; combinations evaluate their operator and operands, then apply.
Apply
A user procedure gets a new frame binding its parameters, then its body is evaluated in that frame.
Two kinds of scope
A lambda's frame extends the frame where it was defined; a mu procedure's frame extends the frame it was called from.
Special forms
define, if, cond, let, and, or, and quote each control which parts get evaluated, so they bypass normal evaluation.
Frame parents
Which frame a new frame points to is the entire difference between lexical and dynamic scope.
Arity and errors
Calling a procedure with the wrong number of arguments, or an unknown name, must raise a clear error instead of crashing.
Higher-order built-ins
map, filter, and reduce call back into the interpreter's own apply for every element.
Snake Engine in C
systems
C systems · game engine
snake-engine-in-c
low-level systems
A C engine that rebuilds Snake games from plain-text boards, advances them one tick at a time, and never reads past the end of a row, even when every row is a different length.
C11
heap memory
file I/O
Make
A board is just text: walls, food, and snakes drawn with direction characters, and its rows can be different lengths. The engine has to rebuild the game's state from that text, update it in place every tick, and write it back out exactly. In C, a short row or a missed free is a silent memory bug, not an exception.
The board is held as a char** with every row allocated separately, so ragged boards need no padding. Snakes are never listed in the file: the engine finds each tail, follows the direction characters to the head, and records the result in a snake_t. Each tick moves every live snake, grows it on food, kills it on a wall, a body, or a cell past the end of a row, and advances the tail only when the snake didn't eat. One cleanup path frees every row, the row array, and the snake records.
Ragged rows
Each row keeps its own length, and every read goes through a bounds check against that row, so a missing cell behaves like a wall.
Snakes from characters
A tail (w a s d) starts a walk; body characters (^ < v >) point to the next segment until the walk reaches the head (W A S D).
One tick
Read the head's direction, compute the target cell, classify it as empty, food, or collision, rewrite the old head as body, then place the new head or mark it dead with x.
Ownership
The engine owns every row buffer, the row array, and the snake array, including temporary rows during loading; game_free releases all of them.
Reading past a short row
Space beyond a row's end is not memory to read. The engine treats it as a collision, as the ragged run shows.
Growth versus movement
Eating has to leave the tail in place for exactly one tick, or the snake grows by the wrong amount.
Several snakes
Each snake keeps its own record, so moving one never corrupts another; a head-on meeting kills both.
Exact round trips
Saving must preserve every space and row length so a board reloads identically.
RISC-V Handwritten Digit Classifier
systems
assembly · ML systems
risc-v-handwritten-digit-classifier
low-level systems
A handwritten-digit classifier's inference pass written entirely in RISC-V assembly: matrix loading, multiplication, ReLU, and argmax, with every load, call, and allocation explicit.
RISC-V assembly
calling convention
heap memory
binary file I/O
In a high-level language, running a small neural network is a few lines. In assembly, every matrix has to be read from a file into memory you allocated, every function call has to save and restore the right registers, and every bad dimension or failed allocation needs a defined exit code.
A set of small kernels — absolute value, ReLU, argmax, a strided dot product, and matrix multiplication built on it — plus loaders and writers for binary matrix files. A top-level classify routine chains them: hidden = ReLU(m0 · input), scores = m1 · hidden, and the class is the argmax of the scores. Each function follows the RISC-V calling convention and validates its arguments.
Strided dot product
One kernel walks two vectors with independent strides, so the same code reads a matrix row or a column.
Matrix multiplication
Built from the dot product: each output cell is a row of the left matrix dotted with a column of the right.
Binary matrix files
Matrices are read from files into heap memory sized from their header, and results are written back the same way.
Classification
ReLU zeroes negative hidden values in place, and argmax returns the first index of the highest score.
Calling convention
Nested calls must save exactly the registers the convention requires, or a caller's values are silently corrupted.
Memory management
Every matrix is heap-allocated, so failed allocations are caught and every buffer is freed on every path.
Error paths
Mismatched dimensions, bad lengths, and failed file reads each exit with their own defined code.
Ties
argmax has to return the first index when scores tie, which takes care in the comparison.
RISC-V CPU Datapath
systems
computer architecture
risc-v-cpu-datapath
low-level systems
A RISC-V CPU built gate by gate in Logisim that runs real programs: program counter, instruction memory, register file, ALU, immediate generation, branches and jumps, data memory, and control logic.
Logisim
RISC-V
digital logic
computer architecture
A processor has to turn 32 bits of instruction into the right actions: which registers to read, which immediate to build, what the ALU computes, whether memory is read or written, what gets written back, and where the program goes next. Every one of those choices is a wire and a control signal that has to be set correctly for every instruction.
A datapath of standard blocks connected through multiplexers, with control logic that decodes each instruction's opcode and function bits into the settings for every mux, the ALU, memory, and the register file. Branch comparison and jump targets feed the next-PC logic, and immediate generation handles each instruction format's scattered bits.
Fetch
The program counter addresses instruction memory, and PC + 4 is ready as the default next address.
Decode
Register numbers are read from fixed bit positions, and the immediate generator reassembles each format's bits.
Execute
The ALU combines a register or the PC with a register or an immediate; branches compare two registers.
Memory and write-back
Loads and stores use the ALU's address, and a mux picks the ALU result, loaded data, or PC + 4 to write back.
Immediates
Branch and jump formats scatter their immediate bits across the instruction, and they have to be reassembled and sign-extended exactly.
Branch targets
Targets are relative to the current PC, so the ALU input has to switch between a register and the PC.
Control conflicts
Every control signal must have a defined value for every instruction, or two paths fight over a wire.
Write-back source
Choosing between the ALU result, memory, and PC + 4 is a common source of subtle bugs, especially for jumps.
Vectorized C Matrix Library
systems
performance engineering
vectorized-c-matrix-library
low-level systems
A NumPy-style matrix library in C, sped up with SIMD vector instructions, OpenMP threads, and smarter algorithms.
C
SIMD intrinsics
OpenMP
memory management
Matrix operations are easy to write and slow by default. Real speed depends on how the data is laid out in memory, how many elements each instruction handles, how work splits across cores, and whether the algorithm does more multiplications than it needs to. Slices add a memory question: several matrices can share one block of data.
Matrices stored row-major in a single allocation, with slices that point into their parent's data and a reference count so memory is freed exactly once. Element-wise operations, multiplication, and exponentiation were then optimized: vector instructions process several values per step with a scalar loop for the leftovers, outer loops are split across threads, and powers are computed by repeated squaring.
Row-major storage
Element (i, j) lives at index i × columns + j in one flat array, so walking a row reads consecutive memory.
Shared slices
A slice points into its parent's data instead of copying it, and a reference count tracks how many matrices use that memory.
Vectors and threads
SIMD handles several elements per instruction, and OpenMP splits rows across cores.
Fast powers
Repeated squaring computes A^n with work proportional to the number of bits in n, not n itself.
Leftover elements
When a row's length isn't a multiple of the vector width, the remainder needs its own scalar loop.
Slice lifetimes
Freeing a parent while a slice still uses its data must not release the memory early.
Allocation failures
Every allocation can fail, so each operation checks and reports errors instead of crashing.
Edge cases
Invalid dimensions and powers of 0 and 1 all need defined results.
Pacman Search Planner
ai
graph search · path planning
pacman-search-planner
ai systems
Search agents that plan Pacman's route through a maze with depth-first, breadth-first, uniform-cost, and A* search, plus state designs for visiting every corner and eating every dot.
Python
graph search
heuristics
Getting Pacman to a goal is a search problem, but the right search depends on the question. The fewest moves, the cheapest route over costly ground, and a route that visits all four corners or eats every dot each call for a different algorithm or a different idea of what a state is.
One graph-search loop with a pluggable frontier: a stack for depth-first, a queue for breadth-first, and a priority queue for uniform-cost and A*. Each search keeps an explored set and rebuilds the path from parent links. Beyond reaching a single point, I designed search problems whose states carry memory, such as which corners have been visited or which food remains, and wrote heuristics that keep A* optimal while expanding far fewer states.
Frontiers
The same loop becomes four algorithms by changing how the next state is chosen: newest, oldest, cheapest, or cheapest plus an estimate of what remains.
Explored set
Each state is expanded at most once, which turns tree search into graph search and stops cycles.
Richer states
For the corner and food problems a state is a position plus what has been collected, so the same search answers a harder question.
Heuristics
Manhattan and true maze distances estimate the remaining cost without ever overestimating it, which keeps A* optimal.
Admissible and consistent
A heuristic that overestimates even once can make A* return a worse path.
State explosion
Tracking the remaining food multiplies the number of states, so the heuristic has to do real work.
Moves versus cost
Breadth-first finds the fewest moves, which is not the cheapest route when some cells cost more.
Repeated states
Without an explored set the search can loop forever between neighbouring cells.
Pacman Multi-Agent Planner
ai
adversarial search · game-tree planning
pacman-multi-agent-planner
ai systems
Game-playing agents that choose Pacman's moves while the ghosts move too, using minimax, alpha-beta pruning, expectimax, and a hand-built evaluation function.
Python
minimax
alpha-beta
expectimax
Once the ghosts move too, Pacman's best move depends on what they will do. If a ghost plays perfectly, Pacman should guard against the worst case; if it moves at random, that caution throws away points. The search also has to stop somewhere, so an unfinished board still needs a score.
A multi-agent search that alternates between Pacman, who maximizes, and every ghost in turn, who minimizes, counting depth only after all agents have moved. Alpha-beta pruning cuts branches that cannot change the decision, and expectimax replaces the minimizing ghosts with chance nodes that average their moves. A feature-based evaluation function scores unfinished boards from food, capsules, and ghost distances.
Turn order
Each ply cycles through Pacman and then every ghost; depth increases only when the cycle completes.
Pruning
Alpha-beta tracks the best value each side can already guarantee and stops exploring a move once it can't matter, without changing the result.
Chance nodes
Expectimax averages over the ghosts' moves, so Pacman takes sensible risks against ghosts that don't play perfectly.
Evaluation
A weighted score of nearby food, remaining food and capsules, active ghosts close by, and scared ghosts within reach.
Depth with many agents
Every ghost adds a layer to each ply, so each extra level of lookahead gets expensive quickly.
Scared ghosts
A ghost that is dangerous one moment is worth chasing the next, so the evaluation has to flip how it treats them.
Standing still
Stopping can look safe to the search, so it needs a small penalty.
Wins and losses
Terminal states end the search early and must outrank any ordinary evaluation.
Reinforcement Learning Agents
ai
MDPs · RL
reinforcement-learning-agents
ai systems
Agents that learn how to act in an uncertain grid world: planning with value iteration when the rules are known, and learning with Q-learning when they are not.
Python
MDPs
value iteration
Q-learning
When moves sometimes slip, the best action depends on long-term consequences, not just the next step. An agent that knows the rules can plan ahead; one that doesn't has to learn by trial and error, balancing trying new actions against using what it already knows.
A value-iteration agent that runs batch Bellman backups over every state, derives Q-values from the values, and extracts a greedy policy. A Q-learning agent that learns the same Q-values from sampled moves with epsilon-greedy exploration, and an approximate version that learns feature weights so it generalizes to states it has never seen. I also tuned discount, noise, and the reward per step to produce specific target behaviors.
Bellman backups
Each sweep updates every state from the previous sweep's values, so value spreads one step further from the exits each time.
Q from values
An action's worth is the expected reward plus the discounted value of wherever it might land, slips included.
Learning from experience
Q-learning nudges each estimate toward the reward it just received plus the best estimate from the next state.
Approximate Q-learning
Describing states with weighted features lets what is learned in one state carry over to similar ones.
Exploration
Too little exploration locks in a bad habit; too much never makes use of what was learned.
Shaping behavior
Small changes to discount, noise, or the reward per step flip whether the agent takes a risky shortcut or plays safe.
Unseen actions
Untried actions start at zero, so tie-breaking decides how the agent behaves early on.
Planning versus learning
Learned values only approach what planning computes once there has been enough experience.
Probabilistic Ghost Tracking
ai
Bayes nets · HMM inference
probabilistic-ghost-tracking
ai systems
Inference agents that track invisible ghosts from noisy distance readings, using exact Bayesian updates over time and a particle filter that scales to several ghosts at once.
Python
Bayes nets
hidden Markov models
particle filtering
Pacman can't see the ghosts. Each turn it hears a noisy reading of how far away each one is, and the ghosts keep moving. Tracking them means keeping a belief over every possible position and updating it correctly as time passes and new evidence arrives.
Factor operations for Bayes nets (join, eliminate, normalize) and variable elimination for answering queries. For tracking over time, an exact filter that alternates a time step (where could the ghost have moved?) with an observation step (how likely is this reading from each position?), and a particle filter that represents the belief with samples so it scales to several ghosts.
Time passes
Each position's probability spreads over the cells the ghost could move to next.
A reading arrives
Every position is weighted by how likely the reading would be from there, then the belief is renormalized.
Particles
Samples stand in for the belief: move them like the ghost, weight them by the reading, and resample.
Variable elimination
Queries on a Bayes net join and sum out factors in a good order instead of building the full joint table.
Zero-weight collapse
If every particle gets weight zero, the filter has to start over from a uniform belief instead of dividing by zero.
Captured ghosts
A ghost sent to jail has a known position, which has to override what the sensor says.
Several ghosts
Tracking ghosts jointly multiplies the number of states, which is where the particle filter earns its keep.
Staying normalized
The belief has to remain a valid probability distribution after every update.
Neural Models for Classification
ai
machine learning
neural-models-for-classification
ai systems
Neural networks built up from the basics in PyTorch: a perceptron, a regression network, digit and language classifiers, a hand-written convolution, and an attention layer.
Python
PyTorch
neural networks
Different tasks need different architectures. Classifying handwritten digits, fitting a smooth function, and telling which language a word comes from each need the right inputs, layers, loss, and training loop before a model learns anything useful.
A progression of models, each with its own training loop, loss, and validation: a perceptron that learns a linear boundary, a regression network that fits a continuous function, a multilayer digit classifier, a recurrent model that reads words character by character to identify their language, a convolutional digit model built on a convolution I implemented by hand, and an attention layer.
Perceptron
Updates its weights only on mistakes, and converges whenever the classes can be split by a line.
Deeper networks
Stacked layers with nonlinearities learn curved boundaries that a single layer can't.
Characters to language
A recurrent model folds a word's characters into one hidden state, so words of any length get a fixed-size summary.
Convolution and attention
A hand-written convolution slides a small filter across an image; attention lets a model weigh which inputs matter most.
Overfitting
A network can memorize its training data, so validation accuracy decides when to stop.
Learning rates
Too high and training diverges; too low and it crawls.
Variable-length input
Words have different lengths, so batches have to be shaped with care.
Imbalanced classes
Rarer languages and digits pull less weight during training unless that is accounted for.
Memory Safety Exploitation Lab
security
binary exploitation · stack internals
memory-safety-exploitation-lab
security
A study of six classic memory-safety bug classes in C, each examined at the stack level and mapped to the defense that prevents it.
C
x86
GDB
stack internals
Memory-safety bugs remain among the most damaging flaws in C and C++ software, and each one comes down to a single wrong assumption: a length believed to be bounded, a buffer believed to be large enough, a string believed to be plain data. Understanding them well enough to prevent them means looking at the stack directly, not just reading about it.
Six deliberately vulnerable teaching programs, each isolating one bug class. For each, I identified the assumption the code got wrong, confirmed the stack layout in a debugger, and matched the class to the mitigation that closes it. The work is defense-oriented: the goal is the intuition for writing and reviewing safe code.
Anatomy of a frame
A function's local buffer sits just below the stack canary, the saved frame pointer, and the saved return address, the data a function needs to return safely.
One class, one weak spot
Each bug class puts a different part of the frame at risk, which is what decides the right fix.
Secrets behind defenses
A stack canary only works while its value stays secret, so a memory leak is itself a vulnerability.
Defense in depth
Bounds checks, canaries, address randomization, and a non-executable stack each block a different step, so no single bug is enough.
Signed lengths
A length check is only as strong as its type. Lengths should be unsigned and checked against both bounds.
Off-by-one
A single ≤ where < was meant is enough to corrupt saved state, which is the case for bounds-checked APIs over hand-written loops.
Format strings
User text must never be used as a format string. The fix is printf("%s", input), a two-character change.
Leaks undo layers
Canaries and address randomization both depend on secrets staying secret, so preventing leaks protects every other layer.
Cryptographic File Sharing System
security
secure storage · applied cryptography
cryptographic-file-sharing-system
security
An end-to-end encrypted file storage and sharing client that stays secure even when the server storing the data is malicious.
Go
AES
HMAC
RSA
digital signatures
Argon2
A storage service should keep files private and intact even if the server itself reads, alters, reorders, or deletes what it holds. Sharing makes it harder: people need to be able to re-share files, and someone whose access is revoked must be locked out for good, even though they once held valid keys.
A client built with a partner from basic cryptographic building blocks, with no trusted server logic. All keys descend from a password-derived root, every stored object is encrypted and then authenticated, and access control lives entirely in who holds which key. A layer of main file nodes, one per direct recipient, makes sharing and revocation simple, and files are stored as a backwards linked list so appends cost the same no matter how large the file grows.
Untrusted storage
Every object is encrypted and authenticated, so the server sees only ciphertext and any change it makes is detected on read.
One root key
Argon2 turns the password into a root key; separate subkeys protect each kind of object, and logging in simply means the keys decrypt correctly.
Sharing
Invitations are encrypted to the recipient's public key and signed by the sender, and each direct recipient gets their own main file node.
Revocation
Revoking re-encrypts the file under a fresh key given only to people still allowed, and anyone the revoked user had shared with loses access too.
A malicious server
Tampering has to fail loudly with an error, never silently hand back altered data.
Constant-cost appends
Appending must not get slower with file size, the number of files, or the number of people a file is shared with.
Revoked users keep old keys
Someone who was revoked still holds their old keys, so the file has to move to keys they never saw.
Edge cases in sharing
Revoking before an invitation is accepted, sharing twice, and revoking as a non-owner all need clear, safe outcomes.
Vulnerable Web Server Breach Lab
security
web exploitation · trust boundary analysis
vulnerable-web-server-breach-lab
security
A security review of a deliberately vulnerable file-hosting web app: six flaws across injection, cross-site scripting, and file access, each traced to the trust boundary it crossed and the fix that closes it.
HTTP
SQL
JavaScript
web security
Web apps break where user input crosses a trust boundary without being checked: into a database query, into a page's HTML, or into a file path. A single missing check at any of those points can expose other users' data or the server's own files.
A defense-oriented analysis of a teaching application in a sandboxed lab. For each of six flaws I identified the boundary where untrusted input was treated as trusted, confirmed the issue, and mapped it to the control that enforces that boundary: parameterized queries, output encoding, CSRF tokens, strong password hashing, and path canonicalization.
Map the boundaries
Browser to server, server to database, database back to the page, and server to the file system are each places where data must be checked.
Injection
Queries built by pasting in user text let that text act as SQL. Parameterized queries keep input as data.
Cross-site scripting
Text shown as raw HTML can run as code in another user's browser. Encoding output, plus a Content Security Policy, prevents it.
Files and passwords
Paths are resolved and confirmed to stay inside the files folder, and passwords are stored with a slow, salted hash.
Filters aren't fixes
Blocking suspicious characters never reliably stops injection; the fix has to be structural.
Context matters
The same text needs different encoding in HTML, attributes, and URLs, so output encoding depends on where data lands.
Flaws compound
Each issue was small, but together they reached from an anonymous visitor to admin access, which is why every boundary matters.
Hashes leak
A database can be exposed, so password storage has to stay safe even then. Fast, unsalted hashes don't.
Traceroute Implementation
networks
packet-level networking
traceroute-implementation
networking
A from-scratch traceroute that maps the routers between you and a host by reading raw IPv4, ICMP, and UDP headers byte by byte.
Python
raw sockets
IPv4
ICMP
UDP
The internet doesn't tell you the path your packets take. Traceroute uncovers it by sending probes that expire at each router in turn, but the replies arrive over a best-effort network: they get lost, duplicated, delayed, and mixed in with unrelated traffic.
Probes go out with increasing time-to-live values, up to three per hop, each on its own UDP port. Every response is parsed from raw bytes and checked before it's trusted: it must be the right kind of ICMP message, it must quote a probe sent to the target, and the quoted port must belong to a probe still waiting for an answer. The trace ends when the destination itself replies that the port is unreachable.
Expiring probes
Each router lowers a packet's TTL by one; the router where it hits zero sends back a time-exceeded error, revealing its address.
Parsing by hand
IPv4, ICMP, and UDP headers are unpacked from bytes in network order, including the split nibbles and bit fields.
Matching replies
An error message quotes the header of the probe that caused it, so a unique port per probe ties every reply to its probe.
Knowing when to stop
The destination answers with port unreachable instead of time exceeded, which marks the end of the path.
Loss
A hop can stay silent, so each TTL is retried and a missing reply never stalls the trace.
Unrelated traffic
The raw socket sees every ICMP packet reaching the machine, so anything not tied to an outstanding probe is dropped.
Duplicates
Once a probe is matched it's removed from the waiting set, so a second reply for it is ignored.
Malformed packets
Short or truncated buffers are rejected before parsing, so bad input can't produce garbage reads or a crash.
Distance-Vector Routing Protocol
networks
distributed routing
distance-vector-routing-protocol
networking
A distance-vector router, the protocol family behind RIP, that builds its forwarding table purely from what its neighbors advertise.
Python
Bellman-Ford
routing protocols
No router sees the whole network. Each one only knows its own links and what its neighbors tell it, yet every router has to agree on shortest paths, and stay correct when links go up and down. The classic failure is count-to-infinity: after a link fails, routers keep each other's stale routes alive and the cost creeps upward for many rounds.
A router that keeps, for every destination, a next hop and a total cost. It advertises its table to its neighbors, adopts any strictly better route it hears, and always trusts updates from its current next hop. Routes expire when they stop being refreshed. On top of that sit the standard defenses, each switchable: split horizon, poison reverse, route poisoning, and triggered updates, plus incremental advertisements so a quiet network stays quiet.
Bellman-Ford, distributed
Hearing “I reach D at cost c” over a link of cost l means D is reachable at c + l through that neighbor.
Trusting the next hop
An update from the neighbor you already route through always wins, even when the news is worse, because that neighbor is the authority on the path.
Expiry
A route that isn't refreshed within its time limit is removed, or advertised as unreachable so neighbors learn quickly.
Loop defenses
Split horizon and poison reverse stop a router from advertising a route back to where it came from, and triggered updates spread changes immediately.
Count to infinity
Without defenses, two routers can keep a dead route alive by trusting each other, with the cost climbing a little each round.
Ties
Equal-cost routes keep the incumbent, so paths don't flap back and forth between equally good choices.
Links going up and down
A new link triggers a full advertisement to the new neighbor; a failed one invalidates every route that used it.
Quiet steady state
Only routes that changed since the last advertisement are re-sent, so a stable network doesn't keep repeating itself.
TCP-like Reliable Transport Layer
networks
transport protocol
tcp-like-reliable-transport-layer
networking
The core of TCP: a reliable, ordered byte stream built on a network that drops, duplicates, reorders, and delays packets.
Python
TCP
RFC 793
RFC 6298
Applications expect a clean, ordered stream of bytes, but the network underneath only delivers individual packets, and not reliably. Bridging the two means naming every byte, noticing what's missing, re-sending it at the right time, and opening and closing connections cleanly.
A socket that implements TCP's connection state machine, 32-bit sequence numbers that compare correctly across wraparound, in-order delivery with buffering for early arrivals, acknowledgement processing with a retransmission queue, an adaptive retransmission timer from RFC 6298, and the full teardown handshake for both sides.
Sequence numbers
Every byte has a number, and comparisons use modular arithmetic so they stay correct when the 32-bit space wraps around.
In-order delivery
Segments that arrive early are buffered, and the receiver keeps acknowledging the last in-order byte until the gap is filled.
Retransmission queue
Sent segments wait in a queue until acknowledged; each ACK releases everything it covers and feeds a round-trip sample to the timer.
Adaptive timer
The timeout tracks the smoothed round-trip time plus its variation, and doubles after each timeout.
When is a packet lost?
Re-sending too early floods the network; too late stalls the connection. The timer has to adapt to each connection.
Wraparound
Ordinary integer comparisons break when sequence numbers wrap, so every comparison goes through modular operators.
Teardown
A FIN takes up a sequence number and must itself be acknowledged and retransmitted, through several closing states.
Duplicates
Data that arrives twice, or partly overlaps what was already received, must be trimmed so the app never sees a byte twice.
systems
systems & computation
210
175
von Neumann
the root layer of everything: computation, game theory, nuclear strategy, and machine intelligence as one continuous problem.
https://en.wikipedia.org/wiki/John_von_Neumann
Turing
the origin of computation, AI, and codebreaking, and the question still unanswered: can machines think?
https://en.wikipedia.org/wiki/Alan_Turing
Shannon
reduced communication to signal, noise, and entropy: that kind of clean reduction is rare.
https://en.wikipedia.org/wiki/Claude_Shannon
Gödel
even the most rigorous systems contain truths they can't prove from inside themselves.
https://en.wikipedia.org/wiki/Kurt_G%C3%B6del
Bellman
dynamic programming as a model of agency: every decision reshapes the state, the future built recursively from the present.
https://en.wikipedia.org/wiki/Richard_E._Bellman
Wiener
cybernetics: feedback, control, biology, and machines as one framework, before 'intelligent systems' was even a category.
https://en.wikipedia.org/wiki/Norbert_Wiener
Simon
intelligence under real constraints: bounded rationality, incomplete information, limited time.
https://en.wikipedia.org/wiki/Herbert_A._Simon
Kauffman
how order emerges from chaos with no one designing it: that question shows up everywhere once you look.
https://en.wikipedia.org/wiki/Stuart_Kauffman
strategy
strategy & conflict
790
175
Schelling
the invisible mechanics of conflict: threats, signals, and credibility move people more than raw power does.
https://en.wikipedia.org/wiki/Thomas_Schelling
Clausewitz
war as politics under uncertainty: friction, morale, and chance; conflict as fundamentally human.
https://en.wikipedia.org/wiki/Carl_von_Clausewitz
Luttwak
strategy is paradoxical: strength breeds vulnerability, victory breeds complacency, the obvious move backfires.
https://en.wikipedia.org/wiki/Edward_Luttwak
Mackinder
power at geographic scale: land, sea, chokepoints; the physical world outlasts any single leader.
https://en.wikipedia.org/wiki/Halford_Mackinder
Napoleon
strategy, speed, and administrative genius fused with historical will: the org innovations mattered as much as the battles.
https://en.wikipedia.org/wiki/Napoleon
Kissinger
diplomacy through history and tragedy: order is fragile, legitimacy matters, good intentions have limits.
https://en.wikipedia.org/wiki/Henry_Kissinger
institutions
institutions & order
210
505
Hayek
knowledge is scattered and local: no central planner can see what millions know individually.
https://en.wikipedia.org/wiki/Friedrich_Hayek
Scott
states fail when they make society legible on paper but miss how things work on the ground.
https://en.wikipedia.org/wiki/James_C._Scott
Olson
why groups stay stuck even when coordination would help everyone: the incentives are the logic, not a bug.
https://en.wikipedia.org/wiki/Mancur_Olson
Hirschman
exit, voice, loyalty: how people and institutions respond when things start breaking down.
https://en.wikipedia.org/wiki/Albert_O._Hirschman
Lee Kuan Yew
statecraft as execution: institutions, incentives, and discipline actually made real.
https://en.wikipedia.org/wiki/Lee_Kuan_Yew
nation
nation & sovereignty
790
505
Pinsker
cold and diagnostic: Jewish insecurity as a structural condition that needs power, not sympathy or patience.
https://en.wikipedia.org/wiki/Leon_Pinsker
Jabotinsky
dignity and survival require power, not appeals: hard realism about what self-determination demands.
https://en.wikipedia.org/wiki/Ze%27ev_Jabotinsky
Ahad Ha'am
national revival as a cultural and spiritual question: without that foundation the project hollows out.
https://en.wikipedia.org/wiki/Ahad_Ha%27am
Scholem
rescued Jewish mysticism from folklore into a serious tradition with real historical weight.
https://en.wikipedia.org/wiki/Gershom_Scholem
Strauss
philosophy as dangerous and layered: the real argument isn't always the surface one.
https://en.wikipedia.org/wiki/Leo_Strauss
builders
builders & technology
500
150
Licklider
imagined computers as partners in thought: augmentation, not just automation, before most knew what a computer was.
https://en.wikipedia.org/wiki/J._C._R._Licklider
Jobs
technology wins through taste, narrative, and psychology: making complexity feel simple is its own engineering.
https://en.wikipedia.org/wiki/Steve_Jobs
Thiel
secrets and monopolies: what hidden assumptions hold back progress, and what it takes to build something that lasts.
https://en.wikipedia.org/wiki/Peter_Thiel
Jensen Huang
saw the infrastructure layer first: GPUs and accelerated computing as the foundation of the AI era.
https://en.wikipedia.org/wiki/Jensen_Huang
human
history & the human
500
530
Hegel
history driven by contradiction and struggle, not smooth progress: ideas evolve through conflict.
https://en.wikipedia.org/wiki/Georg_Wilhelm_Friedrich_Hegel
Ibn Khaldun
civilization as a cycle: cohesion, conquest, luxury, decay, renewal; systems thinking in the 14th century.
https://en.wikipedia.org/wiki/Ibn_Khaldun
Feynman
real technical depth plus the instinct to cut through fake complexity: he wanted things to actually make sense.
https://en.wikipedia.org/wiki/Richard_Feynman
Book coordinates are interpretive placements, not objective measurements.
plato-republic
The Republic
Plato
-375
justice
knowledge
political order
forms
education
knowing
every fight about how to run a society is really a fight about what people are.
dostoevsky-crime-punishment
Crime and Punishment
Fyodor Dostoevsky
1866
guilt
morality
agency
conscience
alienation
meaning
you can talk yourself into almost anything on paper. living with it is the hard part.
dostoevsky-brothers-karamazov
The Brothers Karamazov
Fyodor Dostoevsky
1880
faith
freedom
evil
responsibility
family
meaning
ivan makes the best case against god i've read, and dostoevsky never cheats to beat it.
dostoevsky-underground
Notes from Underground
Fyodor Dostoevsky
1864
rationality
spite
freedom
self-consciousness
modernity
meaning
people will act against their own interest just to prove nobody controls them. i see it everywhere now.
nietzsche-zarathustra
Thus Spoke Zarathustra
Friedrich Nietzsche
1883
values
self-overcoming
meaning
morality
nihilism
meaning
basically a dare to stop borrowing your values and build your own.
nietzsche-beyond-good-evil
Beyond Good and Evil
Friedrich Nietzsche
1886
morality
perspectivism
power
truth
values
meaning
made me ask who benefits from a moral idea before asking if it's true.
machiavelli-prince
The Prince
Niccolò Machiavelli
1532
power
statecraft
strategy
legitimacy
political action
power
the first book i read that talks about power the way people actually use it.
hobbes-leviathan
Leviathan
Thomas Hobbes
1651
sovereignty
social contract
order
fear
state
power
order isn't the default. someone has to hold it together, and that costs something.
marx-manuscripts
Economic and Philosophic Manuscripts of 1844
Karl Marx
1844
alienation
labor
materialism
human nature
capital
power
the part about work making people strangers to themselves hit harder than any of the economics.
descartes-meditations
Meditations on First Philosophy
René Descartes
1641
certainty
skepticism
mind
knowledge
method
knowing
doubt everything until something won't move. great method, even if i don't buy where he lands.
hume-enquiry
An Enquiry Concerning Human Understanding
David Hume
1748
causation
induction
skepticism
experience
knowledge
knowing
we never actually see one thing cause another. i still think about that more than i should.
kant-pure-reason
Critique of Pure Reason
Immanuel Kant
1781
epistemology
categories
experience
reason
limits
knowing
your mind isn't a camera. it shapes what you see before you get a say.
kuhn-structure
The Structure of Scientific Revolutions
Thomas S. Kuhn
1962
paradigm
science
model revision
institutions
progress
knowing
science doesn't just pile up facts. it swaps out whole frameworks, and people fight it every time.
popper-conjectures
Conjectures and Refutations
Karl Popper
1963
falsification
science
criticism
knowledge
error correction
knowing
you can't prove you're right, only fail to prove you're wrong. so go looking for where you're wrong.
wiener-cybernetics
Cybernetics
Norbert Wiener
1948
feedback
control
information
communication
systems
knowing
once you see feedback loops you see them everywhere, in thermostats, people, and governments.
simon-sciences-artificial
The Sciences of the Artificial
Herbert A. Simon
1969
design
bounded rationality
systems
complexity
artificial
knowing
nobody actually optimizes. we settle for good enough, and that's how anything gets built.
scott-seeing-state
Seeing Like a State
James C. Scott
1998
legibility
state
planning
local knowledge
institutions
societies
simplify a messy system to fit a spreadsheet and you usually break the part that made it work.
anderson-imagined-communities
Imagined Communities
Benedict Anderson
1983
nationalism
identity
community
history
societies
a nation is millions of strangers who feel connected because they read the same news.
fukuyama-origins-order
The Origins of Political Order
Francis Fukuyama
2011
institutions
state
law
accountability
political development
societies
a strong state, the rule of law, and leaders who answer to someone. you need all three, and they rarely show up together.
hertzberg-zionist-idea
The Zionist Idea
Arthur Hertzberg
1959
zionism
nationhood
history
political thought
identity
societies
zionism was never one idea. it was a century of people arguing about what it should be.
pinsker-auto-emancipation
Auto-Emancipation
Leon Pinsker
1882
emancipation
nationhood
agency
security
political action
societies
nobody is coming to save you, so build it yourself. cold, but hard to argue with.
diamond-guns-germs-steel
Guns, Germs, and Steel
Jared Diamond
1997
geography
development
causation
civilization
history
societies
a lot of what looks like destiny is just geography. i don't buy all of it, but it changed my questions.
harari-sapiens
Sapiens
Yuval Noah Harari
2011
humanity
institutions
myth
cooperation
history
societies
money, nations, and companies only work because millions of people believe the same story at once.
sun-tzu-art-war
The Art of War
Sun Tzu
-500
strategy
uncertainty
deception
conflict
adaptation
power
most of the winning happens before anyone moves.
homer-odyssey
The Odyssey
Homer
-700
homecoming
identity
cunning
fate
memory
meaning
getting home takes longer than winning the war, and you're not the same person when you get there.
homer-iliad
The Iliad
Homer
-750
war
honor
fate
rage
mortality
meaning
everyone knows how it ends and they fight anyway. that's what stays with me.
marquez-solitude
One Hundred Years of Solitude
Gabriel García Márquez
1967
memory
history
family
myth
time
meaning
a family makes the same mistakes for a hundred years and never remembers in time.
wilde-dorian-gray
The Picture of Dorian Gray
Oscar Wilde
1890
beauty
morality
identity
corruption
self
meaning
what you hide doesn't go away. it just ends up somewhere you don't have to look at it.
deutsch-beginning-infinity
The Beginning of Infinity
David Deutsch
2011
explanation
knowledge
progress
computation
possibility
knowing
every problem is solvable with the right knowledge. the most optimistic book i own.
karp-technological-republic
The Technological Republic
Alexander C. Karp & Nicholas W. Zamiska
2025
technology
state capacity
institutions
purpose
sovereignty
power
engineers used to build for the country. he asks why we stopped and whether we should start again.
This is a text equivalent of the portfolio's content. Interactive simulations and visualizations require the JavaScript site.