Skip to content

Instantly share code, notes, and snippets.

View valsteen's full-sized avatar

Vincent Alsteen valsteen

View GitHub Profile

[Open space office. Bad lighting. Too many monitors. A TV hangs from a crooked mount, broadcasting a live internal company presentation. Slack pings in random bursts. Someone in the kitchenette keeps restarting a microwave that has already finished. A sour, fishy smell moves through the room like a policy.]

MICHAEL: Good afternoon, innovators. Welcome to our AI-Driven Engineering Initiative kickoff, also known as the AI Committee, also known internally as Project Future Velocity.

GILBERT: He named the meeting twice.

NORBERT: That means it is strategic.

@valsteen
valsteen / Unplugged.md
Last active March 23, 2026 18:43
Unplugged

GILBERT: This version is unbearable. They took a song that sounded like a loose floorboard and polished it until it could apply for office work.

NORBERT: You say that like office work is the highest insult available to language.

[The TV laughs at something neither of them is watching.]

GILBERT:

@valsteen
valsteen / The Humming Glasses.md
Last active March 23, 2026 18:34
The Humming Glasses

[The living room is a low-level disaster. Two floor lamps are on for no reason even though the TV is already flooding the room with blue light. A pizza box is open on the coffee table next to a half-dead basil plant, two game controllers, a soldering iron, three guitar pedals, a bowl full of old charging cables, and a single sock no one claims. A playlist is blasting from a speaker on a chair because the actual speaker stand is currently being used to hold up a shelf that gave up last month.]

[On TV, a melodramatic hospital show is running with the subtitles on. A man in scrubs is staring into the rain, saying things like “Sometimes the heart knows before the chart does.”]

[Norbert is crouched near the speaker, wiggling an aux cable with grave concentration. Gilbert is standing by the coffee table holding a pizza slice and looking personally offended by the music.]

NORBERT: There. Hear that? That version is better.

GILBERT:

@valsteen
valsteen / option.go
Created December 30, 2022 15:39
Option generics with (un)marshalling
package main
import (
"encoding/json"
"fmt"
)
type TenantProfileEntity struct {
SomeOtherValue string
}
@valsteen
valsteen / chain.go
Created November 6, 2022 12:59
Chaining calls until something fails, with error mapping
package main
import (
"errors"
"fmt"
"strconv"
"testing"
"github.com/stretchr/testify/require"
)
@valsteen
valsteen / queue_processing.go
Created October 15, 2022 20:47
Queue processing, using errgroup
/*
This demonstrates a task scheduling loop where tasks can send back other tasks to the queue.
Program input: a nested list of items that can either be integers, or nested slices:
- when it's an integer, wait for 25 - value seconds
- when it's a slice, wait for len(slice) seconds, then put back each item in the queue to be processed next
waiting time simulates some processing, on which a concurrency limit is applied ( both waiting times share the same
limit ). pushing back to the queue should not be blocking.
@valsteen
valsteen / Generics_golfing.go
Last active October 8, 2022 22:58 — forked from plorenz/example.go
go generics test
package main
import (
"errors"
"fmt"
)
type Example interface {
Init(config map[string]interface{})
}
@valsteen
valsteen / mermaidify.py
Last active September 23, 2022 10:28
Quick and dirty : converting from sequencediagram.org charts to mermaid
import re
from sys import stdin
def main():
result = ""
title_re = re.compile("^title (.*)$")
right_arrow_re = re.compile(r"(.+?)\s*(-?)->\s*(.+?)(:(.+))?$")
left_arrow_re = re.compile(r"(.+?)\s*<-(-?)\s*(.+?)(:(.+))?$")
empty = re.compile("^\s*$")
@valsteen
valsteen / queue_processing.go
Last active March 20, 2023 02:47
Self-feeding processing queue
/*
This demonstrates a task scheduling loop where tasks can send back other tasks to the queue.
Program input: a nested list of items that can either be integers, or nested slices:
- when it's an integer, wait for 25 - value seconds
- when it's a slice, wait for len(slice) seconds, then put back each item in the queue to be processed next
waiting time simulates some processing, on which a concurrency limit is applied ( both waiting times share the same
limit ). pushing back to the queue should not be blocking.
@valsteen
valsteen / queue_processing.py
Last active November 27, 2022 10:41
Self-feeding task queue using python's asyncio
"""
This demonstrates a task scheduling loop where tasks can send back other tasks to the queue.
Program input: a nested list of items that can either be integers, whose processing is simulated by waiting
a proportional amount of time, or another list, in which case after waiting a time proportional to its length,
sub-items are rescheduled for processing.
Solution is inspired by goroutines, channels and waitgroups.
Asyncio's Queue can serve both as channel and waitgroup, thanks to Queue.join() that blocks until the queue is empty.