Skip to content

Instantly share code, notes, and snippets.

azs = [:a, :b, :c]
cidr_block_lookup = {
public: { a: '172.20.0.0/24',
b: '172.20.1.0/24',
c: '172.20.2.0/24' },
private: { a: '172.20.8.0/24',
b: '172.20.9.0/24',
c: '172.20.10.0/24' }
}
(expect (partial apply =)
(from-each [[result sexp] {
3 3
true true
2 '(+ 1 1)
;; POTENTIALLY LOADS MORE EGS
}
]
[result (eval sexp)]))
user> (def a [[1 2] [3 4] [5 6]])
#'user/a
user> (def b [[1 7] [2 8] [5 6]])
#'user/b
user> (map (fn [[a b] [c d]]
(if (= a c)
[b d]))
a
(defn percentiles [xs]
(let [sorted (sort xs)
how-many (count sorted)
percentile (fn [n]
(let [idx (Math/floor (* how-many (/ n 100)) )]
(nth sorted idx)))]
{:mean (mean xs)
:median (percentile 50)
:90 (percentile 90)
:95 (percentile 95)
FROM ubuntu
RUN apt-get update
RUN apt-get install -qq -y wget python-software-properties software-properties-common zip curl ruby1.9.1
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get install -qq -y oracle-java7-installer
(fn [cards]
(let [card-type (fn [input]
(let [[suit rank] (rest
(clojure.string/split input #""))
suits {"D" :diamond
"H" :heart
"C" :club}
ranks (zipmap (map
str '[2 3 4 5 6 7 8 9 T J Q K A])
(range 13))]
@thattommyhall
thattommyhall / erm.js
Created September 15, 2013 00:21
Useful?
This file has been truncated, but you can view the full file.
var CLOSURE_NO_DEPS = true;
var COMPILED = false;
var goog = goog || {};
goog.global = this;
goog.DEBUG = true;
goog.LOCALE = "en";
goog.provide = function(name) {
if(!COMPILED) {
if(goog.isProvided_(name)) {
throw Error('Namespace "' + name + '" already declared.');
#!/bin/sh
syntax_errors=0
error_msg=$(mktemp /tmp/error_msg.XXXXXX)
if git rev-parse --quiet --verify HEAD > /dev/null
then
against=HEAD
else
# Initial commit: diff against an empty tree object
(ns groupings-clj.core
(:use [clojure.java.io :as io])
(:require [clojure.string :as str])
(:import (org.apache.lucene.analysis Analyzer PorterStemFilter PorterStemmer)
(org.apache.lucene.analysis.standard StandardAnalyzer)
(org.apache.lucene.util Version)
(org.apache.lucene.analysis.tokenattributes TermAttribute)
(org.apache.lucene.analysis.standard StandardTokenizer)
;; (org.apache.lucene.analysis.en PorterStemFilter PorterStemmer)
(ns groupings-clj.core
(:use [clojure.java.io :as io])
(:require [clojure.string :as str])
(:import (org.apache.lucene.analysis Analyzer PorterStemFilter PorterStemmer)
(org.apache.lucene.analysis.standard StandardAnalyzer)
(org.apache.lucene.util Version)
(org.apache.lucene.analysis.tokenattributes TermAttribute)
(org.apache.lucene.analysis.standard StandardTokenizer)
;; (org.apache.lucene.analysis.en PorterStemFilter PorterStemmer)