Skip to content

Instantly share code, notes, and snippets.

View joshrotenberg's full-sized avatar
🐢

Josh Rotenberg joshrotenberg

🐢
View GitHub Profile
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 June 17, 2025 01:42
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
(ns immutant.init
(:require [immutant.messaging :as msg]
[immutant.pipeline :as pl]
[clojure.tools.logging :as log]))
(defn add-two [m]
(log/info "add-two processing" m)
(+ 2 m))

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

Installing Haskell

Ubuntu PPA

{-# OPTIONS -Wall #-}
module Main where
import Control.Concurrent (threadDelay)
import System.Environment (getArgs)
import System.INotify
main :: IO ()
main = do
// Package readyset provides a simple set implementation.
package readyset
import "fmt"
// Set is a container for arbitrary data which ensures that duplicates elements will not be stored multiple times.
type Set map[interface{}]struct{}
// NewSet creates a new Set containing the given elements.
func NewSet(in ...interface{}) Set {