Skip to content

Instantly share code, notes, and snippets.

View joshrotenberg's full-sized avatar
💀

josh rotenberg joshrotenberg

💀
View GitHub Profile
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
(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]
(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))
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"
input {
file {
path => "/tmp/doof/*"
codec => "gzip_lines"
start_position => "beginning"
}
}
output {
kafka {
@joshrotenberg
joshrotenberg / config.exs
Created June 25, 2015 20:53
kafka_ex producer error
use Mix.Config
config KafkaEx,
brokers: [{"localhost", 9092}]
@joshrotenberg
joshrotenberg / consumer_test.go
Last active September 8, 2016 04:50
nsq consumer testing
package consumer
import (
"errors"
"testing"
"github.com/bitly/go-nsq"
)
// tests nsq.HandlerFunc. just write the function in line in the test
package groupcache_expire
import (
"log"
"strings"
"time"
"github.com/golang/groupcache"
)
@joshrotenberg
joshrotenberg / gist:6274576fb605279ada93
Last active August 29, 2015 14:13
Quick attempt to take a nice Clojure map and convert it to a format that will play nice with Java Properties. Inspired by similar clojure.walk functions.
(require '[clojure.walk :refer [postwalk]]
[clojure.string :as s])
(defn keyword-to-property
"Replace :foo-bar with \"foo.bar\", etc."
[k]
(s/replace (name k) #"\-" "."))
(defn propertyize-map
"Recursively transforms all map keys from keywords to Java property strings and values to strings (if necessary)."
@joshrotenberg
joshrotenberg / embedded.go
Last active August 4, 2023 08:56
embedded nsqd
package main
// This is a basic example of running an nsqd instance embedded. It creates
// and runs an nsqd with all of the default options, and then produces
// and consumes a single message. You are probably better off running a
// standalone instance, but embedding it can simplify deployment and is
// useful in testing.
// See https://github.com/nsqio/nsq/blob/master/nsqd/options.go and
// https://github.com/nsqio/nsq/blob/master/apps/nsqd/nsqd.go for