Skip to content

Instantly share code, notes, and snippets.

View baudehlo's full-sized avatar

Matt Sergeant baudehlo

View GitHub Profile
"use strict";
var cluster = require("cluster");
if (process.env.NODE_ENV == 'production' && cluster.isMaster) {
// this is the master control process
console.log("Control process running: PID=" + process.pid);
// fork as many times as we have CPUs
var numCPUs = process.env.NPROCS || require("os").cpus().length;
//var databaseUrl = "localhost";
//var collections = ["email"];
//var db = require("mongojs").connect(databaseUrl, collections);
var MongoClient = require('mongodb').MongoClient;
exports.hook_data = function (next, connection) {
// enable mail body parsing
connection.transaction.parse_body = 1;
next();
root@li102-105:/home/matt# ls -l /var/lib/barman/main/wals/
total 180456
-rw------- 1 barman barman 16777216 Aug 26 19:45 000000010000001500000000
-rw------- 1 barman barman 16777216 Aug 26 19:46 000000010000001500000001
-rw------- 1 barman barman 321 Aug 26 19:46 000000010000001500000001.00000028.backup
-rw------- 1 barman barman 16777216 Aug 26 21:03 000000010000001500000002
-rw------- 1 barman barman 16777216 Aug 26 21:08 000000010000001500000003
-rw------- 1 barman barman 16777216 Aug 26 21:13 000000010000001500000004
-rw------- 1 barman barman 16777216 Aug 26 21:18 000000010000001500000005
-rw------- 1 barman barman 16777216 Aug 26 21:20 000000010000001500000006
var render = exports.render = function (name, data, cb) {
// console.log("Rendering " + name + ".jade");
jade.renderFile(__dirname + '/../views/emails/' + name + '.jade', data, function (err, template_output) {
if (err) return cb(err);
if (juice) return juice.juiceContent(template_output, juice_options, cb);
return cb(null, template_output);
});
}
$ telnet localhost 587
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 emailitin.com ESMTP Haraka 2.5.0 ready
EHLO foo.com
250-emailitin.com Hello Unknown [127.0.0.1], Haraka is at your service.
250-PIPELINING
250-8BITMIME
250-SIZE 0
2014-08-05T18:58:25.556Z loglevel: LOGPROTOCOL
2014-08-05T18:58:25.556Z Starting up Haraka version 2.5.0
2014-08-05T18:58:25.556Z [INFO] [-] [core] Loading plugins
2014-08-05T18:58:25.556Z [INFO] [-] [core] Loading plugin: rcpt_to.in_host_list
2014-08-05T18:58:25.556Z [INFO] [-] [rcpt_to.in_host_list] loading host_list
2014-08-05T18:58:25.556Z [INFO] [-] [rcpt_to.in_host_list] loading host_list_regex
2014-08-05T18:58:25.556Z [DEBUG] [-] [core] registered hook mail to rcpt_to.in_host_list.hook_mail
2014-08-05T18:58:25.556Z [DEBUG] [-] [core] registered hook rcpt to rcpt_to.in_host_list.hook_rcpt
2014-08-05T18:58:25.556Z [INFO] [-] [core] Loading plugin: test_queue
2014-08-05T18:58:25.556Z [DEBUG] [-] [core] registered hook queue to test_queue.hook_queue
body
//- Your stuff here...
//- At the end of your body tag, add this:
if (initial_data)
script!= 'var _initial_data = ' + JSON.stringify(initial_data) + ';'
else
script= 'var _initial_data = {};'
#!/usr/bin/perl -w
use strict;
open(my $grep, "-|", "grep", @ARGV) || die $!;
my %uuids;
while (<$grep>) {
if (/^[^\[]*\[(\w+)\]\s+\[([A-F0-9-]+)(?:\.\d+)?\]/) {
$uuids{$2}++;
}
}
May 12 09:31:38 dev3 haraka[22485]: [INFO] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] Attempting to deliver to: 216.200.145.235:25 (0) (1)
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] S: 220 dm0218.mta.everyone.net ESMTP EON-INBOUND\r\n
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] C: EHLO smtp.fused.com
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] S: 250-dm0218.mta.everyone.net\r\n
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] S: 250-PIPELINING\r\n
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] S: 250-SIZE 50000000\r\n
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outbound] S: 250-AUTH PLAIN LOGIN\r\n
May 12 09:31:38 dev3 haraka[22485]: [PROTOCOL] [ECD608C5-C989-4E68-91CE-F545F81985D2.1] [outboun
"use strict";
var pattern = '("(?:\\\\\"|[^"])*?")\\s*=>\\s*((?:"(?:\\\\\"|[^"])*?")|NULL)';
var re = new RegExp(pattern,'gi');
exports.json_to_hstore = function json_to_hstore (json) {
if (typeof json == 'string') json = JSON.parse(json);
var hstore = [];
for (var key in json) {
var value = json[key];