Skip to content

Instantly share code, notes, and snippets.

View gabrielfalcao's full-sized avatar

Gabriel Falcão gabrielfalcao

View GitHub Profile
import tornado.web
class route(object):
"""
decorates RequestHandlers and builds up a list of routables handlers
Tech Notes (or "What the *@# is really happening here?")
--------------------------------------------------------
Everytime @route('...') is called, we instantiate a new route object which
import logging
import os
# Add appengine stuff to path
import dev_appserver as script
script.fix_sys_path()
from google.appengine.api import yaml_errors
from google.appengine.tools import dev_appserver
from google.appengine.tools import dev_appserver_main as main
@ericflo
ericflo / twisted_proxy.py
Created November 22, 2010 01:11
Proxies local stuff, depending on whether it's /live/ or not.
#!/usr/bin/env python
from twisted.internet import reactor
from twisted.web import proxy, server
from twisted.web.resource import Resource
class ProxyResource(Resource):
def getChild(self, path, request):
request.received_headers['x-forwarded-host'] = request.received_headers['host']
@gabrielfalcao
gabrielfalcao / nose_runner.py
Created December 14, 2010 18:36
Nose Runner runs tests for django apps
# -*- coding: utf-8 -*-
# Copyright (C) <2010> Gabriel Falcão <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@mlafeldt
mlafeldt / scp_demo.py
Created February 24, 2011 09:09
[Python] paramiko examples
#!/usr/bin/env python
import sys, paramiko
if len(sys.argv) < 5:
print "args missing"
sys.exit(1)
hostname = sys.argv[1]
password = sys.argv[2]
@gabrielfalcao
gabrielfalcao / README.md
Created June 3, 2011 19:44
Homebrew formula for nginx with the tcp socket proxy module already enabled
@dexterous
dexterous / terrain.py
Created June 22, 2011 10:51 — forked from groner/terrain.py
Hooks for lettuce to run a test pylons app
'''Hooks for lettuce to run a test pylons app'''
from lettuce import *
from paste.fixture import TestApp
import pylons.test
from paste.deploy.loadwsgi import loadapp
from paste.script.appinstall import SetupCommand
@wadey
wadey / iterm2.zsh
Last active June 11, 2025 12:29
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@fredrick
fredrick / screen.md
Created September 14, 2011 15:30
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow
@ssbarnea
ssbarnea / test_ansi.py
Created October 26, 2011 16:18
ANSI support detection code for Python.
#!/usr/bin/env python
import sys, os, time, platform
sample_ansi = '\x1b[31mRED' + '\x1b[33mYELLOW' + '\x1b[32mGREEN' + '\x1b[35mPINK' + '\x1b[0m' + '\n'
for handle in [sys.stdout, sys.stderr]:
if (hasattr(handle, "isatty") and handle.isatty()) or \
('TERM' in os.environ and os.environ['TERM']=='ANSI'):
if platform.system()=='Windows' and not ('TERM' in os.environ and os.environ['TERM']=='ANSI'):