Skip to content

Instantly share code, notes, and snippets.

View zstumgoren's full-sized avatar

Serdar Tumgoren zstumgoren

View GitHub Profile
@xintron
xintron / testrunner.py
Created April 19, 2010 21:56
Django testrunner for mongoengine
from django.test.simple import DjangoTestSuiteRunner
from django.test import TransactionTestCase
from mongoengine import connect
class TestRunner(DjangoTestSuiteRunner):
def setup_databases(self, **kwangs):
db_name = 'testsuite'
connect(db_name)
print 'Creating test-database: ' + db_name
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
@drinks
drinks / awesome.js
Created August 19, 2011 17:30
Auto-Awesome in turntable.fm
var loveit = function(){
var e,el,interval=Math.random()*60000;
e = new jQuery.Event("click");
e.pageX=1;
e.pageY=1;
el = jQuery('.record_pile:last').nextAll('a').eq(2);
turntable.lastMotionTime=new Date().getTime();
el.hover().trigger(e);
setTimeout(loveit, interval);
};
@jeremyjbowers
jeremyjbowers / awesome.js
Created October 31, 2011 14:29 — forked from drinks/awesome.js
Better AutoAwesome
var loveit = function(){var e,el,interval=Math.random()*60000;e = new jQuery.Event("click");e.pageX=1;e.pageY=1;el = jQuery('.record_pile:last').nextAll('a').eq(2);turntable.lastMotionTime=new Date().getTime();el.hover().trigger(e);setTimeout(loveit, interval);};loveit();
@jeremyjbowers
jeremyjbowers / varnish-complex.vcl
Created December 31, 2011 05:27
A complex Varnish configuration file.
/*
*
* Instead of a single backend, let's set up a more complex multi-server director.
* This director will randomly assign each request to one of three application servers.
*
*/
director backend random {
.retries = 5;
{
.backend = {
@gazoombo
gazoombo / .tmux.conf
Created January 27, 2012 20:27
My current ~/.tmux.conf
# Solarized colorscheme/theme from
source-file git/github/tmux-colors-solarized/tmuxcolors.conf
# Report that we can handle 256 colors
set -g default-terminal "screen-256color"
# Rebind prefix to avoid conflicts
#unbind C-b
#set -g prefix C-q
#bind C-q send-prefix
"""
A few notes:
* Lines starting with "#" signs are standard Python code comments
* Multi-line comments can be wrapped in triple-quotes (""")
"""
from itertools import islice, product
import calendar
from BeautifulSoup import BeautifulSoup
import requests

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@wrburgess
wrburgess / gist:2187164
Created March 24, 2012 19:37
Setting up a Rails has_many :through relationship with meaningful relationship table #rails #activerecord #relations

##References

##Create Models

Create tables:

rails g model Location
rails g model User
rails g model Checkin
@jeremyjbowers
jeremyjbowers / nginx.conf
Created December 31, 2012 01:22
A standard Nginx configuration for a uWSGI/Python application.
worker_processes 2; # sets two workers. might need 4 in a very high-traffic environment.
user www-data; # user to run nginx as.
pid /var/run/nginx.pid; # you'll have to create this pidfile or else things won't work.
events {
worker_connections 1024; # connections each worker can take.
use epoll; # epoll is vastly superior to other alternatives.
}
http {