Skip to content

Instantly share code, notes, and snippets.

View gphil's full-sized avatar

Greg Phillips gphil

View GitHub Profile
Verifying that +gphil is my openname (Bitcoin username). https://onename.io/gphil
(defn run-job
[]
(future sub-job-1)
(future sub-job-2)
(future sub-job-3)
(future sub-job-4))
(run-job)
@gphil
gphil / group.sql
Created September 4, 2012 19:57
Using GROUP BY instead of HAVING
SELECT icps.city, icps.state, icps.ice_cream_parlor
FROM ice_cream_parlors icps
INNER JOIN (
SELECT city, state, count(ice_cream_parlor) icp_count
FROM ice_cream_parlors icps
GROUP by city, state
) sq
ON icps.city = sq.city and icps.state = sq.state
GROUP BY icps.city, icps.state, icps.ice_cream_parlor
WHERE sq.icp_count > 5;
@gphil
gphil / having.sql
Created September 4, 2012 19:56
Having Clause
SELECT city, state, ice_cream_parlor
FROM ice_cream_parlors icps
GROUP BY city, state
HAVING count(ice_cream_parlor) > 5;
@gphil
gphil / gist:3625561
Created September 4, 2012 19:45
slf4j log4j adapter lein dependency
[org.slf4j/slf4j-log4j12 "1.6.6"]
@gphil
gphil / gist:3625496
Created September 4, 2012 19:39
clojure.tools.logging lein dependency
[org.clojure/tools.logging "0.2.3"]
@gphil
gphil / gist:3625485
Created September 4, 2012 19:38
log4j lein dependency
[log4j "1.2.15" :exclusions [javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]
@gphil
gphil / SLFJ-NOP.txt
Created September 4, 2012 18:56
SLFJ NOP Message
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
@gphil
gphil / log4j.properties
Created September 4, 2012 18:52
Basic log4j Configuration
log4j.rootLogger=DEBUG, standard
log4j.appender.standard = org.apache.log4j.RollingFileAppender
log4j.appender.standard.File = logs/standard.log
log4j.appender.standard.MaxFileSize=1MB
log4j.appender.standard.MaxBackupIndex=1
log4j.appender.standard.layout=org.apache.log4j.PatternLayout
log4j.appender.standard.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
@gphil
gphil / scoring_project.rb
Created August 2, 2012 22:28
scoring_project
def score(dice)
d = {}
dice.each do |i|
d[i] ||= 0
d[i] += 1
end
n = 0
d.each do |k, v|
if v >= 3
if k == 1