Skip to content

Instantly share code, notes, and snippets.

View dmarzzz's full-sized avatar

dmarz dmarzzz

View GitHub Profile
@dmarzzz
dmarzzz / committee_takeover.py
Created May 25, 2023 00:17
orobability of controlling >50% of an N-size committee
from decimal import Decimal
import math
def calculate_summation(N, p):
p = Decimal(p)
result = Decimal(0)
for k in range(math.floor(N/2), N+1):
term = Decimal(math.comb(N, k)) * (p**k) * ((1-p)**(N-k))
result += term
return float(result)
@dmarzzz
dmarzzz / gist:21827db7b9303088577dc1cca0dd23b4
Last active February 2, 2024 16:42
Generate Access List Example
import requests
import json
def generate_access_list_from_statediff():
response = '''
{"jsonrpc": "2.0", "result": {"output": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000001f161421c8e0000000000000000000000000000000000000000000000000000057f864ee247d477", "stateDiff": {"0x9162accd2bf58dcf5f5d46e5818117e3f5cd8333": {"balance": {"*": {"from": "0x1e8b422a215aff2a", "to": "0x1c8a6a7b5aa9727a"}}, "code": "=", "nonce": {"*": {"from": "0x259", "to": "0x25a"}}, "storage": {}}, "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5": {"balance": {"*": {"from": "0xcbf2d42250f0eb19", "to": "0xcbf2e3a93cf93319"}}, "code": "=", "nonce": "=", "storage": {}}, "0xa65303cbe1186f58dda9cf96b29e1e89ae90b165": {"balance": "=", "code": "=", "nonce": "=", "storage": {"0x0000000000000000000000000000000000000000000000000000000000000008": {"*": {"from": "0x65bd127b000000000000b48e759d60c985d500000000000205fd
@dmarzzz
dmarzzz / main.go
Created May 12, 2024 12:19
Super Simple POD Implementation
package main
import (
"fmt"
"sync"
)
type Transaction struct {
ID int
Data string
# Run "traceroute -n google.com | tee traceroute_output.txt" in your terminal
# Paste your traceroute/tracert output between the triple quotes and run this cell.
TR_TEXT = """
<PASTE YOUR TRACEROUTE OUTPUT HERE>
"""
import re, requests, ipaddress, sys
def extract_hops(text: str):
"""
@dmarzzz
dmarzzz / spec-walkthrough.html
Created May 8, 2026 02:34
Shape Rotator OS — Spec Walkthrough · v0.1 + amendments (2026-05-07)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Shape Rotator OS — Spec Walkthrough · v0.1 + amendments</title>
<style>
:root {
--paper: #F1ECE7;
--paper-2: rgba(241,236,231,0.72);
@dmarzzz
dmarzzz / gist-discoverability.md
Created May 8, 2026 04:00
Formal threat model for GitHub gist discoverability, and its connection to capability URLs.

Gist discoverability as a search problem

Notes from a conversation: if I post a gist, what's the probability an adversary can find it? And how does this connect to object capabilities?

1. Setup

A user $U$ posts a gist $G$ at time $t_0$ with:

  • Content $C$ — files, text $T$, possibly identifiers (emails, keys, function names)
  • Visibility $v \in {\textsf{public}, \textsf{secret}}$ — GitHub doesn't offer truly private gists outside Enterprise
@dmarzzz
dmarzzz / transcript-redaction-evals.md
Created June 2, 2026 02:08
Open-source transcript redaction / PII de-identification evals — landscape: comparison table of benchmarks & harnesses + what's missing for spoken/ASR transcripts

Open-Source Transcript Redaction / PII De-identification Evals — Landscape

A survey of public benchmarks, datasets, and open-source evaluation harnesses for transcript redaction and PII de-identification, with a focus on what exists for spoken / conversational / ASR transcripts versus clean written text — and what's still missing.

Scope note: "redaction eval" here means a benchmark or harness with ground-truth labels that lets you score how well a system removes PII/PHI (precision, recall, F1/F2, leakage rate), not just a redaction tool on its own.


Comparison table

@dmarzzz
dmarzzz / 0_README.md
Created June 4, 2026 08:35
reputation-gated onion egress: a zk-proof-gated Tor egress proxy (Semaphore + RLN-style nullifiers). Full repo: github.com/dmarzzz/reputation-gated-onion-egress
@dmarzzz
dmarzzz / crypto-bench-report.md
Created June 8, 2026 22:49
Crypto microbenchmark: proof generation (client) vs verification (gateway) timing for reputation-gated-onion-egress, M1 Max vs 2 vCPU droplet

Benchmarking the crypto in a reputation-gated Tor egress

reputation-gated-onion-egress is a Tor onion service that egresses to the clearnet only for clients who present a zero-knowledge proof of membership in a curated set. No login, no account, and the gateway never learns who you are. The proof is a Semaphore membership proof, scoped to a daily epoch so the same member produces the same nullifier within a day (that is the rate limit) and a fresh one across days (that is the unlinkability).

Two cryptographic costs run in that system, and they sit on opposite sides:

  • Proof generation runs on the client. The shim mints one proof per epoch and reuses it, so a member pays this once a day, not once a request.
  • Proof verification runs on the gateway, on every single request, before any bytes egress.

I wanted the real numbers for both, isolated from the network. So this benchmark calls generateProof and verifyProof directly.