Skip to content

Instantly share code, notes, and snippets.

@cretz
cretz / dht-output.txt
Created February 21, 2017 23:06
Result of deaf9/example
INFO[0000] Creating 500 users
INFO[0000] Created new user: Peer(id=3e5c2e5362, addr=[::]:60081) user=0
INFO[0000] Created new user: Peer(id=c4ae56d6da, addr=[::]:60082) user=1
INFO[0000] Created new user: Peer(id=04e02cbdcf, addr=[::]:60083) user=2
INFO[0000] Created new user: Peer(id=ae4f05f11c, addr=[::]:60084) user=3
INFO[0000] Created new user: Peer(id=4b7d2a6b3f, addr=[::]:60085) user=4
INFO[0000] Created new user: Peer(id=839c86c5b0, addr=[::]:60086) user=5
INFO[0000] Created new user: Peer(id=c3171ad443, addr=[::]:60087) user=6
INFO[0000] Created new user: Peer(id=77c3cc8abf, addr=[::]:60088) user=7
INFO[0000] Created new user: Peer(id=47afc10f19, addr=[::]:60089) user=8
@cretz
cretz / circuit_builder.go
Created February 9, 2017 23:21
Early circuit builder sketch
package onion
import (
"context"
"crypto/rand"
"fmt"
"github.com/cretz/deaf9/common"
"github.com/cretz/deaf9/util"
"math/big"
"net"
@cretz
cretz / dht_impl.go
Created January 26, 2017 12:44
Early kademlia sketch
package dht
import (
"container/heap"
"fmt"
"math/big"
"net"
"sync"
)
@cretz
cretz / java_lang_String.go
Created January 8, 2017 01:43
Early example of goahead compiling java.lang.String from jdk9
package rt
import (
"math"
"sync"
)
type Java__lang__String__Static struct {
CASE_INSENSITIVE_ORDER Java__util__Comparator__Instance
COMPACT_STRINGS bool
@cretz
cretz / ShortImpls.md
Last active August 16, 2017 20:17
Implementations of java.lang.Short which is just a way to show how many Java stdlib reimplementations there are
@cretz
cretz / PgUtil.scala
Last active November 29, 2016 20:09
Parse Hstore in Scala
import scala.annotation.tailrec
object PgUtil {
def parseHstore(str: String): Map[String, String] = {
// Find next key or value piece; Expects str to be trimmed
def nextPiece(str: String): (Option[String], String) = if (str.isEmpty) None -> str else {
if (str.charAt(0) != '"') {
// Run until the next non key char or the end
str.indexWhere(c => c.isWhitespace || c == '=' || c == ',') match {
@cretz
cretz / ast_json.go
Created November 23, 2016 00:43
Golang - CLI to pass parameter and print AST JSON of all decls with types
package main
import (
"encoding/json"
"errors"
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
@cretz
cretz / main.rs
Created February 13, 2016 07:45
Simple PDCurses Window Movement in Rust
extern crate libc;
use libc::{c_ulong, c_int, c_char};
use std::ffi::{CString};
#[allow(non_camel_case_types)]
pub type c_bool = ::libc::c_uchar;
pub type Chtype = c_ulong;
pub type Window = *mut i8;
pub type CharP = *const c_char;

Keybase proof

I hereby claim:

  • I am cretz on github.
  • I am cretz (https://keybase.io/cretz) on keybase.
  • I have a public key whose fingerprint is D6AB 8311 C672 88A0 D638 C002 4454 B3DA C2BE B8C4

To claim this, I am signing this object:

module SoftLayer {
module Zookeeper {
class Acl {
static openAclUnsafe = new Acl(123);
constructor(public permissions: number) { }
}
}
}