Skip to content

Instantly share code, notes, and snippets.

@mbrock
mbrock / bun-zig-build-timing-investigation.md
Created May 10, 2026 17:24
Bun Zig build timing investigation

Bun Zig build timing investigation

Date: 2026-05-10

Repo: oven-sh/bun

Commit tested: fe735f8f0522726c84c50b7473b867a52a2370d4

Zig compiler: Bun's pinned oven-sh/zig fork at 04e7f6ac1e009525bc00934f20199c68f04e0a24, reporting 0.15.2.

@mbrock
mbrock / i7c
Created November 23, 2025 23:09
#!/usr/bin/env bash
set -e
{ test -f "$1" && test "$2" = -o; } ||
{ echo Usage: $0 input.ni -o output.ulx; exit 1; }
cat /dev/null >"$3"; trap 'rm -f "$3"' ERR
w=$((65 - ${#1})) nifmt='{
print() if [[ $text ]]; then
re=" (source text, line \([0-9]*\))"
n=`echo "$text" | sed "s/.*$re.*/\1/"`
text=`echo "$text" | sed "s/$re//"`

The Self-Modifying XSL Paradigm

Overview

This document describes a radical approach to web development where the system that serves the website is also the system that documents, tests, and modifies itself. Built on XSL transformations and an XML database, it eliminates the traditional boundaries between code, content, documentation, and development tools.

Core Concept

Instead of having separate systems for:

  • Serving web pages
/**
* Copyright (c) 2024 Mikael Brockman <https://github.com/mbrock>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
// transcription-client.js
class TranscriptionClient {
constructor(options = {}) {
this.language = options.language || 'en-US';
this.websocketUrl = options.websocketUrl || this._getDefaultWebsocketUrl();
this.onTranscript = options.onTranscript || (() => {});
this.onInterimTranscript = options.onInterimTranscript || (() => {});
this.onError = options.onError || console.error;
@mbrock
mbrock / tbl.ttl
Created November 21, 2024 01:50
Tim Berners-Lee Invents Formal Beer Ontology After Too Many Belgian Triples
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bfo: <http://purl.obolibrary.org/obo/bfo.owl#> .
@prefix mfo: <http://purl.obolibrary.org/obo/mfo.owl#> .
@prefix sfo: <http://timbl.org/ontologies/scent-flavor#> .
@prefix beer: <http://www.semanticbeer.org/ontology/> .
@prefix time: <http://www.w3.org/2006/time#> .
// MIT license (c) Mikael Brockman
class TypeWriter extends HTMLElement {
limit = 0
blind = new Range()
timer?: number
scout = new MutationObserver(() => {
this.update()
if (!this.timer) this.proceed()
})

Prolog Philosophy and Best Practices

Pure Predicates and Referential Transparency

Focus on the referentially transparent, pure predicates.

Delight in unification and backtracking.

Rejoice in logical domain modelling relations.

document.addEventListener('DOMContentLoaded', function() {
let mediaRecorder;
let audioChunks = [];
let isRecording = false;
const recordBtn = document.getElementById('recordBtn');
const transcriptionEl = document.getElementById('transcription');
let token = localStorage.getItem('apiToken');
if (!token) {
token = prompt('Please enter your OpenAI API token:');
@mbrock
mbrock / hole-mode.el
Last active May 30, 2024 07:03
hole mode for emacs
;;; hole-mode.el --- fill holes with GPT-4 -*- lexical-binding: t -*-
;; Author: Mikael Brockman <mikael@brockman.se>
;; Version: 1.0
;;; Commentary:
;; This package provides a minor mode for filling holes in code with AI.
;;
;; It is designed to work with the `llm' command-line tool, which is a