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 make-cdf | |
"Given a seq of numbers, return a plottable vector of [x,y] pairs | |
representing the cumulative distribution function. | |
Ex: | |
(cdf-data [1 2 1 3]) | |
; => [[1 0] [1 1/2] [2 3/4] [3 1]]" | |
[xs] | |
{:pre [(sequential? xs)]} | |
(let [n (count xs) | |
uniq-xs (->> xs frequencies (into (sorted-map))) |
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
(ns s3-presigned-url | |
"You can pre-sign an S3 path to allow users to access it without credentials. | |
This gives fine-grained access control with expiration to 'anonymous' (from | |
the perspective of S3) users. It's a convenient mechanism, if you can get it | |
to work. | |
There are some relatively well-trod paths for doing pre-signed S3 URLs, e.g. | |
when giving read-only access via an HTTP GET request. These paths have more | |
convenient and well-known mechanisms out there. |
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
ec2-ssh () | |
{ | |
local host="ec2-user@$1"; | |
local opts; | |
opts="-i $HOME/TestKeyPair.pem"; | |
opts="$opts -o UserKnownHostsFile=/dev/null"; | |
opts="$opts -o StrictHostKeyChecking=no"; | |
scp $opts ~/aws-bashrc $host:.bashrc && ssh $opts ec2-user@$@ | |
} |
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
(ns perftest.core | |
(:require | |
[clojure.java.io :as io])) | |
(defn perftest | |
[] | |
(with-open [writer (io/writer "times.out")] | |
(let [bigseq (range 1e8)] | |
(doall | |
(for [item bigseq] |
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
#!/bin/bash | |
# Referenced in Leiningen Issue #1190, here: | |
# https://github.com/technomancy/leiningen/issues/1190 | |
if [ ! -z `ls -A | egrep -v '^(main|child|grandchild|greatgrandchild|setup-3level-lein-checkouts.sh)$'` ]; then | |
echo "Cowardly refusing to continue in a directory with unrecognized files." | |
exit 0 | |
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
#!/bin/bash | |
# Referenced in Leiningen Issue #1180, here: | |
# https://github.com/technomancy/leiningen/issues/1180 | |
if [ ! -z `ls -A | egrep -v '^(main|child|grandchild|setup-nested-lein-projects.sh)$'` ]; then | |
echo "Cowardly refusing to continue in a directory with unrecognized files." | |
exit 0 | |
fi |
NewerOlder