Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad Clawsie bradclawsie

View GitHub Profile
@bradclawsie
bradclawsie / lru.ts
Last active Jan 5, 2021
typescript lru
View lru.ts
class lru {
size: number;
n: number;
key2val: Map<string, any>;
keys: string[];
constructor(size: number) {
this.size = size;
this.n = 0;
this.key2val = new Map<string,any>();
View tcc
package main
// run this: https://play.golang.org/p/lGEbAcNeVJr
import (
"fmt"
"log"
)
const (
View flatten.go
package main
// RUN IT! https://play.golang.org/p/hUrvvq_gBQX
import (
"fmt"
)
func flatten(iface interface{}) []int {
View counter_client.go
package main
import (
"context"
"log"
"os"
"strconv"
"time"
pb "../counter"
View counter_server.go
package main
import (
"context"
"errors"
"log"
"net"
"sync"
pb "../counter"
View counter.proto
syntax = "proto3";
package counter;
// Value contains a countername and its present value.
message Value {
string countername = 1;
int32 value = 2;
}
@bradclawsie
bradclawsie / uuid.hs
Created Feb 18, 2012
generate hashed and random uuids in haskell
View uuid.hs
{-# LANGUAGE PackageImports #-}
module Main where
import qualified Data.Char as C
import qualified Data.Word as W
-- must qualify this (requiring the ghc pragma above) to disambiguate
-- from the Data.UUID also in system-uuid
import qualified "uuid" Data.UUID as U
import qualified Data.UUID.V5 as U5
View channel-pool.go
package main
import (
"errors"
"log"
"math/rand"
"sync"
"time"
)
@bradclawsie
bradclawsie / honeycomb.java
Created Dec 4, 2013
a java solution to the "honeycomb" puzzle
View honeycomb.java
package org.b7j0c.puzzles;
import java.util.EnumMap;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
// the Hex class represents an id with six neighbors. the orientation of the neighbors is irrelevant
// but it is useful to describe them with compass directions as such:
View keybase.md

Keybase proof

I hereby claim:

  • I am bradclawsie on github.
  • I am b7j0c (https://keybase.io/b7j0c) on keybase.
  • I have a public key whose fingerprint is B1C1 F146 2CE7 6E5F 2D99 4FB3 D817 E42D CCB5 AB08

To claim this, I am signing this object: