Skip to content

Instantly share code, notes, and snippets.

View zephyrtronium's full-sized avatar
🌄
a mcdonald is a mcdonoid in the nuggetory of endoburgers

Branden J Brown zephyrtronium

🌄
a mcdonald is a mcdonoid in the nuggetory of endoburgers
View GitHub Profile
@zephyrtronium
zephyrtronium / lobby.go
Created January 20, 2025 18:41
Chan Chan Chan T: A Generic Tale
package lobby
import "context"
// matchMade is a message sent from the challenger to the dealer to indicate
// to the latter that they have matched.
type matchMade[ID, T any] struct {
match chan ID
carry T
}
@zephyrtronium
zephyrtronium / README.md
Last active July 12, 2023 18:59
gotools.bash

gotools.bash

gotools.bash prints Go tools that can be updated.

By default, it checks tools in the Go tool's default go install location, so that you can go install $(gotools.bash). (It turns out that this doesn't actually work, though, you need to do something like for cmd in $(gotools.bash); do go install -v $cmd; done instead.) Since the go install location is $GOBIN, you can choose a different location to check by invoking like GOBIN=/usr/local gotools.bash.

There are two senses of "can be updated" that the script checks for. If a tool was built with a different version of Go than go, the script suggests reinstalling it at its current version. Otherwise, if the configured module proxy reports a different version as the latest than the installed version of the command, the script suggests reinstalling it with the reported latest version.

@zephyrtronium
zephyrtronium / cl.go
Last active May 16, 2021 20:11
windows opencl demo
package main
import (
"fmt"
"log"
"runtime"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
@zephyrtronium
zephyrtronium / settings.json
Created March 18, 2021 17:34
vscode settings with rainglow fixes
{
"go.useLanguageServer": true,
"workbench.colorTheme": "Stealth Contrast (rainglow)",
"keyboard.dispatch": "keyCode",
"editor.tokenColorCustomizations": {
"[Carbonight Light (rainglow)]": {
"textMateRules": [
{
"scope": "storage.type",
"settings": {
<flames name="sierpinski">
<flame name="plain" version="Apophysis 7x" size="512 512" center="0 0" scale="128" oversample="3" filter="0.7" quality="1" background="0 0 0" brightness="1" gamma="1" estimator_radius="9" estimator_minimum="0" estimator_curve="0.4" enable_de="0" plugins="" new_linear="1" curves="0 0 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1" >
<xform weight="0.5" color="0" linear="1" coefs="0.5 0 0 0.5 0 0" opacity="1" />
<xform weight="0.5" color="0" linear="1" coefs="0.5 0 0 0.5 1 0" opacity="1" />
<xform weight="0.5" color="0" linear="1" coefs="0.5 0 0 0.5 0 -1" opacity="1" />
<palette count="256" format="RGB">
0F1E2913212D1824311C2735212A39252D3D2A30412E3345
32364937394D3B3C51403F5544425949455D4D4861514B65
564E695A516D5F5471635775685A796C5D7D706081756385
7966897E698D826D918770958B739990769D9479A1987CA5
@zephyrtronium
zephyrtronium / window.go
Created July 3, 2020 20:36
gui renderer
// +build ignore
package main
import (
"context"
"encoding/json"
"image"
"log"
"os"
package iolang
/*
This file contains the implementation of slots. Executing Io code amounts to
looking up a slot and then calling a function pointer, and it turns out that
the latter is cheap. Slots are the expensive part of the hot path, so they are
the primary target for optimization.
If you are here to read how this works, good luck and have fun; I tried hard to
document everything thoroughly. If you're trying to make changes, have some
import java.io.Serializable;
/**
* 3x3 board.
*
* Branden Brown
* 5-12-11
*/
public class Board implements Serializable
{
goos: windows
goarch: amd64
pkg: github.com/zephyrtronium/iolang
BenchmarkPerform/Local/Type-8 18510919 68.4 ns/op
BenchmarkPerform/Local/Type-8 19098790 63.5 ns/op
BenchmarkPerform/Local/Type-8 19098760 62.8 ns/op
BenchmarkPerform/Local/Type-8 19249957 63.0 ns/op
BenchmarkPerform/Local/Type-8 18804208 62.9 ns/op
BenchmarkPerform/Local/Type-8 18800202 67.9 ns/op
BenchmarkPerform/Local/Type-8 18511318 68.5 ns/op
goos: windows
goarch: amd64
pkg: github.com/zephyrtronium/iolang
BenchmarkPerform/Local/Type-8 17437905 68.9 ns/op
BenchmarkPerform/Local/Type-8 17824014 66.8 ns/op
BenchmarkPerform/Local/Type-8 17958398 66.7 ns/op
BenchmarkPerform/Local/Type-8 17694416 66.4 ns/op
BenchmarkPerform/Local/Type-8 17958237 66.1 ns/op
BenchmarkPerform/Local/Type-8 17958291 66.6 ns/op
BenchmarkPerform/Local/Type-8 18091960 66.3 ns/op