Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho gilsondev

💼
Work
View GitHub Profile
@gourneau
gourneau / python-pil-image-sprite.py
Created April 24, 2011 02:45
Make sprites of images using Python and PIL
#!/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]>
@danielfm
danielfm / speak.py
Created May 6, 2011 14:01
Google Translate text-to-speech client
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import urllib
import urllib2
import subprocess
def speak(text, language, filename):
"""
@gilsondev
gilsondev / kazam_record.sh
Created May 12, 2011 02:33
Comando para gravar a área de trabalho com e sem áudio
# 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
@lucasdavila
lucasdavila / sending_email_in_gae_using_web2py_mail_api.py
Created May 28, 2011 13:02
Sending email in GAE using web2py Mail API
"""
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
@andrewsmedina
andrewsmedina / gist:1036076
Created June 20, 2011 17:29
borda arredondada css3
.borda-arredondada {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
behavior: url(/media/css/PIE.htc);
}
@gilsondev
gilsondev / operator_models.py
Created June 28, 2011 12:14
Overriding the method save() and delete() to insert a user with their information.
# 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)
@rochacbruno
rochacbruno / IS_EMAIL_LIST.py
Created July 6, 2011 08:41
IS EMAIL LIST validator for web2py
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:
@rochacbruno
rochacbruno / new_user.py
Created July 6, 2011 21:19
create new web2py users
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,
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
@andrewsmedina
andrewsmedina / gist:1072650
Created July 8, 2011 19:45
stub in python with ludibrio
>>> def agora():
... return datetime.now()
...
>>> from ludibrio import Stub
>>> with Stub() as datetime:
... from datetime import datetime
... datetime.now() >> 'foo'
...
>>> agora()
'foo'