Skip to content

Instantly share code, notes, and snippets.

View zeebo's full-sized avatar
🤘
ABC: Always Be Coding

Jeff Wendling zeebo

🤘
ABC: Always Be Coding
View GitHub Profile
@zeebo
zeebo / monkey.go
Created January 26, 2022 22:03
monketor: monkey patch monitoring
package monketor
import (
"debug/dwarf"
"debug/elf"
"encoding/binary"
"fmt"
"os"
"reflect"
"sort"
@zeebo
zeebo / strconv.patch
Created July 27, 2021 17:02
patch to strconv to allow heap allocations to be removed for ParseInt(string(someBytes), ...), etc.
diff --git src/strconv/atoi.go src/strconv/atoi.go
index 631b487d97..916d60e60a 100644
--- src/strconv/atoi.go
+++ src/strconv/atoi.go
@@ -33,20 +33,22 @@ func (e *NumError) Error() string {
func (e *NumError) Unwrap() error { return e.Err }
+func copyString(x string) string { return string([]byte(x)) }
+
@zeebo
zeebo / buffer.go
Created July 13, 2021 14:09
Buffer Benchmark
package buffer
import (
"errors"
"os"
"unsafe"
)
const (
entrySize = 32 // or maybe 28?
@zeebo
zeebo / handler_gobwas.go
Created May 3, 2021 14:59
websocket demo code
package drpcws
import (
"context"
"net/http"
"sync"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
"github.com/zeebo/errs"
@zeebo
zeebo / testing.py
Last active September 2, 2018 15:44
Minimal Go like testing in Python
import inspect
import sys
import time
import traceback
def objects(x):
return (getattr(x, n) for n in dir(x))
@zeebo
zeebo / output
Last active April 30, 2018 19:40
time.Now latency distribution
nothing 50: 11ns 75: 12ns 90: 13ns 99: 22ns 99.9: 169ns 99.99: 253ns 99.999: 15487ns 99.9999: 24362ns
@zeebo
zeebo / keybase.md
Last active February 8, 2016 20:05
keybase.md

Keybase proof

I hereby claim:

  • I am zeebo on github.
  • I am zeebo (https://keybase.io/zeebo) on keybase.
  • I have a public key ASCCU1slf2yDJwXCMKGl1LDJXdMO1PPuxFk1uFbANWcVygo

To claim this, I am signing this object:

@zeebo
zeebo / keybase.md
Created August 17, 2014 05:23
keybase verification

Keybase proof

I hereby claim:

  • I am zeebo on github.
  • I am zeebo (https://keybase.io/zeebo) on keybase.
  • I have a public key whose fingerprint is 4574 FF4F 2BD7 F04D C376 C998 8FFD D7D0 E906 FFF3

To claim this, I am signing this object:

@zeebo
zeebo / template.go
Last active December 13, 2015 18:19
complicated locking strategy
package main
import (
"html/template"
"path/filepath"
"sync"
)
// i like this inline struct style thing. it's fun.
var cachedTemplates = struct {
@zeebo
zeebo / welp.py
Last active December 13, 2015 17:48
A python object that always looks callable but actually isn't.
class HiddenImpl(object):
def __getattribute__(self, attr):
if attr == "__call__":
self.ref = Welp()
return self.ref
return object.__getattribute__(self, attr)
__getattr__ = __getattribute__
def __setattribute__(self, attr, value):
if attr not in ["__getattr__", "__getattribute__",
"__setattr__", "__setattribute__",