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
(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
/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
(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
#!/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
(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
#!/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 | |
# |
NewerOlder