Skip to content

Instantly share code, notes, and snippets.

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

Osvaldo Santana Neto osantana

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python
from inspect import getouterframes, currentframe
from copy import copy
from django.shortcuts import render_to_response
#def render_to_response(*args, **kw):
# print args, kw
@osantana
osantana / gist:825922
Created February 14, 2011 14:13
Our WIP fabfile deployment script
#!/usr/bin/env fab
# vim:ts=4:sw=4:tw=120:et:sm:foldmethod=indent
import os
import time
from fabric.api import *
from fabric.contrib import files
# Global Settings
@osantana
osantana / gist:996287
Created May 27, 2011 22:09
PHP FastCGI Upstart Configuration
We couldn’t find that file to show.
@osantana
osantana / carta_python.rst
Created October 4, 2011 01:59
Carta à Comunidade Python

Carta à Comunidade Python

Olá amigos Pythonistas,

Perdoem-nos pelo longo email mas nessa semana que passou muita coisa aconteceu na nossa comunidade.

Como muitos devem saber a 7ª edição da PythonBrasil aconteceu entre os dias 29/09 e 01/10 em São Paulo e foi sensacional.

Além de ter sido sensacional tivemos uma assembléia para eleger a nova diretoria da Associação Python Brasil e começamos a discutir sobre a próxima edição da PythonBrasil. Esse email trata desses dois assuntos.

@osantana
osantana / gist:4072195
Last active October 12, 2015 18:58
Kill Folha's Paywall
// ==UserScript==
// @name remove folha's paywall
// @namespace http://folha.uol.com.br/
// @version 0.1
// @description just remove folha's paywall
// @include http://*.folha*/*
// @match http://*.folha*/*
// @include http://*.blogfolha*/*
// @match http://*.blogfolha*/*
// @copyright 2012+, Me
@osantana
osantana / doctest_bug.py
Last active August 29, 2015 13:58
Bug(?) in Python doctest
#!/usr/bin/env python
# coding: utf-8
"""
The following test should pass, but it fails:
>>> def spam():
... print("eggs")
...
>>> assert spam(), "Print 'eggs' before AssertionError"
@osantana
osantana / keybase.md
Created February 27, 2015 14:09
keybase.md

Keybase proof

I hereby claim:

  • I am osantana on github.
  • I am osantana (https://keybase.io/osantana) on keybase.
  • I have a public key whose fingerprint is E4CD AE5B C3ED A864 0BBC F51F 5AAE A8B5 35B4 53D3

To claim this, I am signing this object:

@osantana
osantana / middleware.py
Last active August 29, 2015 14:22
subdomain
# -*- coding: utf-8 -*-
#
import re
from django.contrib.sites.models import get_current_site
from app.models.store import Store
from django.conf import settings
@osantana
osantana / messages.py
Created June 12, 2015 00:55
Django Text/HTML message with inline images
# coding: utf-8
import os
import re
import posixpath
import email.charset
from email.mime.image import MIMEImage
from urllib.parse import unquote
@osantana
osantana / views.py
Last active August 28, 2021 09:28
Django Form View Function
# Modo sugerido pela documentação do Django
def create(request, template_name="my_app/my_form.html"):
if request.method == 'POST':
form = MyForm(request.POST, request.FILES)
if form.is_valid():
instance = form.save(commit=False)
do_x() # custom logic here
instance.save()
return redirect('home')
else: