Skip to content

Instantly share code, notes, and snippets.

View fabiofumarola's full-sized avatar

fabio fumarola fabiofumarola

  • DataToKnowledge
  • Bari
View GitHub Profile
@fabiofumarola
fabiofumarola / scala.rb
Created November 20, 2012 15:22 — forked from cstrahan/scala.rb
Install Scala 2.10 RC3 on OSX
# 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
# 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
@fabiofumarola
fabiofumarola / sbtScala.sh
Created January 10, 2014 09:51
create scala sbt project
#!/bin/bash
prj=$1
rm -rf $prj
mkdir $prj
cd $prj
mkdir -p src/main/java
mkdir -p src/main/scala
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
//create a place
var place1 = {
"name" : "10gen HQ",
"address" : "578 Broadway 7th Floor",
"city" : "New York",
"zip" : "10011",
"tags" : [
"business",
"awesome"
]
@fabiofumarola
fabiofumarola / benchmark-commands.txt
Last active August 29, 2015 14:26 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
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
@fabiofumarola
fabiofumarola / WikipediaParser.scala
Last active October 20, 2015 20:05
Simple Raw Wikipedia Parser based on scala.xml with a tail recursive function
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
}
@fabiofumarola
fabiofumarola / docker-compose.yml
Created February 12, 2016 15:59
confluent docker-compose startup
zookeeper:
image: confluent/zookeeper
ports:
- "2181:2181"
kafka:
image: confluent/kafka
ports:
- "9092:9092"
links:
- zookeeper:zookeeper
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;
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"