Internet Scale Services Checklist: A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
System Design Cheatsheet :Picking the right architecture = Picking the right battles + Managing trade-offs
This file contains 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains 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 analyse | |
"Returns a transition matrix of 'depth' from 'sequences'" | |
[depth sequences] | |
(apply merge-with concat | |
(flatten | |
(map #(map (fn [k v] (hash-map k v)) | |
(partition depth 1 %) | |
(map (fn [x] (list x)) (nthrest % depth))) | |
sequences)))) |
This file contains 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 | |
# | |
# /etc/init.d/storm-nimbus | |
# | |
# Startup script for storm-nimbus | |
# | |
# chkconfig: 2345 20 80 | |
# description: Starts and stops storm-nimbus | |
#. /etc/init.d/functions | |
stormBin=/home/user/storm/storm-0.8.1/bin/storm |
This file contains 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
(use 'backtype.storm.clojure) | |
(use 'backtype.storm.config) | |
(require '[backtype.storm [thrift :as thrift]]) | |
(import 'storm.starter.spout.RandomSentenceSpout) | |
(import 'backtype.storm.LocalCluster) | |
(defboltfull suffix-bolt ["word"] | |
:params [suffix] | |
:let [conf-state (atom nil)] | |
:prepare ([conf context collector] |
This file contains 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
/docs | |
/target | |
/lib | |
/classes | |
/checkouts | |
pom.xml | |
*.jar | |
*.class | |
.lein-deps-sum | |
.lein-failures |
This file contains 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- digits [n] | |
(map #(Character/digit % 10) (str n))) | |
(defn luhn? [n] | |
(let [sum (reduce + (map | |
(fn [d idx] | |
(if (even? idx) | |
(reduce + (digits (* d 2))) | |
d)) | |
(reverse (digits n)) |
This file contains 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
Taken from [here](http://blog.marrowboy.co.uk/2011/10/21/worker-queues-in-clojure/), recording so I don't lose it: | |
```clj | |
(defn new-q [] (java.util.concurrent.LinkedBlockingDeque.)) | |
(defn offer! | |
"adds x to the back of queue q" | |
[q x] (.offer q x) q) | |
(defn take! |
This file contains 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
; Depends on [com.notnoop.apns/apns "0.1.6"]. | |
(:import ('com.notnoop.apns APNS)) | |
(defn send-push-notification [device-token message] | |
(let [service (.build (.withSandboxDestination | |
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password"))) | |
payload (.build (.alertBody (APNS/newPayload) message))] | |
(.push service device-token payload))) |
This file contains 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 model-from-sequence | |
"Returns a transition matrix of 'depth' from 'sequence'" | |
[depth sequence] | |
(loop [accum {} chunks (partition (inc depth) 1 (seq sequence))] | |
(if (seq? chunks) | |
(let [chunk (first chunks) | |
prefix (drop-last chunk) | |
suffix (last chunk)] | |
(recur (assoc accum prefix (conj (get accum prefix []) suffix)) (next chunks))) | |
accum))) |
OlderNewer