Skip to content

Instantly share code, notes, and snippets.

View postwait's full-sized avatar

Theo Schlossnagle postwait

View GitHub Profile
@postwait
postwait / gist:700850
Created November 15, 2010 19:53
amqp mem issues
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 December 21, 2010 03:05
ECONNABORTED should be ignored
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 February 14, 2011 03:26
sample use of tls in node.js v0.4
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);
@postwait
postwait / gist:869576
Created March 14, 2011 18:16
crazy variant
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) {
<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>

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

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:

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);
@postwait
postwait / gist:1256540
Created October 1, 2011 19:39
xml for uuid?
; 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
<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>