Skip to content

Instantly share code, notes, and snippets.

View landon9720's full-sized avatar

Landon Kuhn landon9720

View GitHub Profile
@landon9720
landon9720 / null-uuid.txt
Created February 2, 2016 19:24
UUID with all zeros
00000000-0000-0000-0000-000000000000
rows.sortBy(r => (r.lastName, r.firstName))
aws s3 cp s3://yourbucket/yourkey.gz - | gzcat
pv < yourfile.csv | psql -c "copy yourtable from STDIN;"
brew install gist; gist -f filename -Po
implicit def `joda datetime ordering`: Ordering[DateTime] = Ordering.fromLessThan(_ isBefore _)
@landon9720
landon9720 / gist:3005647
Created June 27, 2012 17:47
disable OS X quarantine, disable OS X dock bounce notification
sudo defaults write com.apple.LaunchServices LSQuarantine -bool NO
sudo defaults write com.apple.dock no-bouncing -bool TRUE
@landon9720
landon9720 / game_of_life.scala
Created June 27, 2012 13:33
Conway's Game of Life, using Processing, written in Scala
// Conway's Game of Life, using Processing, written in Scala
// see: http://en.wikipedia.org/wiki/Conway's_Game_of_Life
// see: http://processing.org/
// see: http://www.scala-lang.org/
// run using processing-scala-sbt:
// https://github.com/landon9720/processing-scala-sbt
// this code is by Landon Kuhn
@landon9720
landon9720 / prime-factors.scala
Created June 25, 2012 17:43
prime factorization in scala
// borrowed from http://louisbotterill.blogspot.com/2009/03/prime-factorization-comparison-between.html
def factors(n:Int):List[Int] = {
def divides(d:Int, n:Int) = (n % d) == 0
def ld(n:Int):Int = ldf(2, n)
def ldf(k:Int, n:Int):Int = {
if (divides(k, n)) k
else if ((k*k) > n) n
else ldf((k+1), n)
}
n match {