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 boto.s3.connection import S3Connection | |
conn = S3Connection('awskey', 'awssecret') | |
bucket = conn.get_bucket('awsbucket') |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
$script = <<-SCRIPT | |
apt-get update | |
locale-gen en_US en_US.UTF-8 pt_BR pt_BR.utf8 pt_PT.utf8 | |
dpkg-reconfigure locales | |
apt-get install -y --force-yes curl git |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from provy.core import Role | |
from provy.more.debian import AptitudeRole | |
from provy.more.debian import NginxRole | |
from provy.more.debian import SupervisorRole | |
from provy.more.debian import TornadoRole | |
from provy.more.debian import UserRole |
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
// Custom Iphone screen (MIN) | |
@screen-iphone-min: 320px !default; | |
// Extra small screen / phone (MIN) | |
@screen-xs-min: 480px !default; | |
// Small screen / tablet (MIN) | |
@screen-sm-min: 768px !default; | |
// Medium screen / desktop (MIN) | |
@screen-md-min: 992px !default; | |
// Large screen / wide desktop (MIN) | |
@screen-lg-min: 1200px !default; |
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
# Enter python manage.py shell | |
from django.core.mail import EmailMessage | |
email = EmailMessage('Subject', 'Message', to=['example@example.com']) | |
email.send() | |
# It should return 1 if everything is ok. |
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
class ModelA(models.Model): | |
attr1 = models.Charfield() | |
attr2 = models.Charfield(unique=True) | |
class ModelB(models.Model): | |
foreign = models.ForeignKey(ModelA) | |
class OtherFieldUniqueSerializer(serializers.PrimaryKeyRelatedField): |
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
#!/bin/bash | |
pdb_check=$(git grep pdb -- '*.py') | |
if [ ${#pdb_check} -gt 0 ] | |
then | |
echo "COMMIT REJECTED: commit contains code with break points. Please remove before commiting." | |
echo $pdb_check | |
exit 1 | |
else | |
echo "Code contains no break points" |
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 Crypto.Cipher import XOR | |
import base64 | |
import functools | |
import hashlib | |
def func_encrypt(key, plaintext): | |
cipher = XOR.new(key) |
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
#!/usr/bin/python | |
import psycopg2 | |
import sys | |
host = '' | |
dbname = '' | |
user = '' | |
password = '' | |
port = 5432 |
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 itertools import tee | |
class ListaTelefones(object): | |
def __init__(self, lista_de_telefones): | |
self.telefones = lista_de_telefones.split() | |
self.telefones_validos = [] |
OlderNewer