Skip to content

Instantly share code, notes, and snippets.

View baudehlo's full-sized avatar

Matt Sergeant baudehlo

View GitHub Profile
diff --git a/connection.js b/connection.js
index 7a00985..21b7ac1 100644
--- a/connection.js
+++ b/connection.js
@@ -927,12 +927,15 @@ Connection.prototype.rcpt_ok_respond = function (retval, msg) {
}
Connection.prototype.rcpt_respond = function(retval, msg) {
+ var rcpt = this.transaction.rcpt_to[this.transaction.rcpt_to.length - 1];
+ if (retval === constants.ok) {

Result Cache

Save, log, retrieve, and share the results of plugin tests.

Synopsis

Potential reasons to use the result cache in your plugin:

  • To have plugin results appear in watch output, in your web browser.
> var module = { exports: {} };
undefined
> var exports = module.exports;
undefined
> exports = "foo";
'foo'
> module;
{ exports: {} }
>
@baudehlo
baudehlo / lmtp.js
Last active August 29, 2015 13:56
var outbound = require('./outbound');
exports.hook_get_mx = function (next, hmail, domain) {
if (!hmail.todo.notes.using_lmtp) return next();
var config = this.config.get('lmtp.ini', 'ini');
var section = config[domain] || config.main;
var mx = {
priority: 0,
exchange: section.host || '127.0.0.1',
port: section.port || 24,
> var a = require('./address');
undefined
> var r = require('./rfc1869');
undefined
> var l = r.parse('lmtp', '<cpuser@laptop-workstation> Vd8eLmkY9VIpHQAAPRt7ew Saved');
undefined
> l
[ '<cpuser@laptop-workstation>',
'Vd8eLmkY9VIpHQAAPRt7ew',
'Saved' ]
$ dig x.xipzersscc.com txt
;; Truncated, retrying in TCP mode.
; <<>> DiG 9.8.3-P1 <<>> x.xipzersscc.com txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17078
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
@baudehlo
baudehlo / openfiles.pl
Created January 31, 2014 21:14
Run this with ulimit -n 20, it works and has /etc/passwd open 100 times. Run with ulimit -n 10 and it will fail (due to stdio being open already).
#!/usr/bin/perl -w
for (1..10) {
fork or open_files()
}
exit();
sub open_files {
my @files = ();
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);
}