This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build ignore | |
package main | |
import ( | |
"bytes" | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
// Assuming name is null-terminated. | |
static bool contains(const char* const* kws, const char* name) { | |
while (*++kws) { | |
if (strcmp(*kws, name) == 0) { | |
return true; | |
} | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"archive/zip" | |
"bufio" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"sort" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return json.Marshal(struct { | |
Payload json.RawMessage `json:"payload"` | |
Signatures []sigHead `json:"signatures"` | |
}{ | |
Payload: j.plcache, | |
Signatures: j.sb, | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type a struct { b string } | |
// func (x a) Name() { return x.b } | |
// type b a | |
// aa := a{ b: "1234" } | |
// _ = aa.Name() | |
// bb := b{ b: "1234" } | |
// _ = a(bb).Name() | |
test.go:7 0x401004 31db XORL BX, BX | |
test.go:7 0x401006 488d0d93e90600 LEAQ 0x6e993(IP), CX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package jwt | |
type Claims map[string]interface{} | |
type JWT interface{ | |
GetClaims() Claims | |
} | |
func Parse(b []byte) JWT { | |
// heuristics | |
if isJWE { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"form_id": "form_id_here", | |
"items": [ | |
"cool_shirt_1", | |
"cool_pants_2", | |
"ziglar_dvd_3", | |
], | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strings" | |
"time" | |
) | |
func getInput() string { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am ericlagergren on github. | |
* I am ericlagergren (https://keybase.io/ericlagergren) on keybase. | |
* I have a public key whose fingerprint is D290 3B6E 2274 1158 7595 6F3C 1615 1BDB C433 449C | |
To claim this, I am signing this object: |