Skip to content

Instantly share code, notes, and snippets.

View tanguylebarzic's full-sized avatar

Tanguy Le Barzic tanguylebarzic

View GitHub Profile
@tanguylebarzic
tanguylebarzic / sentinel.js
Last active December 17, 2015 00:29
Sentinel aware redis client.
/**
Usage example:
var redisConfig = {
masterName: "mymaster",
sentinels: [
{host: "127.0.0.1", port: 26384},
{host: "127.0.0.1", port: 26383},
{host: "127.0.0.1", port: 26382}
],
};
@tanguylebarzic
tanguylebarzic / app.js
Created December 18, 2012 21:25
Here, there is no server running at 127.0.0.2, so the call the http.request at line 12 will emit an error (that should be catched by the domain).
var domain = require('domain');
var http = require('http');
var respond = function(req, res){
var httpOptions = {
host : "127.0.0.2",
port : 50,
path : "/",
method : 'GET'
};
@tanguylebarzic
tanguylebarzic / Description.js
Created March 25, 2012 17:31
DKIM signing with Node.js
/*
Heavily inspired by the PHP implementation made by Ahmad Amarullah (available at http://code.google.com/p/php-mail-domain-signer/), with the help of http://phpjs.org/.
Setup:
In dkim-raw-email.js, change the location of your private key and the associatedDomain accordingly to your needs.
Example of use (using aws-lib, https://github.com/mirkok/aws-lib):