Skip to content

Instantly share code, notes, and snippets.

View conikeec's full-sized avatar

Chetan Conikee conikeec

View GitHub Profile
@conikeec
conikeec / gist:2582631
Created May 3, 2012 02:40 — forked from takscape/gist:1272336
Scala: Esper
import com.espertech.esper.client.{Configuration, EventBean, UpdateListener, EPServiceProviderManager}
import java.util.HashMap
import scala.collection.JavaConversions._
object Sandbox
{
def main(args: Array[String]) {
val config = new Configuration();
val eventType = new HashMap[String, AnyRef]()
eventType.put("itemName", classOf[String])
@conikeec
conikeec / EsperUtil.scala
Created May 3, 2012 02:40 — forked from wangzaixiang/EsperUtil.scala
Using Esper with Scala
package demo1
import com.espertech.esper.client.EventBean
import com.espertech.esper.client.EPAdministrator
import com.espertech.esper.client.UpdateListener
import com.espertech.esper.client.EPListenable
import com.espertech.esper.client.EPServiceProvider
object EsperUtil {
@conikeec
conikeec / AkkaUnfilteredSample.scala
Created April 30, 2012 06:56 — forked from chrsan/AkkaUnfilteredSample.scala
Akka 2.0 unfiltered RESTful sample
package akka.unfiltered
import akka.actor._
import akka.dispatch.Future
import akka.pattern.ask
import akka.util.duration._
import akka.util.Timeout
import unfiltered.Async
import unfiltered.request._
@conikeec
conikeec / RV Akka futures 120306
Created April 29, 2012 05:51
Playing with Akka futures
import java.util.concurrent.Executors
import scala.io.Source
import akka.dispatch.ExecutionContext
import akka.util.duration._
import akka.dispatch.Future
implicit val ec = ExecutionContext.fromExecutorService(Executors.newCachedThreadPool())
val words = Source.fromFile("/usr/share/dict/words").getLines
package javatest;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.proofpoint.json.JsonCodec;
import org.apache.commons.httpclient.Header;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
@conikeec
conikeec / minscalaactors.scala
Created April 11, 2012 23:27 — forked from viktorklang/minscalaactors.scala
Minimalist Scala Actors
object Actor {
import java.util.concurrent.{ConcurrentLinkedQueue, Executor}
import java.util.concurrent.atomic.{AtomicBoolean}
sealed trait Instr
case object Continue extends Instr
case class Become(b: Any => Instr) extends Instr
case object Dead extends Instr
trait Address {
@conikeec
conikeec / HBase.scala
Created April 10, 2012 21:49 — forked from tsuna/HBase.scala
Atomic increment coalescing for asynchbase
// Copyright (C) 2012 Benoit Sigoure
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at your
// option) any later version. This program is distributed in the hope that it
// will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
// General Public License for more details. You should have received a copy
// of the GNU Lesser General Public License along with this program. If not,
// see <http://www.gnu.org/licenses/>.
@conikeec
conikeec / app.scala
Created April 5, 2012 00:18 — forked from softprops/app.scala
netty uploads test app
import unfiltered.request._
import unfiltered.response._
import unfiltered.netty._
import unfiltered.request.uploads.netty._
object App {
def main(a: Array[String]) {
@conikeec
conikeec / avgkvsz.scala
Created March 30, 2012 06:15 — forked from tsuna/avgkvsz.scala
Get average size of a KeyValue from HBase using asynchbase in Scala with the Finagle compatibility layer
import java.util.ArrayList
import scala.collection.JavaConversions._
import com.stumbleupon.async.{Callback, Deferred}
import org.hbase.async.{HBaseClient, KeyValue, Scanner}
import com.twitter.util.{Future, Promise, Return, Throw}
/** Converts a Deferred into a Future. */
implicit def futureFromDeferred[A](d: Deferred[A]): Future[A] = {
val promise = new Promise[A]
@conikeec
conikeec / gist:2223888
Created March 28, 2012 05:22 — forked from mardambey/gist:1326933
Sample Kafka stdin producer
package com.edate.data.test
import java.util.Properties
import kafka.producer.ProducerConfig
import kafka.producer.Producer
import kafka.message.Message
import kafka.producer.ProducerData
import kafka.producer.ProducerData
import kafka.producer.Partitioner
/**