Skip to content

Instantly share code, notes, and snippets.

View debasishg's full-sized avatar
🏠
Working from home

Debasish Ghosh debasishg

🏠
Working from home
View GitHub Profile
@debasishg
debasishg / gist:6c13f3f57080a9655463
Last active February 12, 2025 04:28
links to papers / books on succinct data structures ..
From Theory to Practice: Plug and Play with Succinct Data Structures - Simon Gog, Timo Beller, Alistair Moffat & Matthias Petri (http://arxiv.org/pdf/1311.1249v1.pdf)
Succinct Data Structures for Retrieval and Approximate Membership - Martin Dietzfelbinger and Rasmus Pagh (http://www.itu.dk/people/pagh/papers/bloomier.pdf)
Lecture 17 in Erik Demaine's 6.851 (https://courses.csail.mit.edu/6.851/spring12/lectures/L17.html)
Succinct Data Sstructures by Edward Kmett (https://www.youtube.com/watch?v=uA0Z7_4J7u8)
Succinct Trees in Practice by Diego Arroyuelo, Rodrigo Ćanova, †Gonzalo Navaror Kunihiko Sadakane http://users.dcc.uchile.cl/~darroyue/papers/alenex2010.pdf
@debasishg
debasishg / gist:8172796
Last active August 30, 2026 15:18
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
scala> List("a", "b", "AA", "d")
res0: List[String] = List(a, b, AA, d)
// List.sortBy, List.sorted and TreeMap all take an implicit scala.math.Ordering
// just define the following at the top of StorageRepoQueries
scala> object CaseInsensitiveOrdering extends Ordering[String] {
| def compare(a: String, b: String) = a.toLowerCase compare b.toLowerCase
| }
defined module CaseInsensitiveOrdering
@debasishg
debasishg / gist:7056696
Last active December 25, 2015 23:19
Sample session with redis pubsub implemented with redisclient
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.redis._
import com.redis._
scala> import akka.actor.{ Actor, ActorSystem, Props }
import akka.actor.{Actor, ActorSystem, Props}
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> case class Foo(i: Int)
defined class Foo
scala> Vector(Foo(1), Foo(2), Foo(3))
res0: scala.collection.immutable.Vector[Foo] = Vector(Foo(1), Foo(2), Foo(3))
@debasishg
debasishg / gist:6166837
Created August 6, 2013 17:53
Define the stages of Akka IO Pipeline and let Akka handle the lower levels
val stages = Seq(
Some(new ResponseHandling),
Some(new Serializing),
backpressureBufferSettings map {
case BackpressureBufferSettings(lowBytes, highBytes, maxBytes) =>
new BackpressureBuffer(lowBytes, highBytes, maxBytes)
}
).flatten.reduceLeft(_ >> _)
TcpPipelineHandler.withLogger(log, stages)
@volatile var callbackExecuted = false
val ks = (1 to 10).map(i => s"client_key_$i")
val kvs = ks.zip(1 to 10)
val sets: Seq[Future[Boolean]] = kvs map {
case (k, v) => client.set(k, v)
}
val setResult = Future.sequence(sets) map { r: Seq[Boolean] =>
@debasishg
debasishg / gist:5845683
Created June 23, 2013 16:51
Sample test cases for the new non blocking Redis client for Scala based on Akka IO
describe("non blocking apis using futures") {
it("get and set should be non blocking") {
val kvs = (1 to 10).map(i => s"key_$i").zip(1 to 10)
val setResults = kvs map {case (k, v) =>
set(k, v) apply client
}
val sr = Future.sequence(setResults)
Await.result(sr.map(_.flatten), 2 seconds).forall(_ == true) should equal(true)
@debasishg
debasishg / gist:5808749
Created June 18, 2013 19:59
Play 2.0 router generates a documentation field returning, for each route of the application, its HTTP method (GET, PUT, etc.), its path pattern and finally the call as it was written in the conf/routes file. The router generates a Routes object which is loaded by your Play application when started, you can access it.
val routeInfo =
for {
routes <- play.api.Play.current.routes.toList
(method, pattern, call) <- routes.documentation
} yield (method, pattern, call)
println(routeInfo)
generates ..
List((GET,/,controllers.Application.index), (HEAD,/credentialValidation,com.eligotech.hnavigator.web.controllers.CredentialValidation.validateCredentials), (POST,/job,com.eligotech.hnavigator.web.controllers.JobManagement.createJob), (GET,/job/$id<[^/]+>,com.eligotech.hnavigator.web.controllers.JobManagement.getById(id:String)), (DELETE,/job/$id<[^/]+>,com.eligotech.hnavigator.web.controllers.JobManagement.deleteById(id:String)), (OPTIONS,/$path<.+>,com.eligotech.hnavigator.web.controllers.OptionHandler.options(path:String)), (OPTIONS,/job,com.eligotech.hnavigator.web.controllers.JobManagement.options(id:String = "")), (OPTIONS,/job/$id<[^/]+>,com.eligotech.hnavigator.web.controllers.JobManagement.options(id:String)), (GET,/job,com.eligotech.hnavigator.web.controllers.JobManagement.getByState(state:Option[Strin
@debasishg
debasishg / gist:5599764
Created May 17, 2013 15:19
Problem with Slick generating sql for count with hsqldb
// sample query using count
val c =
for {
d <- Databases if (d.name like s"$name%") && (d.hasDistinctCount === true)
} yield t.count
println(c.selectStatement)
// generates this sql for h2
select select count(1) from "Databases" x2 where (x2."name" like 'world%') and (x2."hasDistinctCount" = true)