Skip to content

Instantly share code, notes, and snippets.

@amimimor
amimimor / http_dispatcher_and_workers.go
Created March 9, 2016 07:48
A template for an HTTP Request dispatcher and worker 'pool' (sharing channels with the Dispatcher)
package main
import (
// "flag"
"fmt"
"log"
"net/http"
"os"
"strings"
#!/usr/bin/python
from kafka import SimpleProducer, KafkaClient, RoundRobinPartitioner, KeyedProducer
import os, time
broker = os.environ["broker"]
topic = os.environ["topic"]
parts = int(os.environ["parts"])
# To send messages synchronously
kafka = KafkaClient(str.format('{}:9092', broker))
@amimimor
amimimor / Delimited.scala
Created May 24, 2012 13:39
Scalding DelimitedScheme2 - with optional skipHeader and writeHeader TextDelimited
import cascading.tuple.Fields
import cascading.scheme.Scheme
import cascading.scheme.local.{TextLine => CLTextLine, TextDelimited => CLTextDelimited}
import cascading.scheme.hadoop.{TextLine => CHTextLine, TextDelimited => CHTextDelimited, SequenceFile => CHSequenceFile}
import org.apache.hadoop.mapred.{JobConf, RecordReader, OutputCollector }
import com.twitter.scalding.{Args, FixedPathSource, Job, Source}
trait DelimitedScheme2 extends Source {
//override these as needed: