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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: mongodb | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the mongodb data-store | |
# Description: starts mongodb using start-stop-daemon |
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
%% Author: bokner ([email protected]) | |
%% Created: Apr 10, 2010 | |
%% Description: HTTP digest authentication | |
%% Note: the code follows particular explanation given on Wikipedia. | |
%% Disclaimer: Use on your own risk. The author disclaims any liability | |
%% with regard to using this code. | |
-module(digest_auth). | |
%% | |
%% Include files |
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
# minimal async sinatra app | |
# requires ruby 1.9.x | |
require 'sinatra' | |
require 'em-http' | |
require 'em-synchrony' | |
require 'em-synchrony/em-http' | |
require 'rack/fiber_pool' | |
use Rack::FiberPool |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>RestMQ - Redis based message queue</title> | |
<link rel="stylesheet" href="style.css" type="text/css" media="screen"> | |
</head> | |
<body> | |
<div id="wrapper"> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <hiredis/libevent.h> | |
void getCallback(redisContext *c, redisReply *reply, const void *privdata) { | |
printf("argv[%s]: %s\n", (const char*)privdata, reply->reply); | |
/* Disconnect after receiving the reply to GET */ | |
redisDisconnect(c); |
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
# monkey patch to have base62 encoding over Integers and Strings | |
class Integer | |
def to_base62() | |
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
return alphabet[0] if self == 0 | |
num = self | |
arr = [] | |
base = alphabet.size | |
while num > 0 do |
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
mkdir heroku | |
cd heroku/ | |
virtualenv --no-site-packages env | |
source env/bin/activate | |
pip install bottle gevent | |
pip freeze > requirements.txt | |
cat >app.py <<EOF | |
import bottle | |
import os |
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
# kudos to https://github.com/drewlesueur | |
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535 | |
git checkout -b upstream/master | |
git remote add upstream git://github.com/documentcloud/underscore.git | |
git pull upstream master | |
git checkout master // [my master branch] | |
git merge upstream/master | |
git push origin master |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html | |
import sys | |
from twisted.internet import defer | |
from twisted.internet import protocol | |
from twisted.internet import reactor | |
from twisted.python import log |
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
import cyclone.web | |
import cyclone.auth | |
from cyclone import escape, httpclient | |
from cyclone.options import parse_command_line, define, options | |
from twisted.python import log | |
from twisted.internet import task, defer, reactor | |
import sys | |
try: | |
import urllib.parse as urllib_parse # py3 |
OlderNewer