This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matt@Valour /tmp$ cat client.js | |
var fullchunk; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
process.stdin.on('data', function (chunk) { | |
if (!fullchunk) { | |
fullchunk = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ telnet localhost 3000 | |
Trying ::1... | |
telnet: connect to address ::1: Connection refused | |
Trying 127.0.0.1... | |
Connected to localhost. | |
Escape character is '^]'. | |
GET / HTTP/1.0 | |
HTTP/1.1 200 OK | |
Connection: close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Store mail in Mongo | |
var Db = require('mongodb').Db, | |
Connection = require('mongodb').Connection, | |
Server = require('mongodb').Server, | |
BSON = require('mongodb').BSONNative; | |
var MailParser = require("mailparser").MailParser; | |
exports.hook_queue = function (callback, connection) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MailParser = require("mailparser").MailParser; | |
var util = require('util'); | |
exports.hook_queue = function (callback, connection) { | |
var plugin = this; | |
// Parse the mail first... | |
var mp = new MailParser({fix_smtp_escapes: 0}); | |
var headers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body = require('./mailbody'); | |
var fs = require('fs'); | |
var util = require('util'); | |
var b = new body.Body(); | |
b.state = 'headers'; | |
var data = fs.readFileSync('/tmp/multipart.eml', "UTF-8").split(/\n/); | |
for (var i=0; i < data.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_filename (id, cb) { | |
id = id || 1; | |
path.exists(path.join(root, id, '.ext'), function (exists) { | |
if (exists) { | |
get_filename(id++, cb); | |
} | |
else { | |
cb(id); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
// Bind to receiving of data | |
exports.hook_data = function( next, connection, params ) { | |
var haraka = this, | |
uid = connection.transaction.uuid; | |
connection.transaction.notes.attachments = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE User ( | |
id INTEGER PRIMARY KEY, | |
email TEXT NOT NULL, | |
); | |
CREATE TABLE List ( | |
id INTEGER PRIMARY KEY, | |
email TEXT NOT NULL, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FastHeuristics enabled, run it... | |
if ($fasth) { | |
my $urls = $transaction->notes('urls') || []; | |
$tran_obj = ML::FastHeuristics::Transaction->new($transaction->mail, | |
cynic => $self->cynic, | |
transaction => $transaction, | |
threshold => $threshold, | |
uris => $urls, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input: | |
// perl -MCrypt::CBC -MMIME::Base64 -le 'print MIME::Base64::encode_base64(Crypt::CBC->new(-key=>"test",-cipher=>"DES",-header=>"randomiv")->encrypt("hello world"))'; | |
var crypto = require ('crypto') | |
var input = 'UmFuZG9tSVZ2l2agomtNj7G5Rff4byYTKJAMbm4+51M='; | |
var input_buf = new Buffer(input, 'base64'); | |
var KEY_LENGTH = 8; |
OlderNewer