Skip to content

Instantly share code, notes, and snippets.

@ddillinger
ddillinger / gist:2258880
Created March 31, 2012 03:04
Conkeror on Unity
@ddillinger
ddillinger / wat.clj
Created April 11, 2012 13:52
Clojure wat
user=> (def bs '[a 1 b 2])
#'user/bs
user=> (type bs)
clojure.lang.PersistentVector
user=> (vector? bs)
true
user=> (let bs (+ a b))
java.lang.IllegalArgumentException: let requires a vector for its binding (NO_SOURCE_FILE:0)
@ddillinger
ddillinger / stephano_zvp.txt
Created April 11, 2012 16:41
Stephano style ZvP
Stephano-style ZvP http://drop.sc/134488
14/15 Pool
15 Hatch
Queen x2
Lings x1
23 Hatch
Queen
40 Lings x2
40 Gas x1
@ddillinger
ddillinger / snet.java
Created April 13, 2012 14:46
snet vs public
public void useSnet(){
if(snet){
}
else{
snet = true;
if(storageURL != null){
storageURL = snetAddr + storageURL.substring(8);
}
}
}
>>> db_cluster_list = ["has foo in it", "doesn't match", "has bar in it", "also doesn't match", "also has foo in it", "nothing to see here"]
>>> cluster_ignore_list = ("foo", "bar")
>>> filter(lambda x: [y for y in cluster_ignore_list if y in x], db_cluster_list)
['has foo in it', 'has bar in it', 'also has foo in it']
this short circuits:
>>> def found(x):
... for item in cluster_ignore_list:
... if item in x:
@ddillinger
ddillinger / gist:5154002
Created March 13, 2013 16:49
every clojure project name. ALL OF THEM.
$ egrep ".*ure$" /usr/share/dict/words | sed -e "s/ure/jure/"
abatjure
abbreviatjure
abjjure
acclimatjure
acrocontractjure
actjure
acuclosjure
acupressjure
@ddillinger
ddillinger / gist:db1b30d2b963bb204442
Created March 17, 2015 14:51
monty hall simulator
(ns monty.core)
;; game setup and rules
(defn gen-doors
"Generates a shuffled triple vector of two :goat and one :car entry."
[]
(shuffle [:goat :goat :car]))
(defn choose
"Randomly chooses an index into the doors and returns it."
ddillinger@ip-10-150-36-33:~> ./test-query.sh
./test-query.sh
API Location: https://api.dev.discoverstor.net
Account ID: fbc7d50f-bda0-4534-94e9-e65a2b52d692
User: sonian
Password: sonian123
Query: (and (contains body \"S\"))
API Token: https://api.dev.discoverstor.net/fbc7d50f-bda0-4534-94e9-e65a2b52d692/auth/v1/sessions/de6fd20c-ee5c-4637-989b-752fabf32831
ddillinger@ip-10-150-36-33:~> ./test-query.sh
./test-query.sh
API Location: https://api.dev.discoverstor.net
Account ID: fbc7d50f-bda0-4534-94e9-e65a2b52d692
User: sonian
Password: sonian123
Query: (and (contains body \"S\"))
API Token: https://api.dev.discoverstor.net/fbc7d50f-bda0-4534-94e9-e65a2b52d692/auth/v1/sessions/de6fd20c-ee5c-4637-989b-752fabf32831