Skip to content

Instantly share code, notes, and snippets.

module Main where
import qualified Data.ByteString.Lazy.Char8 as S
main = do
let a = S.pack "hi eat this sandwich"
S.putStrLn a
[java] Exception in thread "main" java.lang.Exception: namespace 'vertoid' not found after loading '/vertoid'
[java] at clojure.core$load_one__5701.invoke(core.clj:3623)
[java] at clojure.core$compile__5756$fn__5758.invoke(core.clj:3794)
[java] at clojure.core$compile__5756.invoke(core.clj:3793)
[java] at clojure.lang.Var.invoke(Var.java:346)
[java] at clojure.lang.Compile.main(Compile.java:56)
[tbrady@tbrady-mbp:sandbox/vertoid]$ ant compile (09-10 19:35)
Buildfile: build.xml
clean:
prepare:
[mkdir] Created dir: /Users/tbrady/src/sandbox/vertoid/classes
[unzip] Expanding: /Users/tbrady/src/sandbox/vertoid/extLibs/clojure-contrib.jar into /Users/tbrady/src/sandbox/vertoid/classes
[unzip] Expanding: /Users/tbrady/src/sandbox/vertoid/extLibs/clojure.jar into /Users/tbrady/src/sandbox/vertoid/classes
[unzip] Expanding: /Users/tbrady/src/sandbox/vertoid/extLibs/vertica_3.0_jdk_5.jar into /Users/tbrady/src/sandbox/vertoid/classes
@travisbrady
travisbrady / gist:3034802
Created July 2, 2012 18:37
OCaml module question
type side = Buy | Sell
module type SideType = sig
val side : side
end
module Blah(S : SideType) = struct
let better = if S.side = Buy then (>) else (<)
let worse = if S.side = Buy then (<) else (>)
end
(* Get line from stdin without blowing the stack *)
let get_row u =
try
Some (input_line stdin)
with End_of_file ->
None
@travisbrady
travisbrady / ctz.py
Created December 31, 2012 18:20
Count trailing zero bits
#Python version of http://graphics.stanford.edu/~seander/bithacks.html
MultiplyDeBruijnBitPosition = (0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9)
deBruijnSeq = 0x077CB531
def lsb(v):
return MultiplyDeBruijnBitPosition[((v & -v) * deBruijnSeq) >> 27]
@travisbrady
travisbrady / sbitmap.py
Last active December 10, 2015 21:48
Self-Learning Bitmap algorithm for distinct value (cardinality estimation) From the paper here: http://ect.bell-labs.com/who/aychen/sbitmap4p.pdf
"""
Based on the paper: Distinct Counting with a Self-Learning Bitmap
http://ect.bell-labs.com/who/aychen/sbitmap4p.pdf
Author: Travis Brady
"""
from math import log
from bitarray import bitarray
#from murmur3 import hash128_64
from cityhash import CityHash64
@travisbrady
travisbrady / opam
Created March 13, 2013 23:13
opam install cohttp failure
vagrant@precise64:/massrel/tukeybase$ opam install cohttp
The following actions will be performed:
- install re.1.2.0 [required by cohttp]
- install uri.1.3.6 [required by cohttp]
- install cohttp.0.9.5
3 to install | 0 to reinstall | 0 to upgrade | 0 to downgrade | 0 to remove
Do you want to continue ? [Y/n] Y
=-=-= Installing re.1.2.0 =-=-=
Downloading http://opam.ocamlpro.com/archives/re.1.2.0+opam.tar.gz.
~/code/twitter-proxy(branch:master*) » ./sbt-development "run server" travisbrady@TACOJOCK
Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future
[info] Loading project definition from /Users/travisbrady/code/twitter-proxy/project
[info] Set current project to Twitter Proxy (in build file:/Users/travisbrady/code/twitter-proxy/)
[warn] Potentially incompatible versions of dependencies of {file:/Users/travisbrady/code/twitter-proxy/}default-2ac863:
[warn] org.scala-lang: 2.10.1, 2.10.0
[info] Compiling 1 Scala source to /Users/travisbrady/code/twitter-proxy/target/scala-2.10/classes...
[info] Running com.massrel.twitterproxy.ProxyService server
[error] (run-main) java.lang.UnsupportedClassVersionError: com/y
val h = jdbi.open()
val res = h.createQuery(sql)
.bind("start", start)
.bind("end", end)
.list()
h.close()