Skip to content

Instantly share code, notes, and snippets.

David Heidt witscher

Block or report user

Report or block witscher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nginx.conf
# Request Limiter checking multiple values with small footprint
# if referer is not set
map $http_referer $limit_referer {
default "";
"" "1";
"-" "1";
# if custom parameter is not set. i.e. you always expect urls like "/tracker?campaignid=1234"
View redis-stats
#!/usr/bin/env python
import redis
import statsd
import time
import argparse
import logging
import sys
import os
witscher / gist:3957793
Created Oct 26, 2012
custom nginx naxsi build instruction on Ubuntu 12.04
View gist:3957793
echo "deb precise nginx" > /etc/apt/sources.list.d/nginx.list
echo "deb-src precise nginx" >> /etc/apt/sources.list.d/nginx.list
wget -O - | apt-key add -
apt-get update
cd /usr/local/src
apt-get install build-essential libpcre3-dev zlib1g-dev libssl-dev
apt-get source nginx
tar -xvzf naxsi-core-0.48.tgz
cd nginx-1.2.4/
witscher / unicorn.conf
Created Jul 27, 2012
Upstart script for unicorn, bundler and a user contained rvm installation
View unicorn.conf
description "Unicorn"
# starting unicorn with bundler, and a user contained rvm:
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
chdir /path/to/current
View old-tomcat-threads
if($xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'} &&
$xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadCount'}) {
print "busy.value " . $xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'} . "\n";
print "idle.value " .
($xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadCount'} -
$xml->{'connector'}->{'http-'.$PORT}->{'threadInfo'}->[0]->{'currentThreadsBusy'}) . "\n";
} else {
print "busy.value U\n";
print "idle.value U\n";
witscher / gist:3011497
Created Jun 28, 2012
very, very simple HTTP POST upload app
View gist:3011497
# set max_body_size and http_basic_auth in your nginx config
require 'rubygems'
require 'sinatra'
get '/' do
"none ya business"
witscher / tomcat.conf
Created Jun 13, 2012
Apache Tomcat Upstart script
View tomcat.conf
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn limit 10 5
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat
You can’t perform that action at this time.