Skip to content

Instantly share code, notes, and snippets.

View joaquimserafim's full-sized avatar
🏠
Working from home

Joaquim Serafim joaquimserafim

🏠
Working from home
  • London
View GitHub Profile
@joaquimserafim
joaquimserafim / gist:1159dc026447121ce13e
Last active August 29, 2015 14:18
set a vm with kafka and node.js
git clone git@github.com:joaquimserafim/vagrantfile-template.git vm_kafka_node
cd vm_kafka_node
IP="192.168.33.100" PROVISION="zookeeper kafka nodejs" vagrant up
// steps:
// 1 - donwload/cp ubuntu (trusty) box
// 2 - run vagrant
// 3 - update OS
// 4 - run the provision (default: htop & git) and will install zookeeper, kafka & node.js (n)
### Keybase proof
I hereby claim:
* I am joaquimserafim on github.
* I am quim (https://keybase.io/quim) on keybase.
* I have a public key whose fingerprint is 3BBF D03A E1ED BF97 92E3 F8E4 26D3 380F 8927 ED41
To claim this, I am signing this object:

(dominic: this list of papers was originally recommended to me by Brain Noguchi @bnoguchi, and was a great start to understanding distributed systems)

Here's a selection of papers that I think you would find helpful and interesting:

Time, Clocks, and the Ordering of Events in a Distributed System

The seminal paper about event ordering and concurrency. The important result is that events in a distributed system define a partially ordered set. The connection to what we're working on is fundamental, as this defines how to detect concurrent updates. Moreover, the chosen algorithm to turn the partially ordered set into a totally ordered set defines the conflict resolution algorithm.

http://research.microsoft.com/en-us/um/people/lamport/pubs/time-clocks.pdf

@joaquimserafim
joaquimserafim / gist:73423e1cfabaefcafa09
Created October 23, 2014 10:44
tracing event emitter
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;
var debug = require('debug')('emitter');
var sliced = require('sliced');
function Dummy() {
EventEmitter.call(this);
}
inherits(Dummy, EventEmitter);
Colors Cheat-sheet
white : "\033[1;37m"
black : "\033[0;30m"
red : "\033[0;31m"
light_red : "\033[1;31m"
green : "\033[0;32m"
light_green : "\033[1;32m"
yellow : "\033[0;33m"
light_yellow : "\033[1;33m"
@joaquimserafim
joaquimserafim / gist:9633125
Created March 19, 2014 00:28
save pwd in terminal
#!/usr/bin/env node
var stdin = process.openStdin();
// get a password from the console & print stars while the user types
function setPassword () {
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.setRawMode(true);