Skip to content

Instantly share code, notes, and snippets.

diff --git a/src/msgpack.cc b/src/msgpack.cc
index 5374c3b..6bf6c36 100644
--- a/src/msgpack.cc
+++ b/src/msgpack.cc
@@ -233,8 +233,11 @@ msgpack_to_v8(msgpack_object *mo) {
return a;
}
- case MSGPACK_OBJECT_RAW:
- return String::New(mo->via.raw.ptr, mo->via.raw.size);
var msgpack = require('msgpack');
var fs = require('fs');
var crypto = require('crypto');
var hash = function(data) {
var h = crypto.createHash('md5');
h.update(data);
return h.digest('hex');
}
var data = fs.readFileSync(process.argv[2]);
var Gossiper = require('gossiper').Gossiper;
var seed = new Gossiper(9000, []);
seed.start();
var n = 0;
var gs = [];
var start_time = undefined;
var count = 100;
for(var i = 9001; i < 9001+count;i++) {
# EM.run {
# iw = ImapWatcher.new(user, pass);
#
# iw.watch! {
# p "sup, yall got new mail"
# }
# }
#
require 'rubygems'
require 'eventmachine'
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 25.00 0.00 75.00
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda1 0.00 0.07 0.00 0.20 0.00 1.07 10.67 0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sde 0.00 0.03 0.00 2.83 0.00 14.57 10.28 110.83 41245.49 353.00 100.02
class ImapConnection < EM::Connection
include EM::Protocols::LineText2
def post_init
@state = :unconnected
@tag_count = 0
@need_bytes = 0
end
def connection_completed
# Implementation of Timeout with EventMachine timers
require 'timeout'
module EMTimeout
# TODO make sure EM is running and make sure this isn't called by the reactor thread
def timeout(sec, klass = nil)
return yield if sec == nil or sec.zero?
raise ThreadError, "timeout within critical session" if Thread.critical
exception = klass || Class.new(ExitException)
x = Thread.current
exports.SHA1 = function() {
this.H0 = 0x67452301;
this.H1 = 0xEFCDAB89;
this.H2 = 0x98BADCFE;
this.H3 = 0x10325476;
this.H4 = 0xC3D2E1F0;
this.buffer = "";
this.message_length = 0;
}
# mixin to measure up/down rate for an EM::Connection
module RateMeasure
RATE_PERIOD = 5
def post_init
setup_meters
super
end
def receive_data data
update_meter(data.length, @download_meter)
cursor = 0
a = (1..5).to_a
b = []
stack = []
while true
if cursor < a.size
b << a[cursor]
stack << cursor