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 Ioredis = require('ioredis'); | |
var redis = new Ioredis(); | |
// Rolling window rate limiter | |
// | |
// key is a unique identifier for the process or function call being limited | |
// exp is the expiry in milliseconds | |
// maxnum is the number of function calls allowed before expiry | |
var redis_limiter_rolling = function(key, maxnum, exp, next) { | |
redis.multi([ |
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
/* recursive mkdir based on | |
http://nion.modprobe.de/blog/archives/357-Recursive-directory-creation.html | |
*/ | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <string.h> | |
#define PATH_MAX_STRING_SIZE 256 |