Skip to content

Instantly share code, notes, and snippets.

Theo Schlossnagle postwait

View GitHub Profile
@postwait
postwait / gist:700850
Created Nov 15, 2010
amqp mem issues
View gist:700850
var amqp = require('amqp'),
sys = require('sys');
var mqhost = process.argv[2];
var exchange_name = process.argv[3];
function expensive_op(str) {
return str;
}
var listen = function(f) {
@postwait
postwait / gist:749421
Created Dec 21, 2010
ECONNABORTED should be ignored
View gist:749421
diff --git a/src/node_net.cc b/src/node_net.cc
index d4448aa..de3bb6b 100644
--- a/src/node_net.cc
+++ b/src/node_net.cc
@@ -484,6 +484,7 @@ static Handle<Value> Accept(const Arguments& args) {
if (peer_fd < 0) {
if (errno == EAGAIN) return scope.Close(Null());
+ if (errno == ECONNABORTED) return scope.Close(Null());
return ThrowException(ErrnoException(errno, "accept"));
@postwait
postwait / gist:825441
Created Feb 14, 2011
sample use of tls in node.js v0.4
View gist:825441
nc.prototype.start = function(conncb) {
var parent = this;
this.conncb = conncb;
this.socket = tls.connect(this.port,this.host,this.creds,
function() {
if(parent.socket.authorized == false) {
sys.puts('invalid cert: ' + parent.socket.authorizationError);
throw('invalid cert: ' + parent.socket.authorizationError);
}
parent.conncb(parent);
View gist:869576
diff --git a/lib/tls.js b/lib/tls.js
index a951c97..78e191c 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -509,32 +509,44 @@ exports.createSecurePair = function(credentials,
* completed negotiation and emit 'secure' from here if it has.
*/
SecurePair.prototype._cycle = function() {
+ depth = depth ? depth : 0;
if (this._done) {
View gist:896429
<modules>
<lua loader="lua">
<jezebel>
<config><url>http://127.0.0.1:8083/dispatch</url></config>
<module name="oracle" object="noit.module.jezebel"/>
<module name="sqlserver" object="noit.module.jezebel"/>
<module name="jmx" object="noit.module.jezebel"/>
</jezebel>
</lua>
</modules>
View gist:1179235

For running nad, man nad.

These are the poor man's docs.

Description

nad will run scripts from the config directory; only from that and not subdirectories. The best practice it to write your scripts in subdirectories of the config dir and soft link to them to enable

View gist:1189570

HTTP Accept Filters for Solaris

Once built and installed: (make install), you can load these with

 soconfig -F httpf httpf prog 2:2:0,2:2:6,26:2:0,26:2:6

Then applications must programatically enable them immediately after socket() and before bind() with a setsockopt() call as follows:

View gist:1232954
diff --git a/src/noit_conf_checks.c b/src/noit_conf_checks.c
index 239feb1..b909c55 100644
--- a/src/noit_conf_checks.c
+++ b/src/noit_conf_checks.c
@@ -461,6 +461,7 @@ noit_console_show_check(noit_console_closure_t ncct,
nc_printf(ncct, " name: %s [from module]\n", module ? module : "[undef]");
nc_attr_show(ncct, "module", node, mnode, module);
SHOW_ATTR(target);
+ SHOW_ATTR(resolve_rtype);
SHOW_ATTR(period);
View gist:1256540
; ldd /usr/lib/libuuid.so
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libc.so.1 => /lib/libc.so.1
libdlpi.so.1 => /lib/libdlpi.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libinetutil.so.1 => /lib/libinetutil.so.1
libdladm.so.1 => /lib/libdladm.so.1
libdevinfo.so.1 => /lib/libdevinfo.so.1
View gist:1358906
<acl name="aname">
<network type="allow" ip="0.0.0.0/0"/>
<network type="deny" ip="1.2.3.0/24"/>
<network type="allow" ip="1.2.3.9"/>
</acl>
You can’t perform that action at this time.