Skip to content

Instantly share code, notes, and snippets.

local _M = {}
function _M.content() {
ngx.say(cjson.encode({from = "a", file = "now"}))
}
return _M;
@fratuz610
fratuz610 / decrypt.js
Created November 20, 2015 04:27
Encrypt from Java and decrypt on Node.js - aes 256 ecb
// we determine the key buffer
var stringKey = "example";
var cipherText = ".........";
// we compute the sha256 of the key
var hash = crypto.createHash("sha256");
hash.update(stringKey, "utf8");
var sha256key = hash.digest();
var keyBuffer = new Buffer(sha256key);
@fratuz610
fratuz610 / gist:1f0bb56991f059236ee3
Created January 6, 2015 02:15
Redis Sentinel sysv-init service script for Ubuntu / Debian (based on the official 14.04 redis-server one)
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-sentinel
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-sentinel - Persistent key-value db sentinel process