Skip to content

Instantly share code, notes, and snippets.

View ianbishop's full-sized avatar

Ian Bishop ianbishop

View GitHub Profile
@ianbishop
ianbishop / buckets.java
Last active December 12, 2015 02:28
Buckets!!
import java.util.*;
public class BucketTest {
static Random gen = new Random(System.currentTimeMillis());
static int MAX_LENGTH = 64;
public static void main(String[] args) {
int[] buckets = new int[Integer.parseInt(args[0])];
(def superset {:a 1 :b 2 :c 5})
(def subset {:a 1 :b 2})
(-> superset
(select-keys (keys subset))
(= subset))
=> true
(def superset {:a 9 :b 2 :c 5})
@ianbishop
ianbishop / gist:5654308
Created May 26, 2013 22:45
Updated weave's benchmarks to include fressian
Testing Deep Freeze
===================
- write mean: 312.07 µs
- read mean: 42.05 µs
Testing Carbonite
=================
- write mean: 177.35 µs
- read mean: 202.58 µs
require 'faraday'
require 'faraday_middleware'
conn = Faraday.new(:url => 'your-url') do |faraday|
faraday.use FaradayMiddleware::EncodeJson
faraday.use Faraday::Response::RaiseError
faraday.use Faraday::Response::ParseJson
faraday.adapter Faraday.default_adapter
end
parallelSearch = (keywords, cb) ->
out = []
await
for k,i in keywords
search k, defer out[i]
cb out
serialSearch = (keywords, cb) ->
out = []
#!/usr/bin/env ruby
require 'rugged'
include Rugged
repo = Repository.new("/home/ian/open-source/stripe/level1/level1")
difficulty = "001"# `cat difficulty.txt`
index = repo.index
var counts = {};
var total = 0;
function freqIP(ip) {
var count = counts[ip];
if (count == undefined)
count = 1;
else
count++;

Keybase proof

I hereby claim:

  • I am ianbishop on github.
  • I am ianbishop (https://keybase.io/ianbishop) on keybase.
  • I have a public key whose fingerprint is D840 EE9A 7470 BEBB F133 6132 D2A3 AB2B 233A A7F7

To claim this, I am signing this object:

@ianbishop
ianbishop / 0_reuse_code.js
Created June 3, 2014 23:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(defn search [queue matcher agent & params]
(->> queue
(filter #(apply m/matches matcher % agent params))
sorted-set))