Skip to content

Instantly share code, notes, and snippets.

View valdergallo's full-sized avatar
🏠
Working from home

Valder Gallo valdergallo

🏠
Working from home
View GitHub Profile
@valdergallo
valdergallo / screenrc
Created June 23, 2012 18:44
screenrc
#
# This is an example for the global screenrc file.
# You may want to install this file as /usr/local/etc/screenrc.
# Check config.h for the exact location.
#
# Flaws of termcap and standard settings are done here.
#
#startup_message off
@valdergallo
valdergallo / vimrc
Last active January 4, 2017 14:12
vimrc for server
" Reference:
" http://sontek.net/turning-vim-into-a-modern-python-ide
" https://github.com/amix/vimrc
" Enable filetype plugins
filetype on
filetype plugin on
filetype indent off
let g:pyflakes_use_quickfix = 0
@valdergallo
valdergallo / celeryconfig.py
Created June 29, 2012 11:30
Configuration for celery with django
# List of modules to import when celery starts.
CELERY_IMPORTS = ("app.tasks", )
BROKER_HOST = "192.168.134.141"
BROKER_PORT = 5672
BROKER_VHOST = "ubuntumq"
BROKER_USER = "ubuntu"
BROKER_PASSWORD = "ubuntu"
## Worker settings
@valdergallo
valdergallo / fabfile_config.py
Created July 5, 2012 13:06
Create config with fabric example
from fabric.contrib.files import append, contains, exists
@task
def config_insert_line():
insert_this = """something"""
if exists('somefile.conf'):
if not contains('somefile.conf', insert_this):
append('somefile.conf', insert_this)
else:
@valdergallo
valdergallo / my.cnf
Created July 17, 2012 16:40
MySQL config with InnoDB
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
tmp_table_size = 32M
max_heap_table_size = 32M
@valdergallo
valdergallo / .gitconfig
Created August 22, 2012 17:16 — forked from igorski89/.gitconfig
git confing
[alias]
st = status
ci = commit
co = checkout
di = diff
dc = diff --cached
amend = commit --amend
aa = add --all
ff = merge --ff-only
pullff = pull --ff-only
@valdergallo
valdergallo / base_clean.py
Created November 8, 2012 03:00
Simple implementation of clean without fields
class BaseClean(object):
cleaned_data = []
_errors = []
def _clean_instance(self):
for item in dir(self):
if item.startswith('clean_'):
validated = getattr(self, item)
try:
if callable(validated):
@valdergallo
valdergallo / gist:4558758
Created January 17, 2013 19:19
sublimetext2.user.settings
{
// my favorite color
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// font size default
"font_size": 11,
// ignore lines with more than 80 caracters
"pep8_ignore": ["E501"],
@valdergallo
valdergallo / baralho.py
Last active October 26, 2022 16:54
Ex. de baralho com python do Ramalho do Curso Python sem Sotaque
from random import shuffle
class Carta(object):
def __init__(self, valor, naipe):
self.valor = valor
self.naipe = naipe
def __repr__(self):
return '<%s de %s>' % (self.valor, self.naipe)
@valdergallo
valdergallo / djangosnippets.py
Last active December 15, 2015 08:09
Auto-documenting Django Models with Sphinx - http://djangosnippets.org/snippets/2533/
THIS_DIR = os.path.dirname(__file__)
PROJECT_DIR = os.path.join(THIS_DIR, 'relative/path/to/your/project/')
sys.path.append(PROJECT_DIR)
import inspect
import settings
from django.core.management import setup_environ
from django.utils.html import strip_tags
from django.utils,encoding import force_unicode