Skip to content

Instantly share code, notes, and snippets.

@DBarney
DBarney / mem_stats.txt
Created February 7, 2012 16:34
Node with openssl version 0.9.8r
0 14.199
34 22.418
236 39.648
423 49.480
629 52.777
816 58.777
1000 63.109
1154 66.430
1366 77.121
1558 82.645
@DBarney
DBarney / node_stats.txt
Created February 7, 2012 16:35
Node with openssl version 1.0.0g
0 14.684
0 14.727
0 12.754
0 12.758
0 12.719
0 12.730
0 12.727
0 12.727
0 12.727
162 31.480
#!upstart
description "SSL monitor written in Node.js by Daniel Barney. Connects to redis and forwards all information to child processes which handle ssl connections"
author "Braxton Huggins - just this script( modified by Lyon Hill and then Daniel Barney)"
start on startup
stop on shutdown
respawn
script
@DBarney
DBarney / gist:2872704
Created June 5, 2012 04:44
ipvsadm setup
%%%%
%% SETUP
%%%%
%%%%
%% baker
%%%%
sudo -i
ifconfig eth1 192.168.0.2 up
@DBarney
DBarney / gist:3691565
Created September 10, 2012 15:32
syslog parser
%% we don't want to use a regex to match out the parts that we need, its much too flexible.
%% and we need something FAST, the following functions should do the fast part just fine :)
%"<13>May 17 08:32:41 123.456 daniel: this is a message\n"
%"^<[\\d]{2}>[\\S]{3} [\\d]{1,2} [\\d]{1,2}:[\\d]{1,2}:[\\d]{1,2} ([^.]+?)[.]([\\S]+) ([\\S\\D]+)"
head(<<$<,I/integer,$>,Rest/binary>>,Client) when
I > $0 , I =< $9 -> date(Rest,Client);
head(<<$<,I/integer,I2/integer,$>,Rest/binary>>,Client) when
I > $0 , I =< $9,
I2 > $0 , I2 =< $9-> date(Rest,Client);
head(<<$<,I/integer,I2/integer,I3/integer,$>,Rest/binary>>,Client) when
@DBarney
DBarney / gist:3860326
Created October 9, 2012 17:54
response header
HTTP/1.1 200 OK
Date: Tue, 09 Oct 2012 17:47:09 GMT
Server: Apache/2.2.20 (Unix)
X-Powered-By: PHP/5.3.8
Set-Cookie: fuelcid=dSoJZuu5TWl0DAvHg2hbULmssRvzFo7GgemkggqQXDuMlMnWIsMwisFzCzRwSIterUcxqXuawNt3Z-UImhMIX4OjHRatIeiQnZRbv7JkGnlS0BHCrVZK44Yzd-7dTZSHWvhPbu-x0k7yHOJBYuu3O5Icat9BAVsavBVZDKVI2RFJVKcmS81VAMDl5PzDoODFwniLp3p8t3l22uCSX2nNMNxdZHzpFZx4ioMJd-KTIIfLG5EmoTSWw0bbNC5VHDfLQszXdVEDZzysikqzxPja8DJi92VWZv2l06MKaVoDVSpL1L8noMA2rMXB88NeboolS1RKNHZLa3FxNU42TVVSUHhaUC1MWk81NFNvZFRPMnRyQ2VRQ0hvaFFzMA; expires=Tue, 09-Oct-2012 19:47:09 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
@DBarney
DBarney / gist:3860952
Created October 9, 2012 19:37
header
HTTP/1.1 200 OK
Date: Tue, 09 Oct 2012 19:36:54 GMT
Server: Apache/2.2.20 (Unix)
X-Powered-By: PHP/5.3.8
Set-Cookie: fuelcid=dSoJZuu5TWl0DAvHg2hbULmssRvzFo7GgemkggqQXDtKuY2ScSo15gwoZQtInrbLkZqdkTCm23NBc30DXfD4i7tklhPbbCs1RmqHVYKvOIsWoty7hoRKxVd8BMjbJZx4esm6dWGp6keHVKs1-khMaPGlJJLnfmTzllmZms3rthS0k-pZV32gqh0uIyP2abAEQNlZsIeMw-iFKMRvL_CBId4S2hxP5D6aYSICnDMx64Aie0hxqu6WMLBmMzGSmGNythctOKBYIDMaQBXWG_ZGUHVEmTzaSEAiMRrOhoUlwoJI2sj3kQZmEi3tw-BILfdkzZCD8XQFUCAgAMcsr1i6IlCQfp41WWJ6jyAu3KhU8QypKlCvM5JxCxaHcehvtNccDKN07hAT3nKfDPePNTTDN2nk7xLDm6FZZ-PErgzo6kzwr_DLe2ygBcCVHD-uloflcjM3b1BsMi0zOUtKUWtsS0tLNFVndmp5SFFkd3BNU3NFMkx0YlBId2pzUQ; expires=Tue, 09-Oct-2012 21:36:54 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: sentry_rm=deleted; expire
@DBarney
DBarney / gist:4061402
Created November 12, 2012 19:35
stats question description
Correct Answers on questions
Q1 Q2 Q3 Q4 ....
class A 0 10 11 12
class B 5 0 10 11
class C 5 6 0 10
class D 5 6 7 0
class E 0 10 11 12
class F 5 0 10 11
class G 5 6 0 10
class H 5 6 7 0
undefined method `__bson_dump__' for #<Money cents:0 currency:USD>
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/bson/extensions/hash.rb:36:in `block in __bson_dump__'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/bson/extensions/hash.rb:35:in `each'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/bson/extensions/hash.rb:35:in `__bson_dump__'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/bson/document.rb:11:in `serialize'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/protocol/message.rb:129:in `block in serialize_documents'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/protocol/message.rb:128:in `each'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/protocol/message.rb:128:in `serialize_documents'
/usr/local/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/moped-1.2.8/lib/moped/protocol/message.rb:287:in `serialize'
/usr/local/r
<?php
$host = 'pagodabox.com';
$response = "";
if ( $fp = fsockopen("ssl://{$host}", 443, $errno, $errstr, 30) ) {
$msg = 'GET / HTTP/1.1' . "\r\n";
$msg .= 'Host: ' . $host . "\r\n";
$msg .= 'Connection: close' . "\r\n\r\n";
if ( fwrite($fp, $msg) ) {