Skip to content

Instantly share code, notes, and snippets.

View vindia's full-sized avatar

Vincent Oord vindia

View GitHub Profile
@vindia
vindia / gunicorn-graphite.sh
Created May 1, 2012 09:38
Startup script for Graphite on Gunicorn
#! /bin/sh
### BEGIN INIT INFO
# Provides: gunicorn-graphite
# Required-Start: $remote_fs $syslog mysql
# Required-Stop: $remote_fs $syslog mysql
# Should-Start: $nginx
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: gunicorn + nginx debian init script
# Description: gunicorn + nginx debian init script
@vindia
vindia / gunicorn-graphite
Created May 1, 2012 09:06
Nginx site configuration for Graphite
server {
listen 80 default deferred;
client_max_body_size 4G;
server_name stats.springest.net;
keepalive_timeout 5;
# path for static files
root /opt/graphite/webapp/content;
index index.html;
@vindia
vindia / nginx.conf
Created May 1, 2012 09:04
Nginx config for Gunicorn
worker_processes 1;
user www-data;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
accept_mutex off;
}
@vindia
vindia / routes.rb
Created April 11, 2012 08:07
Namespaced routing for subdomains in Rails
Rails::Application.routes.draw do
constraints :subdomain => 'admin' do
namespace(:admin, :path => '/') do
resources :books
end
end
end
@vindia
vindia / gist:2133015
Created March 20, 2012 08:54
Campfire Notification for Capistrano deploys
namespace :campfire do
desc "Notify deploy"
task :notify do
room_id = 123456 # Room ID for the Campfire Room you want this notification to appear in
token = ENV['CAMPFIRE_TOKEN'] || 'YOUR_CAMPFIRE_TOKEN' # Enter your campfire token here
if (token == 'YOUR_CAMPFIRE_TOKEN')
user_name_is = `whoami` + ' is'
else
user_name_is = "I am"
@vindia
vindia / gist:2006390
Created March 9, 2012 12:47
Get all the tags a commit is in, with support for version numbers
# Supports versions like 1.3.6. If you need more digits, add more options with the -k flag
git tag --contains 44b09171 | sort -t. -k1,1n -k2,2n -k3,3n
@vindia
vindia / gist:1989029
Created March 6, 2012 21:19
Gource and FFMPEG using h2.64 codec
gource --start-position 0.99 --seconds-per-day 1 --logo ~/springest/webroot/images/logo-springest-small.png --background 919191 --user-image-dir ~/tmp/git-avatars/ -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -threads 0 -bf 0 gource.mp4
@vindia
vindia / org.varnish-cache.varnishd.plist
Created March 2, 2012 14:16
Launch varnish with launchd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.varnish-cache.varnishd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/varnishd</string>
<string>-f</string>
@vindia
vindia / clickout.html
Created February 28, 2012 11:50
Uncached Redirect
<!DOCTYPE html>
<title>Anti spam test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('a').click(function(e){
e.preventDefault();
location.href = $(this).attr('rel') ;
});
});
@vindia
vindia / org.apache.lucene.plist
Created January 23, 2012 13:20
Launch solr with launchd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.apache.lucene</string>
<key>ProgramArguments</key>
<array>
<string>java</string>