Skip to content

Instantly share code, notes, and snippets.

View jac18281828's full-sized avatar
🦌

John Cairns jac18281828

🦌
View GitHub Profile
@jac18281828
jac18281828 / monitor_base.py
Created June 25, 2026 16:48
Monitor base block production
#!/usr/bin/env python3
import time, urllib.request, json, sys, os, pathlib
def load_env(path=".env"):
env = {}
for line in pathlib.Path(path).read_text().splitlines():
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, _, v = line.partition("=")
@jac18281828
jac18281828 / ackroyd_lock.py
Last active June 12, 2026 01:18
The Murder of Roger Ackroyd Lock
#!/usr/bin/env python3
"""ackroyd_lock.py — a spoiler in a sealed envelope.
Usage: python3 ackroyd_lock.py <surname of the culprit>
The culprit's surname is the decryption key. A wrong name yields garbage
and the lock stays shut. The answer appears nowhere in this file: only a
blinded commitment c = b + H(key)*(1,2,3) does. NO SPOILERS IN THE SOURCE.
Hash: surname -> lowercase a-z only -> sum(a=1..z=26) -> sum^3 mod 10007
% =====================================================================
% test_atan.mms -- Test harness for the Atan library.
% =====================================================================
%
% Build: mmixal test_atan.mms
% Run: mmix test_atan
%
% Output looks like:
%
% atan tests:

Solitare of Olympus — Code Review

Bugs / Correctness Issues

1. IAM ARN double colon (false alarm)

deploy-static-site.yml:31

role-to-assume: arn:aws:iam::504242000181:role/GithubDeployCI

Standard ARN format for IAM is arn:aws:iam:::role/... with no region (empty field), so the double colon is correct. Disregard.

@jac18281828
jac18281828 / AGENTS.md
Last active April 20, 2026 15:49
AI_CONTRIBUTING.md - rules for agents to modify my code

AI Contributing Requirements

These rules apply to all AI-assisted changes in this repository.

Workflow

  1. Scan every file you plan to change and directly related modules.
  2. Summarize current behavior and invariants.
  3. Propose a minimal patch plan (diff and rationale).
  4. Obtain user approval before editing code.
  5. Affirm all Completion Gates are met.
@jac18281828
jac18281828 / README.md
Last active March 9, 2026 14:27
Audiobook generator - text2mp3_piper.py

text2mp3 (Piper TTS)

A cross-platform, fully offline text-to-MP3 pipeline built on Piper TTS.
Designed for long-form reading (ebooks, essays, Project Gutenberg texts) with natural pacing, clean chunk boundaries, and intentional pauses that sound like real speech rather than stitched audio.

This tool:

  • Reads .txt or .pdf (optional page ranges)
  • Cleans and normalizes text for speech
  • Chunks intelligently (paragraph-aware, sentence-safe)
  • Inserts natural pauses between chunks and paragraphs
@jac18281828
jac18281828 / confetti.py
Last active January 16, 2026 22:59
python rendering sample codes
import math
import random
import time
from collections import deque
import pyglet
from pyglet import gl
# -------------------- CONFIG --------------------
PARTICLES = 20_000
@jac18281828
jac18281828 / 75easy.mms
Last active January 2, 2026 02:21
75 Hard Time Tracker in MMIX
LOC #1000
START_TIME IS 1767310000
DAY IS 86400
Main
TRAP 0, Time, 0
SETI $1, START_TIME
SETI $3, DAY
MULI $3, $3, 3 % buffer for 3 days
@jac18281828
jac18281828 / gcdeuclid.mms
Created January 1, 2026 22:09
GCD Euclid using Subtraction only in MMIX
LOC #1000
Tmp IS $252
% Entry point
Main
SETI $0, 48
SETI $1, 18
PUSHJ $0, GcdEuclid
BN $1, Error
@jac18281828
jac18281828 / advent11.mms
Last active December 28, 2025 01:42
Advent of Code 2025 Day 1 Example MMIX
DIAL_INCREMENTS IS 100
LOC #100
% Entry point
GREG @
InputPtr GREG 0 % global register for input pointer
Main LDA InputPtr,MyInput % initialize pointer
SETI $10,50 % dial setting - current dial pointer (starts at 50)
SETI $11,0 % count number of operations handled