Skip to content

Instantly share code, notes, and snippets.

View joshpearce's full-sized avatar

Josh Pearce joshpearce

View GitHub Profile
@joshpearce
joshpearce / policy_to_d2.py
Last active April 15, 2026 11:24
Render a Tailscale policy.hujson as a D2 graph (SVG)
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "json5",
# ]
# ///
"""Parse a Tailscale policy.hujson and render a graph of its grants.
Writes a D2 source file and then shells out to `d2` to render an SVG.
@joshpearce
joshpearce / main.py
Created December 6, 2023 16:56
2023 aoc day 5
#!/usr/bin/env python3
from aocd.models import Puzzle
from collections import defaultdict
from operator import mul
# Reading session cookie value from: ~/.config/aocd/token
puzzle = Puzzle(year=2023, day=5)
AllowSubmitA = True
AllowSubmitB = True

Keybase proof

I hereby claim:

  • I am joshpearce on github.
  • I am jjp (https://keybase.io/jjp) on keybase.
  • I have a public key whose fingerprint is 50EB C805 A063 417E 3049 AF5E 8C55 6739 233B 17C4

To claim this, I am signing this object: