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 / 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))))))
@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 / 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 / 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: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 / 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 / processor all.launch-output
Created September 28, 2016 03:50
Artifact Listener - Eclipse "processor all.launch" output
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Artifact Listener
[INFO] Artifact Listener - Core
[INFO] Artifact Listener - Init
[INFO] Artifact Listener - Web Application
[INFO]
[INFO] ------------------------------------------------------------------------
@lhanson
lhanson / MavenArtifactNotifierInitFromExcelMain.output
Created September 28, 2016 03:53
Artifact Listener - MavenArtifactNotifierInitFromExcelMain output
[2016-09-27 22:52:03,704] WARN - pertyPlaceholderConfigurer - - Could not load properties from URL [file:/etc/maven-artifact-notifier/configuration.properties]: /etc/maven-artifact-notifier/configuration.properties (No such file or directory)
[2016-09-27 22:52:03,706] WARN - pertyPlaceholderConfigurer - - Could not load properties from class path resource [configuration-MY_USERNAME.properties]: class path resource [configuration-MY_USERNAME.properties] cannot be opened because it does not exist
[2016-09-27 22:52:05,334] WARN - bernatePersistenceProvider - - Installing our Spring managed interceptor.
[2016-09-27 22:52:05,645] WARN - stractEhcacheRegionFactory - - HHH020003: Could not find a specific ehcache configuration for cache named [fr.openwide.core.jpa.externallinkchecker.business.model.ExternalLinkWrapper]; using defaults.
[2016-09-27 22:52:05,667] WARN - stractEhcacheRegionFactory - - HHH020003: Could not find a specific ehcache configuration for cache named [fr.openwide.maven.artifact.notifi
@lhanson
lhanson / maven-artifact-notifier-psql.output
Created October 11, 2016 22:51
PostgreSQL output during invocation of MavenArtifactNotifierInitFromExcelMain
ERROR: constraint "ukh3vbwatl9grndwud5gmoyd0gk" of relation "artifact" does not exist
STATEMENT: alter table Artifact drop constraint UKh3vbwatl9grndwud5gmoyd0gk
ERROR: constraint "uk_s9isu7vl7b611kenaw5xa8tya" of relation "artifactgroup" does not exist
STATEMENT: alter table ArtifactGroup drop constraint UK_s9isu7vl7b611kenaw5xa8tya
ERROR: constraint "uke25bklx8h4v3otrp371ciis37" of relation "artifactversion" does not exist
STATEMENT: alter table ArtifactVersion drop constraint UKe25bklx8h4v3otrp371ciis37
ERROR: constraint "uk_l3rpahijrmparse329xqpq7v7" of relation "emailaddress" does not exist
STATEMENT: alter table EmailAddress drop constraint UK_l3rpahijrmparse329xqpq7v7
ERROR: constraint "uko2m0g8gd71syiu35joaie04og" of relation "followedartifact" does not exist
STATEMENT: alter table FollowedArtifact drop constraint UKo2m0g8gd71syiu35joaie04og
@lhanson
lhanson / MavenArtifactNotifierInitFromExcelMain.2.output
Created October 23, 2016 22:35
maven-artifact-notifier-core compilation error
[2016-10-23 17:28:38,343] WARN - pertyPlaceholderConfigurer - - Could not load properties from URL [file:/etc/maven-artifact-notifier/configuration.properties]: /etc/maven-artifact-notifier/configuration.properties (No such file or directory)
[2016-10-23 17:28:38,345] WARN - pertyPlaceholderConfigurer - - Could not load properties from class path resource [configuration-ldhanson2.properties]: class path resource [configuration-ldhanson2.properties] cannot be opened because it does not exist
[2016-10-23 17:28:39,965] WARN - bernatePersistenceProvider - - Installing our Spring managed interceptor.
[2016-10-23 17:28:40,302] WARN - stractEhcacheRegionFactory - - HHH020003: Could not find a specific ehcache configuration for cache named [fr.openwide.core.jpa.externallinkchecker.business.model.ExternalLinkWrapper]; using defaults.
[2016-10-23 17:28:40,324] WARN - stractEhcacheRegionFactory - - HHH020003: Could not find a specific ehcache configuration for cache named [fr.openwide.maven.artifact.notifier.c