Skip to content

Instantly share code, notes, and snippets.

@lucastorri
lucastorri / vernemq.log
Created October 8, 2016 23:52
VerneMQ log for bridge setup
Erlang/OTP 19 [erts-8.0.2] [source] [64-bit] [smp:8:8] [async-threads:64] [hipe] [kernel-poll:true] [dtrace]
01:48:28.231 [debug] Lager installed handler {lager_file_backend,"./log/console.log"} into lager_event
01:48:28.231 [debug] Lager installed handler {lager_file_backend,"./log/error.log"} into lager_event
01:48:28.232 [debug] Lager installed handler error_logger_lager_h into error_logger
01:48:28.240 [debug] Supervisor gr_param_sup started gr_param:start_link(gr_lager_default_tracer_params) at pid <0.96.0>
01:48:28.240 [debug] Supervisor gr_counter_sup started gr_counter:start_link(gr_lager_default_tracer_counters) at pid <0.97.0>
01:48:28.240 [debug] Supervisor gr_manager_sup started gr_manager:start_link(gr_lager_default_tracer_params_mgr, gr_lager_default_tracer_params, []) at pid <0.98.0>
01:48:28.240 [debug] Supervisor gr_manager_sup started gr_manager:start_link(gr_lager_default_tracer_counters_mgr, gr_lager_default_tracer_counters, [{input,0},{filter,0},{output,0}]) at pid <0.99.0>
01:48:28.296
//https://github.com/papers-we-love/papers-we-love/blob/master/caching/a-constant-algorithm-for-implementing-the-lfu-cache-eviction-scheme.pdf
import scala.collection.mutable
trait Identifier[Item, Id] {
def apply(item: Item): Id
}
@lucastorri
lucastorri / TimerWheel.scala
Last active March 29, 2016 17:37
TimerWheel - Concurrent O(1) Timer
// http://www.cubrid.org/blog/dev-platform/more-efficient-timer-implementation-using-timerwheel/
// http://preshing.com/20120612/an-introduction-to-lock-free-programming/#compare-and-swap-loops
// https://en.wikipedia.org/wiki/Non-blocking_algorithm
// http://www.javamex.com/tutorials/synchronization_volatile.shtml
// https://gist.github.com/lucastorri/fa4da12ab374a98618f2
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import scala.collection.JavaConversions._
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.synced_folder "salt/", "/srv/"
config.vm.provision :salt do |salt|
salt.minion_config = "salt/minion.conf"
<style>
tbody tr:hover {
background-color: rgb(236, 235, 225);
}
#map {
height: 700px;
width: 1200px;
margin-top: 20px
@lucastorri
lucastorri / project.erb
Created December 7, 2012 15:42
Project template on code-an-gui
<div id="pairingRate" class="tile box_1_1"></div>
<div id="commitsPerWorkspacePerProject" class="tile box_2_1"></div>
<div id="" class="tile box_2_2"></div>
<div id="" class="tile box_1_2"></div>
@lucastorri
lucastorri / NumberOfCommitsAnalyzer.scala
Created December 7, 2012 15:00
code-an simplest analyzer
import spark._
import com.thoughtworks.dod._
class NumberOfCommitsAnalyzer extends Analyzer {
def apply(data: RepoData, sc: SparkContext) =
Result(Seq("checkins"), Seq(Seq(data.commits.count)))
}
@lucastorri
lucastorri / robot.js
Created December 6, 2012 17:20
argemiro
var moveCounter = 0;
var moveFwd = true;
function Robot(robot) {
robot.clone();
}
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (moveFwd) robot.move(1)
else robot.back(1);
@lucastorri
lucastorri / robot.js
Created December 6, 2012 17:20
argemiro
var moveCounter = 0;
var moveFwd = true;
function Robot(robot) {}
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (moveFwd) robot.move(1)
else robot.back(1);
robot.rotateCannon(1);
moveCounter++;
@lucastorri
lucastorri / scala.log
Created June 5, 2012 02:24
WCC 2012.23
scala> println(f(522, List(100, 5, 5, 2, 6, 8)).map(f => f.toString + " = " + f.r).mkString("\n"))
(((100.0 - 5.0) - 8.0) * 6.0) = 522.0
(((100.0 + 6.0) * 5.0) - 8.0) = 522.0
(((100.0 - 8.0) - 5.0) * 6.0) = 522.0
(((6.0 + 100.0) * 5.0) - 8.0) = 522.0
(((((5.0 - 8.0) * 5.0) + 100.0) + 2.0) * 6.0) = 522.0
(((((5.0 - 8.0) * 5.0) + 2.0) + 100.0) * 6.0) = 522.0
(((((2.0 / 5.0) * 8.0) + 100.0) * 5.0) + 6.0) = 522.0
(((((2.0 * 8.0) / 5.0) + 100.0) * 5.0) + 6.0) = 522.0
(((((2.0 * 8.0) + 6.0) / 5.0) + 100.0) * 5.0) = 522.0