Skip to content

Instantly share code, notes, and snippets.

View gabrielfalcao's full-sized avatar

Gabriel Falcão gabrielfalcao

View GitHub Profile
wget -rkpx <address> -l 10 --tries=10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <JsshDriver - drive firefox with js>
# Copyright (C) <2010> Gabriel Falcão <[email protected]>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <image downloader - bulk-download all images>
# 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.
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) <2010> Gabriel Falcão <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
export TERM="xterm-color"
alias ls="ls -G"
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] "
alias egrep="egrep --colour"
alias grep="egrep --colour"
export PYTHONPATH=$PYTHONPATH:$HOME/usr/python-libs:/Library/Python/2.6/site-packages/
export PATH=$PATH:$HOME/usr/bin:/usr/local/sbin:$HOME/.node_libraries/.npm
export GEM_HOME='/usr/local/Cellar/gems/1.8'
export BASH_COMPLETION_PATH=$HOME/usr/bash_completion.d
if [ -f `brew --prefix`/etc/bash_completion ]; then
+ (NSString*) getClassName {
ObjC_Class_Info myClass = [self class];
NSString* className = [NSString stringWithCString: (const char*) myClass->name];
return className;
}
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
#!/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 / paginator-from-hell
Created November 24, 2010 23:46
paginates python iterables in chunks of lists
def paginator_from_hell(items, chunk=5):
"""
usage:
paginator_from_hell(["A","A","A","A","A","B","B","B","B","B",0,0,0,0,0,"D","D","D","D","D","E","E"]
returns:
[
["A","A","A","A","A"],
["B","B","B","B","B"],
[0,0,0,0,0],
@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