Skip to content

Instantly share code, notes, and snippets.

@dannycoates
dannycoates / client.js
Last active December 18, 2015 23:49
SRP test client
var crypto = require('crypto');
var config = require('../lib/config').get('srp');
var srp = require('../lib/srp');
var srpParams = require('../lib/srp_group_params');
var util = require('../lib/util');
var bigint = require('bigint');
var request = require('request');
var alg = config.alg_name;
@dannycoates
dannycoates / hekad.toml
Last active December 17, 2015 23:08
heka statsd
Timestamp: 2013-05-31 11:02:25.780902984 -0700 PDT
Type: statmetric
Hostname: moz.local
Pid: 5267
UUID: 93100895-b5f8-4283-9687-ab4e2eaefd0d
Logger:
Payload: stats.rss 558678016 1370023345
stats.heapTotal 498229248 1370023345
stats.heapUsed 211741608 1370023345
statsd.numStats 3 1370023345
@dannycoates
dannycoates / iptables
Last active December 17, 2015 14:29
awsbox iptables
# Generated by iptables-save v1.4.7 on Thu Apr 5 23:32:48 2012
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [2:120]
:OUTPUT ACCEPT [3:252]
:POSTROUTING ACCEPT [3:252]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443
COMMIT
# Completed on Thu Apr 5 23:32:48 2012
@dannycoates
dannycoates / node.sh
Last active December 17, 2015 14:08
update the node version on awsbox
#!/usr/bin/env bash
VERSION=$NODE_VERSION
: ${VERSION:="stable"}
echo "installing nave"
git clone git://github.com/isaacs/nave.git
sudo ln -s /home/ec2-user/nave/nave.sh /usr/local/bin/nave
echo "using node" $VERSION
@dannycoates
dannycoates / readable-test.js
Created December 17, 2012 06:31
Readable stream test
var fs = require('fs')
var Readable = require('readable-stream')
var readable = new Readable({ bufferSize: 64 })
readable.wrap(fs.createReadStream(__filename))
readable.on(
'readable',
function () {
var data = ''
@dannycoates
dannycoates / socket-destroyed.js
Created December 5, 2012 22:06
Of nextTicks and sockets
var http = require('http')
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'})
res.end('Hello World\n')
}).listen(1337)
var agent = new http.Agent({maxSockets: 1})
agent.on('free', function (socket, host, port) {
@dannycoates
dannycoates / broken.js
Created September 15, 2011 19:27
ssl test
var http = require('http'), // intentionally using http to connect to https
options = {
host: 'localhost',
port: 4443,
path: '/ping',
};
function pingLoop() {
http.get(options, function (res) {
console.assert(false, "server should never accept http over https");