Skip to content

Instantly share code, notes, and snippets.

View tef's full-sized avatar
💭
Please don't try to contact me over GitHub.

tef tef

💭
Please don't try to contact me over GitHub.
View GitHub Profile

fair, fine grained, and deadlock free locking

first, a spin lock

you know what a spinlock is, right?

here's a spinlock:

@tef
tef / histo.md
Created November 30, 2024 23:46

to be clear: histogram diff doesn't work like patience diff

By always selecting a LCS position with the lowest occurrence count, this algorithm behaves exactly like Bram Cohen's patience diff whenever there is a unique common element available between the two sequences.

This isn't true. It behaves the same when all unique tokens in the first file happen to be unique tokens in the second file. If the unique tokens in the first file aren't unique in the second file, histogram doesn't work like patience at all:

% cat a
2
@tef
tef / undo.py
Last active October 21, 2024 20:01
"""
a write-ahead-log with undo and redo
undo and redo can be implemented atop list of actions, where
each new action adds onto the list, and undo removes it from
the list, and updates the predecessor with the new redo option,
and redo does the opposite process
say we have some history:
func MakeFunc(out any) error {
handle := func(args []any) ([]any, error) {
// the func we're wrapping
return args
}
outFn := reflect.ValueOf(out).Elem()
outType := outFn.Type()
from contextlib import contextmanager
class Node:
def __init__(self, name, args, children):
self.name = name
self.args = args
self.children = children
def __str__(self):
out = []
@tef
tef / photo.md
Last active January 19, 2024 03:24

Blockquotes are awful in markdown, because they're semi optional in continuation lines.

There are three options i've considered:


Option A: Blockquote at start of para, and on every continuation line.

> a

Here is an indented block:

One Space, One Tab
One Tab
 One Tab, One Space.
 Five Spaces

Now prefixed with '> ', Here the's the indented block:

'> ', One Space, One Tab

tab completion

a vex command can have multiple parts: vex name:subname:subsubname --args .., and the subnames are grouped, and have aliases.

grouping means that vex help prints them out in groups.

tab completing with no command shows all root commands, but not aliases:

sycamore:demo tef$ vex