Skip to content

Instantly share code, notes, and snippets.

@hwayne
hwayne / filelinks.lua
Created April 22, 2025 20:13
Neovim Filelinks Plugin
@hwayne
hwayne / autocommands.lua
Created April 9, 2025 01:39
Useful neovim autocommands for TLA+
local function moduleline() -- can't be a global as line can move
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
for idx, line in ipairs(lines) do
if string.match(line, "%-+ MODULE [%w_]+ %-") then
return idx, line
end
end
end
local function fix_module_string()
@hwayne
hwayne / readme.md
Last active April 11, 2025 18:09
Bsky spinner

Bsky spinner

Spins your avatar like a clock

https://bsky.app/settings/app-passwords

Disclaimer: I set this up locally half a year ago and forgot all the steps, so the steps below may be wrong.

To run locally

@hwayne
hwayne / SweepTLC.ps1
Last active October 7, 2024 20:51
TLA+ State Sweeping
function template($t) {
@"
SPECIFICATION Spec
CONSTANTS
BuffLen = 2
NumThreads = $t
CHECK_DEADLOCK TRUE
"@
@hwayne
hwayne / Enqueue.cfg
Last active June 25, 2024 20:37
Model for "Investigating a Queue Hang"
SPECIFICATION Spec
\* Add statements after this line.
CONSTANTS
Threads = {t1}
NULL = NULL
Keys = {k1}
MaxId = 1
BUGMODE = TRUE
PROPERTY LockProp
@hwayne
hwayne / _README.md
Created April 23, 2024 16:33
Verified example of code for a newsletter

For the newsletter at: FILL IN

Run with Dafny 4.6.0, with the flag --standard-libraries.

@hwayne
hwayne / expand_version.py
Created March 11, 2024 20:51
expand_version.py
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
from copy import deepcopy
from argparse import ArgumentParser
from dataclasses import dataclass
from string import Template
from pathlib import Path
import typing as t
#Common issue is that I need to have multiple slightly different versions of the same spec, this is a helper to do that.
@hwayne
hwayne / Youtube-Summarizer.ps1
Created February 2, 2024 02:33
Youtube Summarizer
function Ask {
Param (
[PSDefaultValue(Help="*")]
[switch]$Fast,
[Parameter(Position=1)]
[Alias("M")]
[int]$Tokens=256,
[Alias("n")]
[int]$Results=1,
[Parameter(Mandatory=$true, Position=0)]
@hwayne
hwayne / endft.md
Last active December 19, 2023 03:05
endft

Pleased to announce a new #NFT offering: #eNdFT! We are minting one cause of death NFT for every person on earth, which is 100% guaranteed to reflect the way you do, in fact, actually die.

Unless you trade it!

Unhappy with your "car crash" #eNdFT? Exchange it for an "old age"! Of course, you better be prepared to pay through the nose for "old age". Due to the nature of our product, eNdFTs cannot be bought or sold, only be traded 1-1 for another #eNdFT (plus an optional eth price to cover value differences). There is no escaping death.

Please note that our prediction software isn't perfect. While every #eNdFT is accurate, it may be imprecise. For example, you could receive the "Most likely drowned" NFT, or "either cancer or a stabbing". Don't worry, eNdFTs are still an exciting speculation opportunity! We're improving our prediction software all the time, and that "cancer or stabbing" #eNdFT could one day become a super valuable "cancer"! Join the #eNdFT network today!

(Disclaimers: while we will confirm

@hwayne
hwayne / 01-dreidel.prism
Last active December 19, 2024 17:37
Dreidel modeling
// dreidel model I wrote in 2023.
// see https://buttondown.com/hillelwayne/archive/i-formally-modeled-dreidel-for-no-good-reason/
dtmc
const int M; //starting money
formula Players = 4; //Players
formula maxval = M*Players;
formula done = (p1=0) | (p2=0) | (p3=0) | (p4=0);
formula halfpot = ceil(pot/2);