Skip to content

Instantly share code, notes, and snippets.

View wizardishungry's full-sized avatar
🐫
Copyright 1987-2013, Larry Wall

Jon Williams wizardishungry

🐫
Copyright 1987-2013, Larry Wall
View GitHub Profile
@wizardishungry
wizardishungry / go-tools.zsh
Created July 3, 2023 17:00
ZSH function to commands vendored in tools.go. `gt toolname` -> `go run example.com/tool/cmd/toolname`
function gt { go run $(go list -f '{{join .Imports "\n" }}' -tags tools tools.go | egrep "\/$1\$" ) }
@wizardishungry
wizardishungry / benchcmp
Created March 6, 2022 02:37
testing hls-await benchmarks on my raspberry pi 2 :-)
benchmark old ns/op new ns/op delta
BenchmarkScoreImage/gzip256 19301022 1543641522 +7897.72%
BenchmarkScoreImage/gif256 20331217 1507603817 +7315.22%
BenchmarkScoreImage/gif 257903567 18245462256 +6974.53%
BenchmarkScoreImage/png256 19827400 1367371356 +6796.37%
BenchmarkScoreImage/jpeg256 27591326 1800628285 +6426.07%
BenchmarkScoreImage/jpeg 6786711 402659528 +5833.06%
BenchmarkScoreImage/png 21518215 1025579140 +4666.10%
BenchmarkScoreImage/gzip 110047 5182135 +4609.02%
@wizardishungry
wizardishungry / crap.sh
Created March 6, 2022 02:23
oneliner to build a go package for every platform
go tool dist list |xargs -n 1 |sed -e 's#^\(.*\)/\(.*\)#GOOS=\1 GOARCH=\2 go build -o \1_\2 .#' |xargs -P 0 -n 1 -d \\n sh -c
@wizardishungry
wizardishungry / stellar-database-tiny.json
Created October 17, 2012 05:20
Example Stellar Database JSON
{
"Sol": {
"name": "Sol",
"proper_names": ["Sol", "Helios", "The Sun"],
"age": "4800 million years",
"standard_error_in_age": "0%",
"heavy_element_abundance": "100% of Sol",
"standard_error_in_heavy_element_abundance": "0%",
"arity": "singular",
"points_of_interest": "The \"8\" in the Detected Planets entry is not an error. Pluto is not a \"planet,\" but a huge, close-orbiting, low-eccentricity Kuiper Belt object. With a big moon. Of course, some die-hards out there still insist that it really is a planet, more for sentimental reasons than anything else. They're welcome to live in their little fantasy world. Neener neener.",
@wizardishungry
wizardishungry / .gitattributes
Created April 13, 2009 21:47
Apple's .plist files have two equivalent on-disk representations, binary and xml. These snippets help keep binary crap out of your repository.
*.plist filter=xmlplist
# surprise! Quartz patches are plists, too!
*.qtz filter=xmlplist
@wizardishungry
wizardishungry / vmm-alpine.sh
Last active May 22, 2020 18:04 — forked from voutilad/vmm-alpine.sh
Installing Alpine Linux in OpenBSD's VMM Hypervisor and setup k3s
# Assuming you're a regular user that has doas allowances for vmctl
mkdir -p ~/vmm
cd ~/vmm
# Grab the the one of the virt iso's of Alpine Linux
curl http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-virt-3.11.6-x86_64.iso -o alpine-virt-3.11.6-x86_64.iso
# Make a new virtual disk image, change the size as needed. Make one for each node.
doas vmctl create -s 2G alpine-virt1.img
doas vmctl create -s 2G alpine-virt2.img
@wizardishungry
wizardishungry / commands.sh
Created October 23, 2013 02:06
list of new commands in OSX Mavericks
/usr/bin/a2p5.16
/usr/bin/afida
/usr/bin/btmmdiagnose
/usr/bin/c2ph5.16
/usr/bin/config_data5.16
/usr/bin/corelist5.16
/usr/bin/cpan2dist5.16
/usr/bin/cpan5.16
/usr/bin/cpanp-run-perl5.16
/usr/bin/cpanp5.16
@wizardishungry
wizardishungry / bgpd.conf
Created September 26, 2018 06:07
checkpoint jesse's vm bgp conf
# global configuration
AS 64986
router-id 10.70.145.196
#holdtime 15
#keepalive 5
# listen on 127.0.0.1
# listen on ::1
fib-update yes
# route-collector no
log updates
GOOS=openbsd GOARCH=amd64 go get github.com/docker/cli/cmd/docker
GOOS=openbsd GOARCH=amd64 go get github.com/docker/machine/cmd/docker-machine
doas sysctl net.inet.ip.forwarding=1
wget "https://github.com/boot2docker/boot2docker/releases/download/v18.06.0-ce/boot2docker.iso"
vmctl create disk.img -s 4.5G
doas vmctl start docker -d ./boot2docker.iso -d ./disk.img -m 1024M -L -c
# -c is for console
@wizardishungry
wizardishungry / README.md
Created June 21, 2018 20:09
go lang teaser

So I just ran into this interesting situation in a select IO handler which is trapping control-C and listening for messages/errors from partitionConsumer. I’ve run into a case where I am unable to catch signals. The problem occurs when no one is consuming b.output but we enter the block for <-partitionConsumer.Messages()

Rest of functions ommited.