I hereby claim:
- I am chr15m on github.
- I am chr15m (https://keybase.io/chr15m) on keybase.
- I have a public key whose fingerprint is 30AE 7153 C922 21F3 3BEE B492 09D8 C88A 5F65 515A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I would expect this: | |
(defn x [] | |
(try | |
(some-call) | |
(catch [e Exception] 1) | |
(else 2))) | |
To compile to this: |
hy.py
in management/commands/hy.py
./manage.py hy
hy 0.11.0 using CPython(default) 2.7.6 on Linux
=> (import [yourapp [settings]])
=> settings.DEBUG
True
; uses a web worker background thread | |
(let [metronome-worker-js "self.onmessage=function(e){setTimeout(function(){postMessage(e.data);},e.data.interval);};console.log('Metronome worker loaded.');" | |
worker-blob (js/Blob. (clj->js [metronome-worker-js]) {:type "application/javascript"}) | |
worker (js/Worker. (.createObjectURL js/URL worker-blob)) | |
call-id (atom 0)] | |
(defn make-worker-listener [id callback] | |
(fn [e] | |
(when (= e.data.id id) | |
(callback) |
(import [hy.models.expression [HyExpression]]) | |
(defn print-expression [expr] | |
(+ "(" (.join " " (list-comp (if (= (type x) HyExpression) (print-expression x) (str x)) [x expr])) ")")) | |
(defmacro print-eval [expr] | |
(quasiquote (do | |
(print (unquote (print-expression expr))) | |
(unquote expr)))) |
#!/bin/sh | |
while true; | |
do | |
if ! make -q "$@"; | |
then | |
echo "#-> Starting build: `date`" | |
make "$@"; | |
echo "#-> Build complete." | |
fi |
#!/bin/sh | |
# get broadcast addresses for each network | |
net=`ifconfig | grep -o -E "Bcast:(.*?) " | cut -f2 -d":"` | |
# loop over networks running the scan | |
for n in $net; | |
do | |
# first find SSH machines silently to prime the arp table | |
nmap -T4 -n -p 22 --open --min-parallelism 100 "$n/24" | grep -e "scan report for" -e "ssh" > /dev/null |
#!/usr/bin/awk -f | |
# Usage: | |
# zcat -f access.log.* | ./extract-latest-log-date.awk > latest-log.txt | |
BEGIN { | |
# pre-compute months field lookup | |
m=split("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec",d,"|") | |
for(o=1;o<=m;o++){ | |
months[d[o]]=sprintf("%02d",o) |
#!/usr/bin/env python | |
import webbrowser | |
import subprocess | |
def git(*args): | |
return subprocess.check_output(["git"] + list(args)) | |
remote, branch = git("rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}").split("/") | |
repo = git("config", "--get", "remote." + remote + ".url").split(":").pop().replace(".git", "").strip("\n") |
#!/usr/bin/env python | |
# two hex encoded strings coming in on stdin | |
# will get xored and output as a hex encoded string | |
import fileinput | |
lines = [l for l in fileinput.input()] | |
print hex(int(lines[0], 16) ^ int(lines[1], 16)).replace("0x", "").rstrip("L") |