Skip to content

Instantly share code, notes, and snippets.

@AoJ
AoJ / test1.js
Created September 17, 2015 13:11
node.js memory, cpu, gc
var SlowBuffer = require('buffer').SlowBuffer;
var ITER = 1e5, SIZE = 65536, cntr = 0;
var t = process.hrtime();
(function runner() {
if (++cntr > ITER) return print();
new SlowBuffer(SIZE);
setImmediate(runner);
}());
@AoJ
AoJ / test.coffee
Last active September 9, 2015 10:51
Simple perf test of loops
measure = (t, f) ->
s = new Date()
s = s.getTime()
ret = f()
e = new Date()
console.log t, e.getTime() - s, ret
test1 = ->
r = 0
for x in a
@AoJ
AoJ / rdd.js
Last active September 1, 2015 15:15
example for using rrdjs
var rrdjs = require('rrdjs');
var start = 0;
var end = start;
var i = 0;
step = 10;
var sources = [ "DS:test:GAUGE:1:0:U", "RRA:MAX:0.5:10:6" ];
rrdjs.create('test.rrd', 1, start, sources, created);
@AoJ
AoJ / timers.js
Created July 29, 2015 11:51
timers
var util = require("util");
var i = 0;
function echoI() {
util.log("interval " + ++i);
}
var t = 0;
function echoT() {
@AoJ
AoJ / docker-tinc.md
Last active August 29, 2015 14:22 — forked from noteed/docker-tinc.md
@AoJ
AoJ / keybase.md
Created June 3, 2015 08:58
keybase.md

Keybase proof

I hereby claim:

  • I am aoj on github.
  • I am aoj (https://keybase.io/aoj) on keybase.
  • I have a public key whose fingerprint is 73E6 AD8B FBCC DE24 29A3 D578 75A6 22CF 9F61 5722

To claim this, I am signing this object:

@AoJ
AoJ / Thread.php
Last active August 29, 2015 14:19 — forked from Arbow/Thread.php
<?php
//Found on http://www.alternateinterior.com/2007/05/multi-threading-strategies-in-php.html
//Modified by http://www.php-code.net
//Modified: add executor
class Thread {
var $pref ; // process reference
var $pipes; // stdio
var $buffer; // output buffer
var $output;
var $error;
@AoJ
AoJ / install.sh
Created April 16, 2015 09:27
este.js dependencies hell
git clone https://github.com/steida/este.git
cd este
npm install
npm list
@AoJ
AoJ / .gitconfig
Created March 23, 2015 13:50
git clone alias with separed repo dir
[alias]
cl = !git clone --separate-git-dir=/tmp/repos/${2-$(printf $1 | grep -oEi '([a-zA-Z0-9_.-]+)$')}