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 / join.md
Last active August 30, 2020 12:54
Join based queries using skunk decoders

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])
@debasishg
debasishg / graph-ml.md
Last active May 25, 2020 12:07
Machine Learning on Graphs
  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 / fold.md
Created March 21, 2020 18:06
some links on foldl/foldr

Original : hasura/graphql-engine#2933 (comment)

Yes, that’s right. It never makes sense to use foldl on lists because it never has any benefit and will always leak space.

To explain why, I wrote a mini blog post explaining the difference between foldl and foldr in Haskell. To start, you have to understand that foldl and foldr are not folds “from the left” and “from the right.” Both foldl and foldr traverse the structure in the same order, which in the case of lists means left to right. The difference is the fold’s associativity.

https://ocharles.org.uk/posts/2016-01-26-transformers-free-monads-mtl-laws.html
https://www.reddit.com/r/haskell/comments/f995kd/pawe%C5%82_szulc_maintainable_software_architecture_in/
https://www.reddit.com/r/haskell/comments/7ar5jy/free_monad_or_monad_transformer_to_manage_effects/
https://mail.haskell.org/pipermail/haskell-cafe/2018-September/129992.html
https://mail.haskell.org/pipermail/haskell-cafe/2018-September/129988.html (thread)
https://www.reddit.com/r/haskell/comments/3nkv2a/why_dont_we_use_effect_handlers_as_opposed_to/
https://lexi-lambda.github.io/blog/2017/04/28/lifts-for-free-making-mtl-typeclasses-derivable/
https://www.reddit.com/r/haskell/comments/66pzc8/recommended_way_to_use_monad_transformers/
https://making.pusher.com/3-approaches-to-monadic-api-design-in-haskell/
https://www.reddit.com/r/haskell/comments/ej8fme/unordered_effects/fd00mk2/?context=1
@debasishg
debasishg / sync.txt
Last active May 8, 2020 05:36
Git tidbits
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
@debasishg
debasishg / useful.md
Last active March 1, 2020 21:21
Useful links to read ..

Visitor Pattern

@debasishg
debasishg / gist:738436be246179293c50f4ab7bef02b1
Created April 25, 2019 16:50
Getting runtime types in Scala
Can we do it with `ClassTag` ?
Adriaan:
You can't with a class tag, as it represents the erased type as known to the JVM. You could use a TypeTag
to reify the full type, but that depends on full scala reflection, which has its own downsides
(not thread safe, basically pulls in the compiler,...)
scala> import scala.reflect.runtime.universe.TypeTag
import scala.reflect.runtime.universe.TypeTag
@debasishg
debasishg / GDP.scala
Created April 14, 2019 19:41 — forked from erdeszt/GDP.scala
Ghosts of departed proofs in scala (https://github.com/matt-noonan/gdp-paper/releases)
trait Coercible[A, B] {
def coerce(a: A): B
}
def coerce[A, B](a: A)(implicit coerceAB: Coercible[A, B]): B = {
coerceAB.coerce(a)
}
trait Newtype[+T] {
val value: T
@debasishg
debasishg / postgres-brew.md
Created March 23, 2019 19:55 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@debasishg
debasishg / postgresql.txt
Created March 23, 2019 19:44
Postgresql howtos
# start postgresql
pg_ctl -D /usr/local/var/postgres start
# stop postgresql
pg_ctl -D /usr/local/var/postgres stop