Skip to content

Instantly share code, notes, and snippets.

val consumer = new KafkaConsumer[String, String](consumerProperties)
consumer.subscribe(List("input").asJava)
val producer = new KafkaProducer[String, String](producerProperties)
Future {
while (true) {
val records = consumer.poll(100)
@wojda
wojda / .zshrc
Last active April 6, 2016 21:59
# aliases http://explainshell.com/explain?cmd=du+-sh+*
## admin
alias wojda_show_directories_size="du -sh --total *"
alias wojda_show_directories_size_sorted="du -sk *| sort -rn"
alias wojda_show_disk_usage="df -h --total"
alias wojda_whereis="whereis"
alias wojda_export_variable="export var_name=var_value"
alias wojda_show_all_envarionment_var="env"
@wojda
wojda / Main.scala
Last active February 17, 2016 00:50
Persistent Actor
package org.danielwojda
import akka.actor.{ActorSystem, Props}
import akka.persistence.PersistentActor
object Main {
def main(args: Array[String]) {
val system = ActorSystem("example")
val actor = system.actorOf(Props(classOf[ProducerActor], "old instance"))
@wojda
wojda / 0_reuse_code.js
Created October 18, 2015 17:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wojda
wojda / DynamicScala
Created April 12, 2015 10:40
Scala FTW
import scala.language.dynamics
class MyDynamicClass extends Dynamic {
private val fields = scala.collection.mutable.Map("foo" -> "1", "bar" -> 2)
def selectDynamic(fieldName: String) = fields.get(fieldName)
def addField(field: (String, String)) = fields += field
}
val dynamic = new MyDynamicClass()
dynamic.foo
dynamic.addField("wtf" -> "THIS IS SCALA!")
@wojda
wojda / gist:60ba3b77c1c320e7638f
Created March 27, 2015 08:09
Count tables rows in MySQL.
SELECT table_name, table_rows
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'schem_name';
@wojda
wojda / flatButton
Created February 19, 2015 22:12
The simplest way to create flat button. HTML+CSS
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>How to create flat button - the simplest way</title>
<style>
.flatButton {
height: 50px;
width: 150px;
+Navigation
* https://medium.com/@andrey_cheptsov/top-20-navigation-features-in-intellij-idea-ed8c17075880
@wojda
wojda / sources.scala.txt
Last active August 29, 2015 14:11
Scala knowledge sources
* http://scalakata.com/index
* https://github.com/lauris/awesome-scala
* https://github.com/scalatron/scalatron/blob/master/Scalatron/doc/markdown/Scalatron%20Tutorial.md
//Video
* https://skillsmatter.com/conferences/1948-scala-exchange-2014#skillscasts
* "Code Reviews Gems" - https://skillsmatter.com/skillscasts/5848-code-reviews-gems
* "Cake Pattern: The Bakery from the Black Lagoon" [https://www.youtube.com/watch?v=yLbdw06tKPQ]
//Blog
@wojda
wojda / java8_installation
Created October 17, 2014 23:34
How to install java8 on external serwe, for example openshift
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz
tar -zxf jdk-8u25-linux-x64.tar.gz
export PATH=$OPENSHIFT_DATA_DIR/jdk1.8.0_25/bin:$PATH
export JAVA_HOME="$OPENSHIFT_DATA_DIR/jdk/jdk1.8.0_25"