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
| package consumer | |
| import ( | |
| "errors" | |
| "testing" | |
| "github.com/bitly/go-nsq" | |
| ) | |
| // tests nsq.HandlerFunc. just write the function in line in the test |
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
| use Mix.Config | |
| config KafkaEx, | |
| brokers: [{"localhost", 9092}] |
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
| input { | |
| file { | |
| path => "/tmp/doof/*" | |
| codec => "gzip_lines" | |
| start_position => "beginning" | |
| } | |
| } | |
| output { | |
| kafka { |
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
| package main | |
| // simple example to show how to process one message at a time with nsq using the go-nsq client library. | |
| // see config stuff in var below to play around with different scenarios. | |
| import ( | |
| "log" | |
| "os" | |
| "os/signal" | |
| "strconv" |
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 rediscache | |
| (:require [taoensso.carmine :as car :refer (wcar)]) | |
| (:require [clojure.core.cache :as cc] | |
| [clojure.core.memoize :refer [build-memoizer]]) | |
| (:import clojure.core.memoize.PluggableMemoization)) | |
| (def server1-conn {:pool {} :spec {:host "localhost" :port 6379}}) ;; XXX config here | |
| (defmacro wcar* [& body] `(car/wcar server1-conn ~@body)) |
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 redisqueue | |
| (:require [taoensso.carmine :as car :refer (wcar)] | |
| [taoensso.carmine.message-queue :as car-mq])) | |
| (def server1-conn {:pool {} :spec {:host "localhost" :port 6379}}) ;; XXX config here | |
| (defmacro wcar* [& body] `(car/wcar server1-conn ~@body)) | |
| (defn create-worker | |
| [queue handler-fn & {:keys [server-spec monitor-fn nthreads] |
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
| bash-3.2$ pwd | |
| /Users/jrotenberg/adptrs | |
| bash-3.2$ lein deps :tree | |
| Possibly confusing dependencies found: | |
| [sonian/carica "1.1.0"] -> [org.clojure/tools.reader "0.8.3"] | |
| overrides | |
| [org.immutant/immutant "2.1.0"] -> [org.immutant/transactions "2.1.0"] -> [org.immutant/core "2.1.0"] -> [org.clojure/tools.reader "0.8.13"] | |
| and | |
| [org.immutant/immutant "2.1.0"] -> [org.immutant/web "2.1.0"] -> [org.immutant/core "2.1.0"] -> [org.clojure/tools.reader "0.8.13"] | |
| and |
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 stuff.file-cache | |
| (:require [clj-time.core :as t]) | |
| (:require [clojure.java.io :as io]) | |
| (:require [taoensso.nippy :as nippy]) | |
| (:import [java.io DataInputStream DataOutputStream])) | |
| ;; This was just a quick experiment. I wanted to cache some lookup tables from a database. Rather than memoize each one individually, | |
| ;; though, I just wanted the whole chunk at once, the use case being a big table in Oracle that only changed periodically. I would use this | |
| ;; to cache on disk, and then also cache each one in memory, so even if the app restarted it wouldn't have to hit the database more than | |
| ;; once per 24 hour period. Worked ok in development, never quite made it to production. |
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 opposite? | |
| "Returns true if x and y are opposite numbers, false otherwise." | |
| [x y] | |
| (and (zero? (+ x y)) | |
| (every? (complement zero?) [x y]))) |
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 com.fire.kingdom.flambit | |
| (:require [flambo.api :as f] | |
| [flambo.tuple :as ft] | |
| [clojure.string :as s]) | |
| (:import [com.datastax.spark.connector.japi CassandraJavaUtil])) | |
| ; in Cassandra ... | |
| ; CREATE KEYSPACE test WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1 }; | |
| ; CREATE TABLE test.words (word text PRIMARY KEY, count int); |