Skip to content

Instantly share code, notes, and snippets.


Parth Patil parth-patil

View GitHub Profile
View post_process_balances.php
while($line = fgets(STDIN)){
$line = trim($line);
list($advertiserid, $ts, $balance_cents) = explode("\t", $line);
$date = date('Y-m-d', $ts);
echo "$date\t$advertiserid\t$ts\t$balance_cents\n";
View PageViewGenerator.scala
package com.parthpatil
import util.Random
/** Represents a page view on a website with associated dimension data. */
class PageView(url : String, status : Int, country: String, browser: String, userID : Int)
extends Serializable {
override def toString() : String = {
View FinagleFutureTester.scala
import com.twitter.util.{ Future => TFuture, _}
object Tester extends App {
def test1(): Unit = {
implicit val timer: Timer = new ScheduledThreadPoolTimer()
val startTime = System.currentTimeMillis()
val longProcess: TFuture[String] = TFuture { Thread.sleep(1000); "done" }
.onSuccess { _ => val elapsed = System.currentTimeMillis() - startTime; println(s"long process Success, elapsed = $elapsed")}
parth-patil / RedisContidionalQueue.scala
Last active Aug 29, 2015
A job queue backed by Redis and has the ability to retry failed jobs
View RedisContidionalQueue.scala
package com.parthpatil
import com.lambdaworks.redis._
import rx.lang.scala.Observable
import scala.concurrent.{Promise, Future, Await, ExecutionContext}
import scala.concurrent.duration._
import java.util.concurrent.{TimeUnit, ExecutorService, Executors}
parth-patil / RxRedis.scala
Created May 25, 2015
Exposing some of Redis's streaming operations via Observable
View RxRedis.scala
package com.parthpatil
import com.lambdaworks.redis.output.{KeyStreamingChannel, KeyValueStreamingChannel}
import com.lambdaworks.redis.pubsub.{RedisPubSubConnection, RedisPubSubAdapter, RedisPubSubListener}
import com.lambdaworks.redis.{MapScanCursor, RedisFuture, RedisClient}
import rx.lang.scala.Observable
import scala.concurrent.{Promise, Future, Await, ExecutionContext}
import scala.concurrent.duration._
parth-patil / LogTailer.scala
Last active Aug 29, 2015
Future & Observable based APIs for log tailing
View LogTailer.scala
package com.parthpatil
import java.util.concurrent.LinkedBlockingQueue
import rx.lang.scala.Observable
import scala.concurrent._
parth-patil / Json4sTest.scala
Last active Feb 25, 2016
Json4s Examples
View Json4sTest.scala
* Make sure you include the following in your build.sbt
"org.json4s" %% "json4s-core" % "3.2.10",
"org.json4s" %% "json4s-jackson" % "3.2.10"
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.json4s.JsonDSL._
case class Candidate(name:Option[String], age:Option[Int], party:Option[String])
parth-patil / gist:8321035
Last active Jan 2, 2016
Detailed log from index task job
View gist:8321035
2014-01-08 18:06:17,749 INFO [main] io.druid.server.initialization.PropertiesModule - Loading properties from
2014-01-08 18:06:17,781 INFO [main] org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.0.1.Final
2014-01-08 18:06:18,208 INFO [main] io.druid.guice.JsonConfigurator - Loaded class[class io.druid.server.initialization.ExtensionsConfig] from props[druid.extensions.] as [ExtensionsConfig{searchCurrentClassloader=true, coordinates=[], localRepository='/Users/parth/.m2/repository', remoteRepositories=[,]}]
2014-01-08 18:06:18,833 INFO [main] io.druid.guice.JsonConfigurator - Loaded class[class com.metamx.emitter.core.LoggingEmitterConfig] from props[druid.emitter.logging.] as [LoggingEmitterConfig{loggerClass='com.metamx.emitter.core.LoggingEmitter', logLevel='info'}]
2014-01-08 18:06:18,895 INFO [main] io.druid.guice.JsonConfigurator - Loaded class[class io.drui
parth-patil / gist:7864738
Created Dec 8, 2013
Exception when running Cassandra Hadoop CQL3 example
View gist:7864738
➜ hadoop_cql3_word_count git:(cassandra-2.0) ✗ ./bin/word_count
DEBUG 14:35:30,741 config()
at org.apache.hadoop.conf.Configuration.<init>(
at org.apache.hadoop.conf.Configuration.<init>(
at WordCount.main(Unknown Source)
INFO 14:35:30,794 output reducer type: cassandra
DEBUG 14:35:30,801 config(config)
at org.apache.hadoop.conf.Configuration.<init>(
at org.apache.hadoop.mapred.JobConf.<init>(
parth-patil /
Created Apr 1, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
You can’t perform that action at this time.