Skip to content

Instantly share code, notes, and snippets.

View lhanson's full-sized avatar

Lyle Hanson lhanson

  • Madison, WI
View GitHub Profile
@lhanson
lhanson / 01.make
Created September 27, 2012 14:55
git-1.7.12.1 failed to build on 10.8
GIT_VERSION = 1.7.12.1
* new build flags
* new link flags
cc -o base85.o -c -MF ./.depend/base85.o.d -MMD -MP -I. -DPRECOMPOSE_UNICODE -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DXDL_FAST_HASH -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM -DSHELL_PATH='"/bin/sh"' base85.c
* new prefix flags
cc -o bisect.o -c -MF ./.depend/bisect.o.d -MMD -MP -I. -DPRECOMPOSE_UNICODE -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DXDL_FAST_HASH -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM -DSHELL_PATH='"/bin/sh"' bisect.c
cc -o blob.o -c -MF ./.depend/blob.o.d -MMD -MP -I. -DPRECOMPOSE_UNICODE -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DXDL_FAST_HASH -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM -DSHELL_PATH='"/bin/sh"' blob.c
cc -o branch.o -c -MF ./.depend/branch.o.d -MMD -MP -I. -DPRECOMPOSE_UNICODE -DUSE_ST_TIMESPEC -DNO_GETTEXT -DHAVE_DEV_TTY -DXDL_FAST_HASH -DSHA1_HEADER='<openssl/sha.h>' -DNO_MEMMEM -DSHELL_PATH='"/bin/sh"' branch.c
cc -o bulk-checkin.o -c -MF ./.depend/bulk-checkin.o.
@lhanson
lhanson / gist:2149600
Created March 21, 2012 17:08
clojure.data.json error
(use '[clojure.data.json :only (read-json json-str)])
(require '[clj-http.client :as client])
(def url "http://api.twitter.com/1/statuses/show/177093052035375104.json")
(read-json (client/get url))
@lhanson
lhanson / gist:1808500
Created February 12, 2012 13:30
Error running "lein trampoline irepl"
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:421)
@lhanson
lhanson / gist:1168880
Created August 24, 2011 19:02
Enlive selector-step
(use '[net.cgrand.enlive-html :as html])
(def markup (html/html-resource (java.io.StringReader.
"<html><body><div><img src='1.png'/><div><img src='nested.png'/></div></div></body></html>")))
; I want to select the first img
; This selects all images, as expected
(html/select markup [:img])
;matches: ({:tag :img, :attrs {:src "1.png"}, :content nil} {:tag :img, :attrs {:src "nested.png"}, :content nil})
@lhanson
lhanson / initDotFiles.py
Created August 22, 2011 20:30
Dotfile repo initialization script
#!/usr/bin/env python
# Sets up the users's dotfiles as links to the git-versioned ones in .dotfiles.
# It wouldn't be tough to just scan the dotfiles dir to see what matches up
# with a dotfile in ~ and link based on that, but for now I'm explicitly
# listing which files to track.
import os
import shutil
# Key is the dotfile in the home directory, the value is location in the
@lhanson
lhanson / lazy-sieve.clj
Created October 12, 2010 17:24
Lazy implementation of the sieve of Eratosthenes
(defn vector-comparator [a b]
"Orders vectors by the first element which differs"
(loop [v1 a v2 b]
(let [comparison (compare (first v1) (first v2))]
(cond (and (empty? v1) (empty? v2)) 0
(empty? v1) -1
(empty? v2) 1
(not= 0 comparison) comparison
:else (recur (rest v1) (rest v2))))))