Skip to content

Instantly share code, notes, and snippets.

View mbutler's full-sized avatar
🇦🇶
Exploring

Matthew Butler mbutler

🇦🇶
Exploring
View GitHub Profile
@mbutler
mbutler / crumbling-stone.md
Created December 1, 2025 02:29
The Crumbling Spire skill challenge

The Crumbling Spire

Skill Challenge – Level 20
Complexity: 5 (12 successes before 3 failures)
XP: 14,000
Challenge Type: Narrative substitute for combat
Failure Cost:

  • Each failure costs a daily power (player's choice), unless negated after the roll by sacrificing a daily power.
  • Each PC may only negate a failure once this way per challenge.

Scenario

@mbutler
mbutler / red-amulet-protocol.md
Created November 22, 2025 20:13
The Red Amulet Protocol

The Red Amulet Protocol is a method for Enacting Digital Objects.

We believe that a digital file is not "Real" until it has suffered Consequence.

It must be Caged. (It cannot be infinite; it must be constrained to one hardware anchor).

It must be Blind. (It cannot be visible to the web; it must be obscured by the Fog of War/Encryption).

It must be Played. (It cannot be passive; it must require active human input—a key, a gesture, a ritual—to exist).

@mbutler
mbutler / artifact.js
Last active December 9, 2025 03:58
generated artifacts
// Optional tiny seeded RNG so runs can be repeatable
const makeRng = seed => {
let h = 2166136261 ^ (seed || 0)
return () => {
h += h << 1
h ^= h >>> 1
h += 0x9e3779b9
h ^= h << 5
return (h >>> 0) / 4294967296
}
@mbutler
mbutler / 4e_power-schema.json
Last active October 15, 2025 01:02
D&D 4e Power Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/4e-power.schema.json",
"title": "D&D 4e Power Schema with Augments",
"type": "object",
"required": ["name", "level", "type", "action_type", "range", "targeting"],
"properties": {
"name": { "type": "string" },
"level": { "type": "integer", "minimum": 1 },
"class": { "type": "string" },
@mbutler
mbutler / dnd4e.md
Created September 1, 2025 06:11
How to read a .dnd4e file

Awesome — I’ve ingested all five .dnd4e XMLs and mapped out their structure. To make this concrete, I parsed each file, inventoried every element path, attributes, and common child patterns, then surfaced the results for you to browse:

  • Download the JSON schema summary — machine-readable union of structures across the five files
  • Download the union of XML paths as CSV

I also put three interactive tables in your workspace:

What the files look like (high-level)

Root element (all files): D20Character

@mbutler
mbutler / analyze_apache.py
Created August 27, 2025 14:10
Analyze Apache logs to generate usage stats
#!/usr/bin/env python3
"""
Analyze Apache *combined* access logs and export CSVs.
Outputs:
00_summary.csv # headline metrics
10_pages.csv # per-page counts (querystrings stripped, static excluded)
20_daily_requests.csv # all requests per day
21_daily_pageviews.csv # "pageviews" per day (static excluded)
30_status_codes.csv # status code breakdown
@mbutler
mbutler / dnd4e.css
Created July 14, 2025 21:36
4e styling
/*
* D&D 4e Style Sheet - Universal 4e Block Styling
* Combines and adapts styles from the project's CSS library
* For use with any D&D 4e code block: powers, monsters, items, etc.
*/
:root {
--font-primary: 'DragonBodySans', Arial, sans-serif;
--font-secondary: 'DragonBodySerif', Georgia, serif;
--background-atwill: #619769;
@mbutler
mbutler / import_4e.py
Created July 7, 2025 15:37
import 4e compendium sql files. Holy hell what a mess
import os
import re
import sqlparse
import pymysql
import sqlglot
from pathlib import Path
# CONFIG
DB_NAME = '4e_compendium'
DB_USER = 'mbutler'
@mbutler
mbutler / html_to_markdown.py
Last active July 7, 2025 16:19
convert html to markdown
import pymysql
import re
from bs4 import BeautifulSoup, XMLParsedAsHTMLWarning
import html2text
import warnings
from pathlib import Path
# Suppress BeautifulSoup XMLParsedAsHTMLWarning
warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
@mbutler
mbutler / cubswin.md
Created June 25, 2025 19:09
Amazing simulated game

At-Bat Result Inning 1 - Top William Contreras: Flyout to CF (Outs: 1, Score: Away 0 – Home 0, Bases: Empty) Rhys Hoskins: K (Outs: 2, Score: Away 0 – Home 0, Bases: Empty) Brice Turang*: Groundout to 1B (Outs: 3, Score: Away 0 – Home 0, Bases: Empty) Inning 1 - Bottom Carson Kelly: Flyout to LF (Outs: 1, Score: Away 0 – Home 0, Bases: Empty) Michael Busch*: BB (Outs: 1, Score: Away 0 – Home 0, Bases: 1B) Nico Hoerner: Groundout to 2B (Outs: 2, Score: Away 0 – Home 0, Bases: 2B) Dansby Swanson: 1B (Outs: 2, Score: Away 0 – Home 0, Bases: 1B, 3B)