Skip to content

Instantly share code, notes, and snippets.

@alphazero
alphazero / Resume Fix
Created August 18, 2018 19:34
B2b-resume-perf-fix-diff.java
alphazeroAO ~/Code/java/Blake2b ± diff src/main/java/ove/crypto/digest/Blake2b.java ../githubbers/tim/Blake2b/src/main/java/ove/crypto/digest/Blake2b.java master
22a23
> import java.io.Serializable;
108a110,165
> /**
> * A serializable / JSON-izable object usable for pausing a hash-in-process
> * which can then be resumed with the same Parameter the original digest
> * was constructed with, and fed additional bytes to conclude the hash.
> */
> public static final class ResumeHandle implements Serializable {
@alphazero
alphazero / module-generic-init-multi.go
Last active August 31, 2017 12:24
A refinement of the half-baked idea
/* define generic package */
// file p.go
package p
typevar K generic.ComparableType // poor man catagory
typevar V generic.AnyType // ^^
import (...)
type X struct {
@alphazero
alphazero / module-generic-init.go
Last active August 31, 2017 12:15
half-baked idea sketch - module level genericity for Go
/* define generic package */
// file p.go
package p
typevar K generic.ComparableType // poor man catagory
typevar V generic.AnyType // ^^
import (...)
type X struct {
@alphazero
alphazero / bflx.spec
Last active March 16, 2017 15:06
Specfication for BFLX
language specification for level extended brainfuck
rev alpha.0
-- what
Yet another riff on the brainfuck language.
-- program structure
A bflx program is a sequence of byte codes (with ASCII semantics) of minimum length of 1.
@alphazero
alphazero / bg.go
Last active March 16, 2017 11:48
BF in go
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 1 {
fmt.Fprintf(os.Stderr, "usage: bf <program>")
Verifying that "alphazero.id" is my Blockstack ID. https://onename.com/alphazero
二 // 2
进 // "enter" per google but accounting is most likely meaning
制 // system
二进制 // binary (number system)
十 // 10
进 // "enter" ..
制 // system
@alphazero
alphazero / gist:1684fa102bb545ecb3f7
Last active August 29, 2015 14:21
go test -bench results of distributing random % slotcnt + times
XorShift*
453361 of 524288 slots with ideal cnt of 2
ideal: 141655 (27.019%)
missed: 70927 (13.528%)
less: 142038 (27.092%)
more: 169668 (32.362%)
max hits: 12
STD-LIB
452947 of 524288 slots with ideal cnt of 2
ideal: 141284 (26.948%)
@alphazero
alphazero / gist:dd0e432683ed2410998e
Created May 18, 2015 12:54
Xorshift* 1024 (essential fragment)
var s0 = [16]uint64{
0xEA221D1E5C8DB483,
0xF89369282348A220,
0x7022326276090608,
0x1618FCC12E583E30,
0xF7E7C005F85EFC69,
0x132B746F9C2FF047,
0x338324A69CBDC6B5,
0x2B91B21FAAB58FE0,
0x85CB192105B8B12B,
package foo
import (
"fmt"
"testing"
)
const M = 32768
const M0 = M / 8192 // play with this knob ...