This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BufferPool from "./pool"; | |
// Create pool of 2MB blocks | |
const Pool = new BufferPool(2 * 1024 * 1024, 1000); | |
// Allocate uninitialized buffer | |
const unsafe = Pool.allocUnsafe(1000); | |
// Allocate zero filled buffer | |
const safe = Pool.alloc(1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Calculate N * 160 bits of hash value. | |
// Based on murmurhash160 by bryc (github.com/bryc) | |
// From: https://simonhf.wordpress.com/2010/09/25/murmurhash160/ | |
function hash(key, bits=480) { | |
let result = Buffer.alloc(bits / 8); | |
for (let step = 0; step < bits / 160; ++step) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import sys | |
import socket | |
import threading | |
import json | |
from collections import OrderedDict | |
import binascii | |
import datetime | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <sys/timeb.h> | |
#ifdef _WIN32 | |
# include <windows.h> | |
#else | |
# include <sys/time.h> | |
# include <unistd.h> | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/timeb.h> | |
#include <sys/types.h> | |
#include <vector> | |
#ifdef _WIN32 | |
# include <windows.h> | |
#else | |
# include <sys/time.h> | |
# include <unistd.h> | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/timeb.h> | |
#include <sys/types.h> | |
#ifdef _WIN32 | |
# include <windows.h> | |
#else | |
# include <sys/time.h> | |
# include <unistd.h> | |
#endif |