This file contains hidden or 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
#!/usr/bin/python | |
# This work is licensed under the Creative Commons Attribution 3.0 United | |
# States License. To view a copy of this license, visit | |
# http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative | |
# Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | |
# from http://oranlooney.com/make-css-sprites-python-image-library/ | |
# Orignial Author Oran Looney <[email protected]> |
This file contains hidden or 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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
import os | |
import urllib | |
import urllib2 | |
import subprocess | |
def speak(text, language, filename): | |
""" |
This file contains hidden or 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
# Sem áudio | |
ffmpeg -f x11grab -r 30 -s 1366x768 -i :0+0,0 -vcodec libx264 -vpre lossless_ultrafast -threads 0 /tmp/tmp9sfmn4.mkv | |
# Com áudio | |
ffmpeg -f alsa -i pulse -f x11grab -r 30 -s 1366x768 -i :0+0,0 -ac 2 -acodec flac -ab 128k -vcodec libx264 -vpre lossless_ultrafast -threads 0 /tmp/tmprSIsES.mkv |
This file contains hidden or 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
""" | |
a alguns dias acompanhei pela lista brasileira do Web2py que alguns usuários estavam | |
com dificuldades com envio de email no GAE, hoje passei por isso :( segue dica para | |
quem também estiver com dificuldades no envio de email pelo GAE. | |
Em um modelo ex: "models/db.py" inclua o código abaixo: | |
""" | |
from gluon.tools import Mail |
This file contains hidden or 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
.borda-arredondada { | |
-webkit-border-radius: 3px; | |
-moz-border-radius: 3px; | |
border-radius: 3px; | |
behavior: url(/media/css/PIE.htc); | |
} |
This file contains hidden or 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: utf8 | |
from django.db import models | |
from django.contrib.auth.models import User, Permission | |
class Operator(models.Model): | |
user= models.ForeignKey(User,related_name='operator_user',blank=True,null=True,editable=False) | |
name = models.CharField(max_length=80) | |
username = models.CharField(max_length=30,unique=True) | |
password = models.CharField(max_length=30) |
This file contains hidden or 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
class IS_EMAIL_LIST(object): | |
def __init__(self, error_message="Email %s is invalid", sep=","): | |
self.error_message = error_message | |
self.sep = sep | |
def __call__(self, value): | |
emails = value.strip().replace('\n','').replace('\t','').split(self.sep) | |
for email in emails: | |
email = email.strip() | |
if IS_EMAIL()(email)[1] != None: |
This file contains hidden or 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 new_user(first_name, last_name, email, passw): | |
users = db(db.auth_user.email==email).select() | |
if users: | |
return users[0].id | |
else: | |
my_crypt = CRYPT(key=auth.settings.hmac_key) | |
crypt_pass = my_crypt(passw)[0] | |
id_user= db.auth_user.insert( | |
first_name=first_name, | |
last_name=last_name, |
This file contains hidden or 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
server { | |
server_name yourdomain.com.br yourdomain.net www.yourdomain.net; | |
rewrite ^/(.*) http://www.yourdomain.com.br/$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name www.yourdomain.com.br | |
This file contains hidden or 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 agora(): | |
... return datetime.now() | |
... | |
>>> from ludibrio import Stub | |
>>> with Stub() as datetime: | |
... from datetime import datetime | |
... datetime.now() >> 'foo' | |
... | |
>>> agora() | |
'foo' |