Skip to content

Instantly share code, notes, and snippets.

Arunav Sanyal Khalian

  • Amazon
  • Seattle, Washington, USA
Block or report user

Report or block Khalian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View typeclass.scala
// Inspiration :
// Purpose : Adhoc polymorphsim
// Define some types
case class Dog(name: String, breed: String)
// Define the type class
trait Animal[A] {
def sound(a: A): Unit
Khalian / TypeHierarchy.scala
Last active Feb 21, 2020
View TypeHierarchy.scala
// A classic definition of functor, applicative and monad.
trait Functor[T[_]] {
def apply[A](a: A): T[A]
def map[A, B](f: A => B)(a: T[A]): T[B]
trait Applicative[T[_]] extends Functor[T[_]] {
def pmap[A, B](f: T[A => B])(a : T[A]) : T[B]
Khalian / higher_kinded_types_graph_search_bfs_dfs.scala
Created Feb 1, 2020
View higher_kinded_types_graph_search_bfs_dfs.scala
import scala.annotation.tailrec
import scala.collection.immutable.{Queue, Stack}
sealed trait Tree[T] {
def value: T
case class Node[T](value: T, children: List[Tree[T]]) extends Tree[T]
case class Leaf[T](value: T) extends Tree[T]
Khalian / simpleWebServer
Last active Jan 4, 2019
Simple command line webserver
View simpleWebServer
Simple server init : python -m SimpleHTTPServer 8000
Simple get request : echo -e "GET / HTTP/1.1" | nc localhost 8000
Khalian / nvimsymlinks
Last active Oct 21, 2018
nvim symlinks to vimrc
View nvimsymlinks
View gist:8ac14ca7b5b4033473d2d2850a610282
sealed trait Addable[T] {
def add(a: T, b: T): T
object AddableInstances {
implicit val intAddable = new Addable[Int] {
override def add(a: Int, b: Int): Int = a + b
Khalian /
Last active Jun 20, 2019
Remove s3 buckets bulk
if [ $# -ne 1 ]
echo "Usage: ./ bucketNameSubstring"
exit 1
for bucket in $(aws s3 ls | awk '{print $3}'| grep $1); do aws s3 rb "s3://${bucket}" --force ; done
Khalian /
Created Aug 8, 2018
Arunav's pimped up installation of rad stuff
# This is to be used in environments without proper yum usage.
# Mosh
sudo yum -y install autoconf automake gcc gcc-c++ make boost-devel
sudo yum -y install zlib-devel ncurses-devel protobuf-devel openssl-devel
tar xf mosh-1.3.0.tar.gz -C /tmp/
cd /tmp/mosh-1.3.0
make -j7
View Default zsh shell
cat ~/.bashrc
SHELL=/bin/zsh exec /bin/zsh --login
View FindInodeUsageCommand
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
You can’t perform that action at this time.