Skip to content

Instantly share code, notes, and snippets.

@toby
toby / gist:3783867
Created September 25, 2012 19:18
Lazy select with Korma
(ns something.cool
(:use [korma.core]))
(def page-size 20)
(defn lazy-select
"Creates a lazy sequence of sql results by batch selecting."
([statement]
(lazy-select statement 0))
([statement o]
arkanoid:~ toby$ ping www.google.com
PING www.google.com (74.125.131.106): 56 data bytes
64 bytes from 74.125.131.106: icmp_seq=0 ttl=45 time=32.454 ms
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
64 bytes from 74.125.131.106: icmp_seq=3 ttl=45 time=38.050 ms
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
64 bytes from 74.125.131.106: icmp_seq=7 ttl=45 time=33.073 ms
@toby
toby / mkjava.sh
Created August 19, 2013 01:04
Ubuntu Oracle Java Install
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu quantal main" >> /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu quantal main" >> /etc/apt/sources.list
apt-get update
apt-get -y install oracle-java7-installer
apt-get -y install oracle-java7-set-default

Keybase proof

I hereby claim:

  • I am toby on github.
  • I am toby (https://keybase.io/toby) on keybase.
  • I have a public key whose fingerprint is 8322 D2CE 33FD F3A8 475E 0A85 7011 E469 37DA CC15

To claim this, I am signing this object:

# switch to ctl-a
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
# fix copy paste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
set-option -g default-command "reattach-to-user-namespace -l bash"
# reload config key
(ns backrack.bloom
(:import [java.lang Math])
(:use [digest :only [sha-256]]))
(deftype Bloom [m k f]
Object
(equals [this b2]
(and (= (.m this) (.m b2)) (= (.k this) (.k b2)) (= (.f this) (.f b2))))
(toString [this]
(str "m: " (.m this) " k: " (.k this))))
// Monads! >>= >> return
import Foundation
infix operator >>= { associativity left }
func >>=<A,B> (left: Optional<A>, right: A -> Optional<B>) -> Optional<B> {
if left == nil {
return nil
} else {

willing vanilli

  • Michael Jackson – Keep the Faith
  • Tina Turner – I Can't Stand The Rain
  • Prince – Let's Pretend We're Married
  • Fishbone – When Problems Arise

Nikes

  • Marty Friedman – Cheer Girl Rampage
  • Type O Negative – (We Were) Electrocute
  • The Unicorns – Jellybones
@toby
toby / pour-over.md
Last active February 24, 2016 18:48
osascript -ss -e 'tell application "iTunes" to {|artists|: artist, |albums|: album, |tracks|: name, |added|: date added} of tracks of library playlist 1' | sed 's/[[:<:]]date[[:>:]]//g' | sed "s/:{/:[/g" | sed "s/}}/]}/g" | sed "s/},/],/g" | sed "s/artists:/\"artists\":/g" | sed "s/albums:/\"albums\":/g" | sed "s/tracks:/\"tracks\":/g" | sed "s/added:/\"added\":/g" | python -c 'from __future__ import print_function; import sys, json; reload(sys); sys.setdefaultencoding("utf-8"); x = json.load(sys.stdin); map(lambda t: print(t[0] + "\t" + t[1] + "\t" + t[2] + "\t" + t[3]), zip(x["artists"], x["albums"], x["tracks"], x["added"]))'