Skip to content

Instantly share code, notes, and snippets.

View kfox's full-sized avatar

Kelly Fox kfox

  • Unity Technologies
  • Austin, TX, USA
View GitHub Profile
@kfox
kfox / tcpproxy.js
Created April 5, 2012 20:03
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
console.error(error);
});
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
process.exit();
}
@kfox
kfox / http-cluster.js
Created April 5, 2012 19:48
A clustered HTTP server for HTTP connection testing
var http = require('http'),
cluster = require('cluster');
var numCPUs = require('os').cpus().length;
var host = process.argv[2] || '3.0.0.2';
var port = process.argv[3] || 80;
if (cluster.isMaster) {
// this is the master, so spawn workers
@kfox
kfox / sysctl.conf
Created February 29, 2012 17:32
Linux kernel tuning settings for large number of concurrent clients
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
@kfox
kfox / https.js
Created February 28, 2012 20:42
Node 0.6.11 SSL Handshaking
var fs = require('fs'),
tls = require('tls');
var host = process.argv[2] || '3.0.0.2';
var port = process.argv[3] || 443;
var options = {
key: fs.readFileSync('./certs/serverA_512.key'),
cert: fs.readFileSync('./certs/serverA_512.crt'),
ca: [