This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import settings | |
from fabric.contrib.console import confirm | |
from fabric.api import local, settings as fabric_settings, env, cd, run, sudo | |
env.hosts = ['domain_or_ip'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# E-mails | |
DEFAULT_FROM_EMAIL = 'Nome <[email protected]>' | |
EMAIL_USE_TLS = True | |
EMAIL_HOST = 'smtp.gmail.com' | |
EMAIL_HOST_USER = '[email protected]' | |
EMAIL_HOST_PASSWORD = 'senha' | |
EMAIL_PORT = 587 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alternatives = Alternative.objects.filter(exercise=exercise) | |
select_sql = u'''select courses_solveexercise.response | |
from courses_solveexercise where | |
courses_solveexercise.user_id=%s and | |
courses_solveexercise.alternative_id=courses_alternative.id''' | |
alternatives = alternatives.extra(select=SortedDict([('user_response', select_sql)]), | |
select_params=[user.id]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select address from mailer_email into outfile '/home/gileno/emails3.txt'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.core import setup | |
import py2exe | |
setup( | |
windows=[{ | |
'script': 'main.py', | |
'icon_resources': [(1, "icon.ico")], | |
}], | |
options={ | |
'py2exe': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from datetime import date, timedelta | |
def add_weekdays(initial_date, days): | |
final_date = initial_date | |
for i in xrange(1, days + 1): | |
final_date = final_date + timedelta(days=1) | |
while final_date.weekday() in [5, 6]: | |
final_date = final_date + timedelta(days=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import mechanize | |
br = mechanize.Browser() | |
br.open("http://www.bmfbovespa.com.br/opcoes/opcoes.aspx?Idioma=pt-br") | |
br.select_form(nr=0) | |
# data/hora yyyy-mm-dd-hh-mm-ss | |
br["ctl00$contentPlaceHolderConteudo$posicoesAbertoEmp$txtConsultaDataDownload$txtConsultaDataDownload$dateInput"] = "2012-02-22-00-00-00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) | |
STATICFILES_DIRS = ( | |
# Put strings here, like "/home/html/static" or "C:/www/django/static". | |
# Always use forward slashes, even on Windows. | |
# Don't forget to use absolute paths, not relative paths. | |
os.path.join(PROJECT_ROOT, 'static'), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("#meu-form").submit(function(e) { | |
e.preventDefault(); | |
var data = $(this).serialize(); | |
$.ajax( { | |
url: "minha-url", | |
type: "post", | |
data: data, | |
dataType: "json", | |
success: function(json) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
class NivelParcelaHabitanteForm(forms.ModelForm): | |
def __init__(self, *args, **kwargs): | |
super(NivelParcelaHabitanteForm, self).__init__(*args, **kwargs) | |
self.fields['i'].localize = True | |
self.fields['i'].widget.is_localized = True | |
self.fields['ii'].localize = True | |
self.fields['ii'].widget.is_localized = True |