Skip to content

Instantly share code, notes, and snippets.

Working from home

Debasish Ghosh debasishg

Working from home
View GitHub Profile
View GDP.scala
trait Coercible[A, B] {
def coerce(a: A): B
def coerce[A, B](a: A)(implicit coerceAB: Coercible[A, B]): B = {
trait Newtype[+T] {
val value: T
debasishg /
Created Mar 23, 2019 — forked from ibraheem4/
Installing Postgres via Brew (OSX)

Installing Postgres via Brew


Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
View postgresql.txt
# start postgresql
pg_ctl -D /usr/local/var/postgres start
# stop postgresql
pg_ctl -D /usr/local/var/postgres stop
debasishg / state.hs
Created Mar 11, 2019 — forked from sdiehl/state.hs
State monad implementation + example
View state.hs
import Control.Monad
-- State Monad Implementation
newtype State s a = State { runState :: s -> (a,s) }
instance Monad (State s) where
return a = State $ \s -> (a, s)
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 /
Created Aug 24, 2018 — forked from coacoas/
Using Scala collections from Java
package org.example;
import scala.Function1;
import scala.collection.generic.CanBuildFrom;
import scala.collection.immutable.List;
import scala.collection.immutable.List$;
import scala.collection.immutable.Vector;
import scala.collection.immutable.Vector$;
import scala.collection.mutable.Builder;
debasishg / service_types.scala
Created Aug 12, 2018
algebra of effects for a domain service
View service_types.scala
type Valid[M[_], A] = EitherT[M, AccountServiceException, A]
type AccountOperation[M[_], A] = Kleisli[Valid[M, ?], AccountRepository[M], A]
View Embedding and Tokenizer in Keras.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am debasishg on github.
  • I am debasishg ( on keybase.
  • I have a public key ASAzUhyfxB6-Sy-1fIyhLBZ5SWBaddWWW8AJLWqQZAp7_go

To claim this, I am signing this object:

View gist:20d5badbe7a09a7ec71d0ca3017d1096
object KafkaStreamsTest extends TestSuite[KafkaLocalServer] with Serializers {
def setup(): KafkaLocalServer = {
val s = KafkaLocalServer(true)
def tearDown(server: KafkaLocalServer): Unit = {