Skip to content

Instantly share code, notes, and snippets.

View baudehlo's full-sized avatar

Matt Sergeant baudehlo

View GitHub Profile
var connection = {
notes: { fcrds: { fcrdns: "Hello World" } }
};
var thing_we_want = "notes.fcrds.fcrdns";
var thing = connection;
var parts = thing_we_want.split('.');
while(parts.length > 0) {
thing = thing[parts.shift()];
setInterval(function () { console.log("ping") }, 1000);
process.on('SIGINT', function () { console.log("Got SIGINT") });
var util = require('util');
function json_stringify_safe(node, parents){
parents = parents || [];
console.log("Looking at: ", node);
if(!node || typeof node != "object" || util.isDate(node) || util.isError(node) || util.isRegExp(node)){
return JSON.stringify(node);
}
"use strict";
var fs = require('fs');
var path = require('path');
fs.readdirSync(__dirname + '/model').forEach(function (model_file) {
if (/\.js$/.test(model_file)) {
var key = model_file.replace(/\.js$/, '');
exports[key] = require(path.join(__dirname, 'model', model_file));
}
@baudehlo
baudehlo / uni.pl
Last active December 29, 2015 14:29
Run with: perl -C uni.pl
// Fixup the email (TODO: we should probably clone the transaction here because we don't want it changed for every RCPT TO)
trans.remove_header('List-Unsubscribe');
trans.add_header('List-Unsubscribe', list.email.replace('@', '-unsub@'));
trans.remove_header('List-ID');
trans.add_header('List-ID', list.name + " <" + list.email.replace('@', '.') + ">");
trans.remove_header('List-Message-Id');
trans.add_header('List-Message-Id', id);
if (list.reply_to_set) {
trans.remove_header('Reply-To');
trans.add_header('Reply-To', list.email);
"use strict";
var fs = require('fs');
var cache = {};
var timers = {};
var times = 0;
function leak_test (name, cb) {
if (cache[name]) {
$ echo 'process.removeAllListeners("uncaughtException");' > /tmp/foo.js
$ node /tmp/foo.js
[exits normally]
select start_date, end_date from employees where company_id=10; start_date | end_date
------------+----------
2013-05-31 |
2013-07-09 |
2013-07-17 |
2013-05-31 |
2013-05-31 |
2013-05-31 |
@baudehlo
baudehlo / 2.diff
Last active December 28, 2015 05:59
diff --git a/connection.js b/connection.js
index 3be5f70..c0fa9b8 100644
--- a/connection.js
+++ b/connection.js
@@ -1105,7 +1105,7 @@ Connection.prototype.cmd_mail = function(line) {
var results;
var from;
try {
- results = rfc1869.parse("mail", line);
+ results = rfc1869.parse("mail", line, config.get('strict_rfc1869') && !this.relaying);