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 / 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
@debasishg
debasishg / state.hs
Created March 11, 2019 19:43 — forked from sdiehl/state.hs
State monad implementation + example
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)
@debasishg
debasishg / encode_decode_dictionary.py
Created January 30, 2019 10:11 — forked from khornberg/encode_decode_dictionary.py
python 3 base64 encode dict
"""
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 / CollectionTest.java
Created August 24, 2018 09:40 — forked from coacoas/CollectionTest.java
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
debasishg / service_types.scala
Created August 12, 2018 11:55
algebra of effects for a domain service
type Valid[M[_], A] = EitherT[M, AccountServiceException, A]
type AccountOperation[M[_], A] = Kleisli[Valid[M, ?], AccountRepository[M], A]
Loading
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 (https://keybase.io/debasishg) on keybase.
  • I have a public key ASAzUhyfxB6-Sy-1fIyhLBZ5SWBaddWWW8AJLWqQZAp7_go

To claim this, I am signing this object:

object KafkaStreamsTest extends TestSuite[KafkaLocalServer] with Serializers {
def setup(): KafkaLocalServer = {
val s = KafkaLocalServer(true)
s.start()
s
}
def tearDown(server: KafkaLocalServer): Unit = {
server.stop()
}
@debasishg
debasishg / gist:26ccf7aa8db72d51924c53fc7b769ddc
Created November 26, 2017 11:05
Problem with monix and cats
// build.sbt
val catsVersion = "1.0.0-RC1"
val catsEffectVersion = "0.5"
val catsCore = "org.typelevel" % "cats-core_2.12" % catsVersion
val catsFree = "org.typelevel" % "cats-free_2.12" % catsVersion
val catsEffect = "org.typelevel" %% "cats-effect" % catsEffectVersion
val monix = "io.monix" %% "monix" % "3.0.0-8084549"
val monixCats = "io.monix" %% "monix-cats" % "2.3.2"