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
; to be run in lein repl | |
(require 'langohr.core) | |
(require '[langohr.queue :as lq]) | |
(require '[langohr.basic :as lb]) | |
(require '[langohr.consumers :as lc]) | |
; langohr.core/*default-config* | |
; default port is 5672 - running on 5004 as it is forwarded to rabbitmq on docker | |
(def conn (langohr.core/connect {:hostname "localhost" :port 5004})) |
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
package com.ajk; | |
import clojure.lang.IFn; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import static clojure.java.api.Clojure.read; | |
import static clojure.lang.RT.loadResourceScript; | |
import static clojure.lang.RT.var; |
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
(ns batchreq.t-core | |
(:use midje.sweet) | |
(:use [batchreq.core])) | |
(facts "load some snippets" | |
(fact "all returned in parallel" | |
(count (request-snippets in-parallel)) => 20) | |
(fact "all returned sequentially" |
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
// publish a message to an SNS topic | |
var AWS = require('aws-sdk'); | |
AWS.config.loadFromPath('./config.json'); | |
var sns = new AWS.SNS(); | |
var params = { | |
TopicArn : "arn:your-topic-arn", | |
Message: "Hello World" | |
}; |
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
echo "Cleaning up existing mysql container" | |
echo "Stopping mysql container..." | |
docker stop mysql | |
echo "Removing mysql container..." | |
docker rm mysql | |
echo "Starting mysql container..." | |
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:5.6 |
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
(import com.github.tomakehurst.wiremock.WireMockServer) | |
(import com.github.tomakehurst.wiremock.core.WireMockConfiguration) | |
(def wiremock-config (.port (new WireMockConfiguration) 11111)) | |
(def wiremock-server (new com.github.tomakehurst.wiremock.WireMockServer wiremock-config)) | |
(.start wiremock-server) | |
(.stop wiremock-server) |
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
Useful Wiremock Calls | |
# View all stubbed enpoints (GET) | |
http://localhost:11111/__admin/ | |
# View all requests to WM (POST) | |
http://localhost:11111/__admin/requests/find | |
body: | |
{ |
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
; start a repl (lein repl) then paste in the following: | |
(defn calculate-all [input] | |
(defn calculate-item [idx item] | |
(let [split (split-at idx input) | |
actual-before (set (first split)) | |
needed-before (set (range 1 item))] | |
(clojure.set/superset? actual-before needed-before))) | |
(map-indexed calculate-item input)) |
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
; attempt 4 - using weighted quick union, always puts the smaller tree under the bigger tree to reduce depth | |
(def nodes (atom {})) | |
(def sizes (atom {})) | |
(defn find-root [i] | |
(let [v (get @nodes i)] | |
(loop [i v] | |
(if (= i v) | |
v |
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
# | |
# Oracle Java 8 Dockerfile | |
# | |
# https://github.com/dockerfile/java | |
# https://github.com/dockerfile/java/tree/master/oracle-java8 | |
# | |
# Pull base image. | |
FROM ubuntu:15.04 |
OlderNewer