Skip to content

Instantly share code, notes, and snippets.

Think -> Code -> Solve

ShankarShastri shankarshastri

Think -> Code -> Solve
View GitHub Profile
View AkkaHttpChunked.scala
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshalling.Marshaller
import akka.http.scaladsl.marshalling.ToResponseMarshallable.apply
import akka.http.scaladsl.marshalling.ToResponseMarshaller
import akka.http.scaladsl.model.{ ContentTypes, HttpEntity }
import akka.http.scaladsl.model.HttpEntity.ChunkStreamPart
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.server.Directive.addByNameNullaryApply
View AkkaHttpChunkedExample.scala
import akka.NotUsed
import akka.http.scaladsl.Http
import akka.http.scaladsl.common.{ EntityStreamingSupport, JsonEntityStreamingSupport }
import akka.http.scaladsl.model.{ HttpEntity, StatusCodes, _ }
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.marshalling.{ Marshaller, ToEntityMarshaller, ToResponseMarshaller }
import akka.http.scaladsl.model.TransferEncodings.gzip
View AkkaRetryActor.scala
import{Actor, ActorRef, ActorSystem, CoordinatedShutdown, Props}
import scala.concurrent.Future
import scala.math.BigInt
import scala.util.Success
import akka.pattern._
import akka.util.Timeout
import scala.concurrent.duration._
shankarshastri / AWSArchNotes.txt
Last active Nov 10, 2018
AWS Solution Arch Notes
View AWSArchNotes.txt
IAM => Identity And Access Management
It contains Users, Groups, Roles
Users => Normal Person As An User.
Groups => Based On Functions Designate it to particular groups. Example: Dev-Ops, Engineering.
Roles => Machine.
Policies Are In Json.
Lease Privilege Principles.
* @author ShankarShastri
* Algorithm: JumpingMario (
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.Vector;
import java.util.function.BiFunction;
View JumpingMario.scala
* @author ShankarShastri
* Algorithm: JumpingMario (
object JumpingMario {
def main(args: Array[String]): Unit = {
val n = readLine().toInt
loopWithIndex(n) { i =>
View PingPongRouter.scala
import akka.routing.{ Broadcast, DefaultResizer, RoundRobinPool }
case object Init
case object Pong
case object Ping
class PingActor(pongActorRef: ActorRef) extends Actor {
def receive: Receive = {
case Init =>
View machine_learning_scikit_kaggle.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
shankarshastri / ScalaPbSerializer.scala
Created Aug 30, 2019 — forked from thesamet/ScalaPbSerializer.scala
Akka serializer for ScalaPB messages
View ScalaPbSerializer.scala
package protoser
import java.util.concurrent.atomic.AtomicReference
import akka.serialization.BaseSerializer
import com.trueaccord.scalapb.GeneratedMessageCompanion
class ScalaPbSerializer(val system: ExtendedActorSystem) extends BaseSerializer {
private val classToCompanionMapRef = new AtomicReference[Map[Class[_], GeneratedMessageCompanion[_]]](Map.empty)

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.

You can’t perform that action at this time.