This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
auth = 'Token <your token>' | |
payload = [ | |
{ | |
'source': "L. Ritchie", | |
'content': [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add1(arg) { | |
return arg + 1; | |
} | |
function sub2(arg) { | |
return arg - 2 | |
} | |
function add1ToColl(coll) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodeProg=$(which node) | |
if [[ "$nodeProg" = "" ]] ; then | |
nodeProg=$(which nodejs) | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Keycap sizes | |
* ,-----------------------------------------------------------------------------------. | |
* | R3 | R3 | R3 | R3 | R3 | R3 | R3 | R3 | R3 | R3 | R3 | R3 | | |
* |------+------+------+------+------+-------------+------+------+------+------+------| | |
* | R2 | R2 | R2 | R2 | R2 | R2 | R2 | R2 | R2 | R2 | R2 | R2 | | |
* |------+------+------+------+------+------|------+------+------+------+------+------| | |
* | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| | |
* | R1 | R1 | R1 | R1 | R1 | R1x2 | R1 | R1 | R1 | R1 | R1 | | |
* `-----------------------------------------------------------------------------------' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r.db('rethinkdb') | |
.table('jobs') | |
.filter(function(j) { | |
return j('type').eq('query') | |
.and(j('duration_sec').gt(0.001)) | |
.and(j('info')('query').match('jobs').eq(null)) | |
.and(j('info')('query').match('rethinkdb').eq(null)) | |
}) | |
.changes() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get -y update | |
sudo apt-get -y install python-software-properties | |
sudo apt-add-repository ppa:openjdk-r/ppa | |
if grep elasticsearch /etc/apt/sources.list; then | |
log "ES installed" | |
else | |
curl https://packages.elasticsearch.org/GPG-KEY-elasticsearch > /tmp/es-key | |
sudo apt-key add /tmp/es-key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadPlugin match_regex | |
LoadPlugin target_set | |
PreCacheChain "RenameES" | |
<Chain "RenameES"> | |
<Rule "rename_es"> | |
<Match regex> | |
Plugin "^curl_json$" | |
PluginInstance "elasticsearch" | |
</Match> | |
<Target "set"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dependencies | |
# - rmq admin + http api | |
# - curl | |
# - jq | |
# - nc | |
while true ; do | |
for m in $(curl $rabbiturl:15672/api/queues?pretty | jq '.[] | "rabbit.queue.\(.name):\(.messages)|g"') ; do | |
echo "Submitting ${m}" | |
echo $m | nc -w 1 -u 127.0.0.1 8125 & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn do-stuff [v & opts] | |
(-> | |
v | |
first | |
:a | |
( (if opts inc identity )) | |
inc)) | |
(do-stuff [{ :a 1 :b 2 }]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn lol [x] (str "lol" x)) | |
(with-redefs-fn { #'lol (fn [x] (str "nope!" x))} | |
(fn [& _] | |
(lol 1) ;; => "nope!1" | |
)) | |
(lol 1) ;; => "lol1" |