Skip to content

Instantly share code, notes, and snippets.

View conikeec's full-sized avatar

Chetan Conikee conikeec

View GitHub Profile
@conikeec
conikeec / README.txt
Created February 23, 2012 06:50 — forked from andreisavu/README.txt
An Apache Whirr recipe that can be used to start a single virtual machine running HBase on EC2
Hi :)
Here are some quick instruction on running the hbase-ec.properties recipe.
1. Download Whirr 0.7.0 RC0 from here. We are going to publish this as an official release soon.
http://people.apache.org/~asavu/whirr-0.7.0-candidate-0/whirr-0.7.0.tar.gz
2. Extract the archive
@conikeec
conikeec / gist:2142635
Created March 20, 2012 23:47 — forked from nono/gist:1600053
autocomplete with tire
#encoding: utf-8
require 'tire'
require 'json'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/object/to_param'
conf = {
settings: {
number_of_shards: 1,
number_of_replicas: 0,
@conikeec
conikeec / avgkvsz.scala
Created March 28, 2012 03:22 — 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
/**
@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 / 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 / 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 / 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 {
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 / 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