Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View misterdjules's full-sized avatar

Julien Gilli misterdjules

View GitHub Profile
@misterdjules
misterdjules / gist:0641c449ff4d63e8660e
Created August 22, 2014 18:51
v0.12 Heap implementation MacOS X full profiling stats
Statistical profiling result from v8.log, (10135 ticks, 68 unaccounted, 0 excluded).
[Unknown]:
ticks total nonlib name
68 0.7%
[Shared libraries]:
ticks total nonlib name
4426 43.7% 0.0% /Users/JulienGilli/dev/node/./out/Release/node
2247 22.2% 0.0% /usr/lib/system/libsystem_kernel.dylib
@misterdjules
misterdjules / gist:6ae4a573f2e2a75ff53c
Created August 22, 2014 20:08
Benchmark unref timers worst case

Benchmark source code

var timers = require('timers');

var N = 100000;

var i = 0;
while (i < N) {
    var  someObject = { _onTimeout: function () { } };
@misterdjules
misterdjules / test-v0.12.sh
Last active August 29, 2015 14:05
test-v0.12.sh
#!/bin/env bash
#set -x
TESTS_DIR="$(pwd)/app-tests"
NODE_BIN=${NODE_BIN:-$(pwd)/out/Release/node}
t_plan() {
printf "1..%d\n" "$1"
}
@misterdjules
misterdjules / gist:9ff53baa61efbb5f9256
Last active August 29, 2015 14:06
Using server.address().address in test/req.ip.js test for express
diff --git a/test/req.ip.js b/test/req.ip.js
index f24401c..a17b924 100644
--- a/test/req.ip.js
+++ b/test/req.ip.js
@@ -60,11 +60,14 @@ describe('req', function(){
res.send(req.ip);
});
- request(app)
- .get('/')
@misterdjules
misterdjules / gist:0800a480220fe445bd5a
Created September 13, 2014 00:36
Memory leak fix for lab 4 of nodeconf's dtrace + mdb workshop
diff --git a/leak2.js b/leak2.js
index e4b6a47..7fe4c18 100644
--- a/leak2.js
+++ b/leak2.js
@@ -7,15 +7,16 @@ result = null;
console.log("STARTING");
process.nextTick(function run() {
- var script = vm.createScript('setInterval(function() {}, 0);', 'test.js');
+ var script = vm.createScript('var myInterval = setInterval(function() {}, 0); clearInterval(myInterval); ', 'test.js');
1) res .download(path, fn) should invoke the callback:
Error: Request aborted
at Immediate._onImmediate (c:\Users\jgilli\dev\node-0-11-14-test\express\l
ib\response.js:941:17)
at processImmediate [as _immediateCallback] (timers.js:374:17)
@misterdjules
misterdjules / macosx.txt
Last active August 29, 2015 14:07
ulimit and core dumps generation with Node.js
➜ node-debug-school git:(master) ✗ ls /cores
➜ node-debug-school git:(master) ✗ ulimit -c 0; node --abort-on-uncaught-exception -e 'undef()'
Uncaught ReferenceError: undef is not defined
FROM
[eval]:1:1
Object.<anonymous> ([eval]-wrapper:6:22)
Module._compile (module.js:456:26)
evalScript (node.js:536:25)
startup (node.js:80:7)
@misterdjules
misterdjules / gist:4473216b184b7728364f
Created October 10, 2014 01:09
uv_fs_opendir for win32
diff --git a/include/uv.h b/include/uv.h
index 601a7f1..86516a9 100644
--- a/include/uv.h
+++ b/include/uv.h
@@ -1045,6 +1045,7 @@ typedef enum {
struct uv_dir_s {
UV_HANDLE_FIELDS
+ int dir_flags;
UV_DIR_PRIVATE_FIELDS
@misterdjules
misterdjules / gist:71d24e6df69647272e40
Last active August 29, 2015 14:07
SSLv3 client with --enable-ssl3 connecting to server without specific cmd line option/SSL protocol set
var tls = require('tls');
var fs = require('fs');
var path = require('path');
var fork = require('child_process').fork;
var assert = require('assert');
var constants = require('constants');
var common = require('../common');
if (process.argv[2] === 'child') {
@misterdjules
misterdjules / gist:0ec1f38621cf2189ceeb
Created October 22, 2014 19:08
Latest SSL fixes that make all SSL tests pass
diff --git a/lib/crypto.js b/lib/crypto.js
index f88c55d..dedecc4 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -61,6 +61,32 @@ var StringDecoder = require('string_decoder').StringDecoder;
var CONTEXT_DEFAULT_OPTIONS = undefined;
+function getSecureOptions(secureProtocol, secureOptions) {
+ if (CONTEXT_DEFAULT_OPTIONS === undefined) {