Skip to content

Instantly share code, notes, and snippets.

View farico's full-sized avatar

Aivaras Voveris farico

  • Eskimi
  • Vilnius, Lithuania
View GitHub Profile

Akka Streams Backpressure Gauge

Measures if there is backpressure on an Akka Stream at the given stage.

Motivation

When an Akka Stream doesn't perform as intended, it is difficult to tell where the bottleneck is, since all stages operate at the same rate (see e.g. here ).

So when things are not fast as expected, this pressure gauge can help you to narrow down on the slow stage. Imagine

@farico
farico / ip.scala
Last active August 29, 2015 14:08 — forked from timothyklim/ip.scala
import collection.mutable.ListBuffer
object NetworkUtils {
def ip2Long(ip: String): Long = {
val atoms: Array[Long] = ip.split("\\.").map(java.lang.Long.parseLong(_))
val result: Long = (3 to 0 by -1).foldLeft(0L)(
(result, position) => result | (atoms(3 - position) << position * 8))
result & 0xFFFFFFFF
}

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@farico
farico / gist:3938084
Created October 23, 2012 10:31
Linksniavimas LT vardu
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Maug Lee <mauglee@gmail.com>
* @copyright Copyleft (ↄ) 2011, Maug Lee
* @version 0.3
* @package Vardai
*/
@farico
farico / hack.sh
Created March 31, 2012 13:55 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@farico
farico / gist:769495
Created January 7, 2011 14:17
komentarai
function linksnis($skaicius, $komentaras, $komentarai, $komentaru) {
if ( $skaicius % 10 == 0 || between(substr($skaicius, -2), 10, 20) ) {
return $komentaru;
}
elseif ( substr($skaicius, -1) == 1 && $skaicius != 11 ) {
return $komentaras;
}
function isset_assign( $needle, $haystack ) {
if ( isset( $haystack[$needle] ) ) {
return $haystack[$needle];
}
else {
return $needle;
}
}
<?php
/**
* isset( $var['a'], $var['b'] ) shortcut: array_has( $var, 'a', 'b' );
*/
function array_has( &$var ) {
$args = func_get_args();
if ( ! empty( $args ) && is_array( $args[0] ) && count( $args ) > 1 ){