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
def gera_boleto(): | |
import datetime | |
import pyboleto | |
from pyboleto.bank.caixa import BoletoCaixa | |
from pyboleto.pdf import BoletoPDF | |
import os | |
listaDadosCaixa = [] | |
for i in range(2): | |
d = BoletoCaixa() |
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
{background-color: #465455} // barra superior | |
BUSCA | |
{background-color: #ECEDEF} // campo busca | |
{background-color: #5A6668} // botão busca | |
{background-color: #FFFFFF} // ícone busca | |
{background-color: #2D2D2D} // fundo | |
Description |
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
[ | |
(u'downloads.tryton.org', 1201), | |
(u'github.com', 811), | |
(u'bitbucket.org', 428), | |
(u'launchpad.net', 279), | |
(u'www.doughellmann.com', 255), | |
(u'walco.n--tree.net', 161), | |
(u'prdownloads.sourceforge.net', 156), | |
(u'infrae.com', 150), | |
(u'downloads.sourceforge.net', 139), |
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
""" | |
Inspired by http://code.activestate.com/recipes/578253-an-entry-with-autocompletion-for-the-tkinter-gui/ | |
Changes: | |
- Fixed AttributeError: 'AutocompleteEntry' object has no attribute 'listbox' | |
- Fixed scrolling listbox | |
- Case-insensitive search | |
- Added focus to entry field | |
- Custom listbox length, listbox width matches entry field width | |
- Custom matches function | |
""" |
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 functools import wraps | |
from flask import Flask, request, Response | |
app = Flask(__name__) | |
def check_auth(username, password): | |
"""This function is called to check if a username / | |
password combination is valid. | |
""" | |
return username == 'username' and password == 'pass' |
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 weasyprint import HTML, CSS | |
from weasyprint.document import _prepare | |
def get_page_body(boxes): | |
for box in boxes: | |
if box.element_tag == 'body': | |
return box |
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 webclient import * | |
server = "http://myaccount.erpnext.com/server.py" | |
user = "your user name" | |
password = "your password" | |
login() | |
customer = get_doc("Customer", customer_name) |
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 PIL import ImageFont | |
from PIL import Image | |
from PIL import ImageDraw | |
from StringIO import StringIO | |
font = ImageFont.load_default() | |
input = StringIO(self.request.get("img")) | |
img = Image.open(input) | |
draw = ImageDraw.Draw(img) |
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 PIL import Image | |
def get_white_noise_image(width, height): | |
pil_map = Image.new("RGBA", (width, height), 255) | |
random_grid = map(lambda x: ( | |
int(random.random() * 256), | |
int(random.random() * 256), | |
int(random.random() * 256) | |
), [0] * width * height) | |
pil_map.putdata(random_grid) |
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 | |
u""" | |
Redimensionamento proporcional de imagem, com base na altura, feito com um simples cálculo de proporção. | |
Ex: | |
+------+ 10 15 (altura desejada para a nova imagem) | |
| | -- x -- | |
| 10x5 | 5 x (largura proporcional a nova altura) | |
| | | |
+------+ (10 x x) = (5 x 15) | |
10x = 75 |