Skip to content

Instantly share code, notes, and snippets.

const RateLimiter = require('limiter').RateLimiter;
var limiters = {};
function getLimiter(accessToken) {
let limiter = limiters[accessToken] = limiters[accessToken] || new RateLimiter(10, 'second');
return limiter;
}
function download(accessToken, src, dst) {
@engina
engina / cgi-fork.pl
Created April 3, 2014 12:35
CGI Perl script to fork two commands and print the results.
#!/usr/bin/perl
print "Content-type: text/plain\r\n\n";
system( "uname -a" );
system( "uptime" );
@engina
engina / cgi-bash.sh
Created April 3, 2014 12:34
CGI Shell script that forks commands and prints the results.
#!/bin/bash
echo -e "Content-type: text/html\r\n\n"
uptime
uname -a
@engina
engina / php-fork.php
Created April 3, 2014 12:33
PHP application that forks commands and prints the results.
<?php
system( "uptime" );
system( "uname -a" );
?>
@engina
engina / cgi-c-fork.c
Created April 3, 2014 12:30
CGI application written in C that forks a command
#include <stdio.h>
#include <string.h>
#define BUF_LEN (1024)
void print_command( const char* cmd )
{
char stdout_buf[ BUF_LEN ];
size_t r;
FILE* p = popen( cmd, "r" );