Skip to content

Instantly share code, notes, and snippets.

@mweitzel
mweitzel / main.go
Created March 23, 2022 14:30
golang thing thang
package main
import (
"fmt"
)
type thing struct {
str string
}
@mweitzel
mweitzel / wg.rb
Created February 18, 2021 15:20
Ruby WaitGroup without a mutex, using ractors.
class WaitGroup
def initialize
@group = Ractor.new {
Ractor.yield("open")
count = 0
count += receive
while count > 0
count += receive
end
Ractor.yield("close")
@mweitzel
mweitzel / pingpong-sprites
Created September 16, 2016 15:52
ping pong!
( •_•)O* a(•_• )
( •_•)O*¯ a(•_• )
( •_•)O* ` a(•_• )
( •_•)O · a(•_• )
( •_•)o . a(•_• )
( •_•)o ¸ a(•_• )
( •_•)o . a(•_• )
( •_•)o · a(•_• )
( •_•)o ´ q(•_• )
( •_•)o ¯ q(•_• )
@mweitzel
mweitzel / output
Created April 7, 2016 19:34
bug in `ls` while using "-h" flag on files of bytesize between 1023487 and 1024000
-rw-r--r-- 1 matthew staff 1023487 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 999K Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1023488 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1000 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1023999 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1000 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1024000 Apr 7 15:34 tmpfile
-rw-r--r-- 1 matthew staff 1.0M Apr 7 15:34 tmpfile