Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Debasish Ghosh debasishg

🏠
Working from home
View GitHub Profile
@debasishg
debasishg / gist:8172796
Last active Apr 7, 2021
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
@debasishg
debasishg / loans.scala
Last active Mar 31, 2021
Sample scala code with type constraints and kleisli composition
View loans.scala
package net.debasishg.fin
import org.joda.time.DateTime
trait Account {
def no: String
def name: String
def openedOn: DateTime
def closedOn: Option[DateTime]
}
@debasishg
debasishg / gist:b4df1648d3f1776abdff
Last active Jan 20, 2021
another attempt to organize my ML readings ..
View gist:b4df1648d3f1776abdff
  1. Feature Learning
  1. Deep Learning
View encode_decode_dictionary.py
"""
Given a dictionary, transform it to a string. Then byte encode that string. Then base64 encode it and since this will go
on a url, use the urlsafe version. Then decode the byte string so that it can be else where.
"""
data = base64.urlsafe_b64encode(json.dumps({'a': 123}).encode()).decode()
# And the decode is just as simple...
data = json.loads(base64.urlsafe_b64decode(query_param.encode()).decode())
# Byte encode the string, base64 decode that, then byte decode, finally transform it to a dictionary
@debasishg
debasishg / join.md
Last active Aug 30, 2020
Join based queries using skunk decoders
View join.md

Join based queries with skunk decoders - folding with a Semigroup

Domain Model

Let's take a simple example that models an employee along with the salaries accrued in a year. Here's the domain model in Scala:

case class Salary(empId: String, month: Int, amount: BigDecimal)
case class Employee(id: String, name: String, salaries: List[Salary])
View async_redis_client.scala
import java.net.URI
import cats.effect._
object Main extends IOApp {
override def run(args: List[String]): IO[ExitCode] =
RedisClient.makeWithURI[IO](new URI("http://localhost:6379")).use { cmd =>
import cmd._
val result = for {
@debasishg
debasishg / refined_runtime_validation.scala
Created Jul 23, 2020
Incorporating compile time and runtime validation using refinement types in Scala
View refined_runtime_validation.scala
import cats.data.ValidatedNec
import cats.implicits._
import eu.timepit.refined._
import eu.timepit.refined.api.Refined
import eu.timepit.refined.auto._
import eu.timepit.refined.numeric._
import eu.timepit.refined.collection._
object person {
View thread-pools.md

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@debasishg
debasishg / graph-ml.md
Last active May 25, 2020
Machine Learning on Graphs
View graph-ml.md
  1. Graph Convolution Network - a blog post and the associated tweet. Check for the video.
  2. Deep Graph Library
  3. Machine Learning on Graphs: A Model and Comprehensive Taxonomy by Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Ré, Kevin Murphy
  4. Relational inductive biases, deep learning, and graph networks by Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, Razvan Pascanu - For the intuition of what GNNs can achieve, what the pro
@debasishg
debasishg / sync.txt
Last active May 8, 2020
Git tidbits
View sync.txt
Keeping a remote fork in sync
-----------------------------
git status
git checkout master
git remote -v
git remote add upstream https://github.com/lightbend/cloudflow.git
git remote -v
git fetch upstream
git pull upstream master
git push origin master