This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val grpcJavaVersion = "1.3.0" | |
val downloadJGrpc = { | |
val grpcArtifactId = "protoc-gen-grpc-java" | |
val jgrpcExeFileName = { | |
val os = if (scala.util.Properties.isMac) "osx-x86_64" | |
else if (scala.util.Properties.isWin) "windows-x86_64" | |
else "linux-x86_64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.NotUsed; | |
import akka.actor.ActorSystem; | |
import akka.japi.Creator; | |
import akka.japi.Pair; | |
import akka.stream.*; | |
import akka.stream.javadsl.*; | |
import scala.collection.immutable.Seq; | |
import scala.concurrent.duration.FiniteDuration; | |
import java.util.Iterator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zookeeper: | |
image: confluent/zookeeper | |
ports: | |
- "2181:2181" | |
kafka: | |
image: confluent/kafka | |
ports: | |
- "9092:9092" | |
links: | |
- zookeeper:zookeeper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package it.dtk.wikipedia.parser | |
import scala.annotation.tailrec | |
import scala.io.{Codec, Source} | |
import scala.xml.pull._ | |
trait CloseableIterator[A] extends Iterator[A] { | |
def close(): Unit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Producer | |
Setup | |
bin/kafka-topics.sh --zookeeper zk:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1 | |
bin/kafka-topics.sh --zookeeper zk:2181 --create --topic test --partitions 6 --replication-factor 3 | |
Single thread, no replication | |
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=192.168.99.100:9092 buffer.memory=67108864 batch.size=8196 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a place | |
var place1 = { | |
"name" : "10gen HQ", | |
"address" : "578 Broadway 7th Floor", | |
"city" : "New York", | |
"zip" : "10011", | |
"tags" : [ | |
"business", | |
"awesome" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.libs.json.Json | |
import io.really.jwt._ | |
val payload = Json.obj("name" -> "Ahmed", "email" -> "[email protected]") | |
val jwt = JWT.encode("secret", payload) | |
JWT.decode(jwt, Some("secret")) | |
scala> val jwt = JWT.encode("secret", payload) | |
jwt: String = eyJhbGciOiJIbWFjU0hBMjU2IiwidHlwIjoiSldUIn0.eyJuYW1lIjoiQWhtZWQiLCJlbWFpbCI6ImFobWVkQGdtYWlsLmNvbSJ9.I8avF3Tvv70KXDbvv73vv71kae-_vW7vv73vv70I77-977-9We-_vT5oWA8s77-977-977-9FQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
prj=$1 | |
rm -rf $prj | |
mkdir $prj | |
cd $prj | |
mkdir -p src/main/java | |
mkdir -p src/main/scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to install the latest stable version: | |
brew install play | |
# to install play-2.1.1: | |
brew install https://raw.github.com/gist/4112398/play.rb | |
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands): | |
brew switch play 2.1.0 | |
brew switch play 2.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to install the latest stable version: | |
brew install scala --with-docs | |
# to install scala-2.10.0-RC3: | |
brew install https://raw.github.com/gist/4118557/scala.rb --with-docs | |
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands): | |
brew switch scala 2.9.2 | |
brew switch scala 2.10.0-RC3 |