This file contains hidden or 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
"use strict"; | |
var EventBus = function() { | |
var events = []; | |
var p_on = function(eventName, callback) { | |
if (!events.some(function(e) { | |
return e.name == eventName; })) { | |
var new_event = { | |
name: eventName, | |
cb: callback | |
}; |
This file contains hidden or 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 sys = require('sys'), | |
spawn = require('child_process').spawn, | |
openssl = spawn('python', ['test.py']); | |
openssl.stdout.on('data', function (data) {+ | |
sys.print('signature is valid: ' + data); | |
}); | |
openssl.stderr.on('data', function (data) { | |
sys.print('Error: ' + data); |
This file contains hidden or 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'), | |
assert = require('assert'), | |
crypto = require('crypto'); | |
var msg = "Gaur!"; | |
fs.readFile('PrivateKey.pem', 'utf-8', function(e,pri) { | |
var signer = crypto.createSign('sha256').update(msg); | |
var signature = signer.sign(pri, output_format='base64'); | |
fs.readFile('PublicKey.pem', 'utf-8', function(e,pub) { |
This file contains hidden or 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains hidden or 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 amqp = require('./amqp'), | |
sys = require('sys'), | |
net = require('net'), | |
events = require('events'); | |
var RabbitClient = function() { | |
events.EventEmitter.call(this); | |
var self = this; | |
var connection = amqp.createConnection({ host: cfg.AMQP.Host }); | |
connection.addListener('ready', function () { |
This file contains hidden or 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
// Based on http://www.diveintojavascript.com/projects/sprintf-for-javascript | |
String.prototype.format = function() { | |
var i = 0, a, f = this, o = [], m, p, c, x, s = ''; | |
while (f) { | |
if (m = /^[^\x25]+/.exec(f)) { | |
o.push(m[0]); | |
} | |
else if (m = /^\x25{2}/.exec(f)) { | |
o.push('%'); |
NewerOlder