Skip to content

Instantly share code, notes, and snippets.

class Main1 {
public static void main(String args[]) {
CliLauncher.builder()
.add(new TaskA(name))
.add(new TaskB(name))
.add(new TaskC(name))
.result()
.runWith(new PosixArgumentExtractor(args));
}
#! /bin/bash
# BASE
export BINDIR=$(dirname "$0")
export HOME=$(realpath $BINDIR/..)
# LOGGING
echo "HOME: $HOME"
echo "BIN: $BINDIR"
import scala.annotation.tailrec
object Main {
// https://www.byte-by-byte.com/autocomplete/
type Words = collection.mutable.Set[String]
val Words = collection.mutable.Set
type Index = collection.mutable.HashMap[String, Node]
val Index = collection.mutable.HashMap
@sameei
sameei / FlinkSinkCollector.scala
Created July 7, 2018 07:23
A collector as SinkFunction for test enviroments (single-jvm)
import java.util
import org.apache.flink.streaming.api.functions.sink.SinkFunction
import org.apache.flink.streaming.api.scala.DataStream
import scala.collection.mutable
import scala.collection.mutable.ListBuffer
/**
* To collect stream in flink-job we need a Singleton Referenced in Local JVM
@sameei
sameei / plugins.sbt
Created July 2, 2018 13:15
SBT Plugins with Link
// The Typesafe repository
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
// Typesafe snapshots
// resolvers += "Typesafe Snapshots" at "https://repo.typesafe.com/typesafe/snapshots/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.7")
SELECT from_json(string_field, '
id long,
text string,
truncated boolean,
source string,
created_at string,
user struct<
id: long,
name: string,
description: string,
@sameei
sameei / build.sbt
Created June 14, 2018 13:20
A Simple Benchmark; Broadcast Messages to Akka Actors and Wait for Response.
name := "akka-bench"
version := "0.1-SNAPSHOT"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.5.13"
scalaVersion := "2.12.6"
fork := true
@sameei
sameei / logback.xml
Last active February 4, 2019 15:22
Logback Config Example
<configuration debug="true" scan="true" scanPeriod="30 seconds">
<!-- URL : https://logback.qos.ch/manual/configuration.html -->
<!-- URL : https://logback.qos.ch/manual/appenders.html -->
<!-- URL : https://logback.qos.ch/manual/layouts.html -->
<!-- STDOUT -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
@sameei
sameei / hsdis-ubuntu.sh
Last active April 12, 2018 09:36
Build hsdis for JDK 1.8u92 on Ubuntu 17.10 Artful
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev g++-multilib mercurial texinfo
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u
cd jdk8u
hg update jdk8u92-b14
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./make/scripts/hgforest.sh # only get hotspot
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./common/bin/hgforest.sh # only get hotspot
chmod +x ./get_source.sh; ./get_source.sh
cd hotspot/src/share/tools/hsdis
wget https://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz # or http://ftp.unicamp.br/pub/gnu/binutils/
tar -xzf binutils-2.26.tar.gz
@sameei
sameei / SARFAbstraction.scala
Created March 31, 2018 09:05
SARF Abstraction
object SARFAbstraction { self ⇒
trait Frame {
type Tracked
type Untracked
type TrackingCode
def apply(untracked: Untracked, trackingCode: TrackingCode): Tracked
def apply(tracked: Tracked): (Untracked, TrackingCode)
}