Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Think -> Code -> Solve

ShankarShastri shankarshastri

💻
Think -> Code -> Solve
View GitHub Profile
View AkkaHttpChunked.scala
import akka.actor.ActorSystem
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.actor.ActorSystem
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.stream.ActorMaterializer
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 akka.actor.{Actor, ActorRef, ActorSystem, CoordinatedShutdown, Props}
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.math.BigInt
import scala.util.Success
import akka.pattern._
import akka.util.Timeout
import scala.concurrent.duration._
@shankarshastri
shankarshastri / AWSArchNotes.txt
Last active Nov 10, 2018
AWS Solution Arch Notes
View AWSArchNotes.txt
IAM
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.
@shankarshastri
shankarshastri / LearnXInYMinProtocolBuffer.proto
Last active Oct 6, 2020
Self-Explanatory Protocol Buffer Lang Guide (CheatSheet)
View LearnXInYMinProtocolBuffer.proto
/*
* Self-Explanatory Protocol Buffer Lang Guide
*/
/*
* Why Protocol Buffers?
* Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.
* You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.
* Protocol Buffers are Schema Of Messages. They are language agnostic.
View JumpingMario.java
/**
* @author ShankarShastri
* Algorithm: JumpingMario (https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2864)
*/
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 (https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2864)
*/
import scala.io.StdIn._
object JumpingMario {
def main(args: Array[String]): Unit = {
val n = readLine().toInt
loopWithIndex(n) { i =>
View PingPongRouter.scala
import akka.actor._
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
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.actor.ExtendedActorSystem
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)
You can’t perform that action at this time.