Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
💡
lights, camera, action

Louis Maddox lmmx

💡
lights, camera, action
View GitHub Profile
@lmmx
lmmx / demo_academic_hedged.py
Last active February 13, 2026 13:27
Token classifier demo
import json
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoModel, AutoTokenizer
def main():
model_name = "HavelockAI/bert-token-classifier"
marker precision recall f1-score support
B-literate_list_structure 0.975 0.75 0.848 52
O 0.771 0.847 0.807 37244
B-oral_imperative 0.753 0.805 0.778 87
B-literate_footnote_reference 0.81 0.739 0.773 23
B-oral_rhetorical_question 0.649 0.809 0.72 89
I-literate_technical_abbreviation 0.687 0.731 0.709 108
B-oral_inclusive_we 0.603 0.793 0.685 266
I-literate_footnote_reference 0.57 0.821 0.673 84
I-oral_rhetorical_question 0.646 0.683 0.664 840
marker precision recall f1-score support
B-literate_list_structure 0.932 0.788 0.854 52
O 0.75 0.819 0.783 37244
B-oral_inclusive_we 0.581 0.921 0.712 266
B-oral_imperative 0.654 0.782 0.712 87
B-oral_rhetorical_question 0.535 0.933 0.68 89
B-literate_conditional 0.595 0.742 0.661 97
B-literate_concessive 0.517 0.818 0.634 55
I-oral_rhetorical_question 0.683 0.554 0.611 840
B-oral_phatic_check 0.467 0.875 0.609 24
@lmmx
lmmx / transcript.md
Last active February 8, 2026 13:36
Transcript of BlueSky thread in replies to Armin Ronacher post

A: This Tweet is making the rounds: "Nearly every ambitious person I know who has dived into Al is working harder than ever, and longer hours than ever. Fascinating dynamic tbh. I have NEVER worked this hard, nor had this much fun with work." I'm in this Tweet.

C: Suggests a very, ah, particular attitude to pre LLM SE imho. You're not the first people to invent excitement or better mechanical advantage in SE. The Al crowd are culturally rooted in old languages, building not proving etc. Fine. But different interests would mean different tools excite

@lmmx
lmmx / vcd.sh
Created February 7, 2026 21:41
Ascend to the dir containing a .venv
vcd() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -d "$dir/.venv" ]]; then
cd "$dir" || return
return
fi
dir="$(dirname "$dir")"
done
@lmmx
lmmx / demo.py
Last active February 3, 2026 20:53
Selecting between paths based on their existence on the filesystem using default validation at runtime
from pathlib import Path
from typing import Annotated
from pydantic import BaseModel, BeforeValidator, Field, FilePath
PathA = Annotated[FilePath, BeforeValidator(lambda _: Path("a.txt"))]
PathB = Annotated[FilePath, BeforeValidator(lambda _: Path("b.txt"))]
class MyModel(BaseModel):
@lmmx
lmmx / SKILL.md
Created January 29, 2026 20:47
PDF transcription skill

SKILL: Document Transcription Pipeline

This guide describes how to transcribe a PDF document (book or paper) into a hierarchical modular directory tree of markdown files. Follow each step in order.

Overview

The pipeline produces:

  1. Split PDFs - one per top-level group (chapter/section), extracted with qpdf
  2. Transcript files - page-level markdown files with YAML frontmatter, named by page number
@lmmx
lmmx / Review.md
Last active January 25, 2026 17:37
Claude Code analysis of the "AI Stupid meter" code base
@lmmx
lmmx / GUIDE.md
Last active January 22, 2026 23:13
Orality-to-Literacy Register Transformation prompt

Modulating Text Toward Literate Register: A Practical Guide

Theoretical Foundation

The distinction between oral and literate modes of expression, as elaborated in Walter J. Ong's Orality and Literacy: The Technologizing of the Word (1982), concerns not merely the medium of transmission but the underlying cognitive and syntactic structures that organise thought. Oral discourse—shaped by the constraints of memory and real-time performance—exhibits characteristic markers: additive syntax, formulaic aggregation, redundancy, participatory engagement,

@lmmx
lmmx / 0_prompt.md
Created January 19, 2026 12:59
A design report written by Claude Opus 4.5 (in Claude Code) on a Rust query planner for Python pathlib Path handling

I wrote this blog https://cog.spin.systems/future-paths-template-strings it describes how to use t-strings and pathlib Paths together to do symbolic path manipulation. I want to take the idea further though - see the code https://gist.github.com/lmmx/f5d1b07d266f160f9a431c1f6bdc8a17 - I want to use pyo3 to optimise the path operations like polars does with its queries and to avoid allocations - right now it is not genuinely deferred, only symbolic (deferred resolution). Polars builds a lazy logical plan, optimizes it, then executes. You can do the same: separate the expression tree (what you have now) from a compiled plan that's cheap to execute repeatedly. take a look under the hood in the polars source code and write me a report on the specific analogues (as in analogies) between the code bases and how i would design it. write an extensive report and make sure you cite the sources for factual claims, dont just imply something is true without giving me the ability to verify it. write your report to markdown