Skip to content

Instantly share code, notes, and snippets.

@zakwilson
zakwilson / skummet-fail
Created April 21, 2017 14:17
Skummet fails to compile Ceilingbounce
zak@bigbox ceilingbounce $ lein with-profile lean do clean, droid doall
Generating manifest...
Generating R.java files...
Compiling 3 source files to /media/zak/bd07aeae-4895-4289-88fe-329b1b7b92a2/code/ceilingbounce/target/classes
Compiling Clojure files...
Build type: debug, dynamic compilation: enabled, remote REPL: enabled.
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: clojure.core/*lean-var?* in this context, compiling:(/tmp/form-init52165355158824598.clj:1:269)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6740)
at clojure.lang.Compiler.analyze(Compiler.java:6534)
at clojure.lang.Compiler.analyze(Compiler.java:6495)
(first-truthy
(get-it-from-the-cache)
(get-it-from-the-network)
(ask-the-user)
(make-up-random-value)
(defmacro silence-errors [& body]
"Evaluate body and return the result, or nil if an exception is thrown"
`(try ~@body
(catch Exception e#)))
(defmacro first-truthy [& body]
"Try some expressions; return the result of the first one that neither throws an exception or returns false or nil"
(cons 'or (map (fn [item]
(list 'silence-errors item))
`~body)))
(defmacro silence-errors [& body]
"Evaluate body and return the result, or nil if an exception is thrown"
`(try ~@body
(catch Exception e#)))
(defmacro first-truthy [& body]
"Try some expressions; return the result of the first one that neither throws an exception or returns false or nil"
(cons 'or (map (fn [item]
(list 'silence-errors item))
`~body)))
(import [clojure.set])
(defn make-doors []
(rand-nth [[true false false]
[false true false]
[false false true]]))
(defn reveal-door [choice doors]
(let [choices (filter #(not (= choice %)) [0 1 2])]
(rand-nth (filter #(not (doors %)) choices))))
import praw
r = Reddit(user_agent = 'Test app by /u/zak with PRAW')
r.login(username=username, password=password)
messages = r.get_inbox()
with open('inbox.txt', 'rw') as outfile:
while message = messages.next():
outfile.write("Author: %s\n" % message.author.name)
outfile.write("Subject: %s\n" % message.subject)
@zakwilson
zakwilson / gist:1b408e5ec1d5072bfb88
Created November 25, 2014 22:52
Output of a misconfigured spam program
{
{I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today,
yet I never found any interesting article like yours.
{It’s|It is} pretty worth enough for me. {In my opinion|Personally|In my view},
if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn’t|could not} {resist|refrain from} commenting.
{Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I’ll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed}
# Generated by iptables-save v1.4.20 on Tue Jun 3 17:10:17 2014
*mangle
:PREROUTING ACCEPT [859:415004]
:INPUT ACCEPT [799:411017]
:FORWARD ACCEPT [60:3987]
:OUTPUT ACCEPT [743:81800]
:POSTROUTING ACCEPT [803:85787]
COMMIT
# Completed on Tue Jun 3 17:10:17 2014
# Generated by iptables-save v1.4.20 on Tue Jun 3 17:10:17 2014
s[{"value":"aSRpbnRlcnNlY3Rpb25fc3RyZWV0X25hbWU9UEFSSyxpbnRlcnNlY3Rpb25fc3RyZWV0X211bmljaXBhbGl0eT1KQUNLU09OVklMTEUsaW50ZXJzZWN0aW9uX3N0cmVldF90eXBlPVNULGludGVyc2VjdGlvbl9zdHJlZXRfb3JpZW50YXRpb249LGludGVyc2VjdGlvbl9pbnRlcl9uYW1lPVJPT1NFVkVMVCxpbnRlcnNlY3Rpb25faW50ZXJfbXVuaWNpcGFsaXR5PUpBQ0tTT05WSUxMRSxpbnRlcnNlY3Rpb25faW50ZXJfdHlwZT1CTFZELGludGVyc2VjdGlvbl9pbnRlcl9vcmllbnRhdGlvbj0="},{"value":"aSRpbnRlcnNlY3Rpb25fc3RyZWV0X25hbWU9UEFSSyxpbnRlcnNlY3Rpb25fc3RyZWV0X211bmljaXBhbGl0eT1KQUNLU09OVklMTEUsaW50ZXJzZWN0aW9uX3N0cmVldF90eXBlPVNULGludGVyc2VjdGlvbl9zdHJlZXRfb3JpZW50YXRpb249LGludGVyc2VjdGlvbl9pbnRlcl9uYW1lPU9SVEVHQSxpbnRlcnNlY3Rpb25faW50ZXJfbXVuaWNpcGFsaXR5PUpBQ0tTT05WSUxMRSxpbnRlcnNlY3Rpb25faW50ZXJfdHlwZT1CUkcsaW50ZXJzZWN0aW9uX2ludGVyX29yaWVudGF0aW9uPQ=="},{"value":"aSRpbnRlcnNlY3Rpb25fc3RyZWV0X25hbWU9UEFSSyxpbnRlcnNlY3Rpb25fc3RyZWV0X211bmljaXBhbGl0eT1KQUNLU09OVklMTEUsaW50ZXJzZWN0aW9uX3N0cmVldF90eXBlPVNULGludGVyc2VjdGlvbl9zdHJlZXRfb3JpZW50YXRpb249LGludGVyc2VjdGlvbl9pbnRlcl9uYW1lPVNSLTE1LGludGVyc2VjdGlvbl9pbn
TVPPanelBar_i0_i0_FromLocationControl_RecentDynamicComboBox_ClientState:{"SelectedIndex":-1,"ReQueryText":""}
TVPPanelBar_i0_i0_FromLocationControl_StopMunicipalityDynamicComboBox_ClientState:{"SelectedIndex":0,"ReQueryText":"JACKSONVILLE"}
TVPPanelBar_i0_i0_FromLocationControl_StopMunicipalityDynamicComboBoxManager_ClientState:{"ChildIdsCount":1,"ChildIds0":"Sys.Application.findComponent(\u0027TVPPanelBar_i0_i0_FromLocationControl_StopDynamicComboBox\u0027)","ParentIdsCount":0,"ManagedDynamicComboBoxID":"Sys.Application.findComponent(\u0027TVPPanelBar_i0_i0_FromLocationControl_StopMunicipalityDynamicComboBox\u0027)"}
TVPPanelBar_i0_i0_FromLocationControl_StopDynamicComboBox_ClientState:{"SelectedIndex":-1,"ReQueryText":""}
TVPPanelBar_i0_i0_FromLocationControl_StopDynamicComboBoxManager_ClientState:{"ChildIdsCount":0,"ParentIdsCount":1,"ParentIds0":"Sys.Application.findComponent(\u0027TVPPanelBar_i0_i0_FromLocationControl_StopMunicipalityDynamicComboBox\u0027)","ManagedDynamicComboBoxID":"Sys.Application.fin