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
# Public Domain, i.e. feel free to copy/paste | |
# Considered a hack in Python 2 | |
import inspect | |
def caller_name(skip=2): | |
"""Get a name of a caller in the format module.class.method | |
`skip` specifies how many levels of stack to skip while getting caller | |
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc. |
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
# -*- encoding: utf-8 -*- | |
# | |
# Python Script - Numeros da Megasena | |
# Faz o download do arquivo da Caixa Economica Federal, com todos os resultados | |
# da Mega já obtidos. Faz uma contagem simples e mostras, em ordem decrescente, | |
# a quantidade de vezes que os nros já foram sorteados. | |
# | |
# Author: Sergio Berlotto <[email protected]> | |
# Author website: http://berlotto.github.io | |
# Licence: GPLv3 |
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
#Chaves GPG (publica e privada) para criptografia e assinatura de emails, arquivos, etc... | |
#Local padrao das chaves: /home/<username>/.gnupg/ | |
#Criar | |
~$ gpg --gen-key | |
#Listar as chaves existentes | |
~$ gpg --list-keys | |
#Importar a chave publica de alguem |
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
import numpy as np | |
#------------------------------ | |
def rpHash(person): | |
hash = 5381 | |
value = person.upper() | |
for caracter in value: | |
hash = (( np.left_shift(hash, 5) + hash) + ord(caracter)) | |
hash = np.int32(hash) | |
return hash |
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
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin | |
from flask.ext.admin.contrib import sqlamodel | |
import wtforms | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite' |
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
#Fazer o setup de uma conta | |
rhc setup --server broker.getupcloud.com -l [email protected] | |
#Utilizar outro usuario no comandos (use o -l) | |
rhc apps -l [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
[user] | |
name = My Name | |
email = [email protected] | |
[color] | |
ui = auto | |
[push] | |
default = current | |
[alias] | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit |
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
#Atualizar repositório local com todas as branchs remotas | |
git remote update | |
#Ver todas as branchs disponiveis, locais e remotas | |
git branch -a | |
#Criar branch local com base em branch remota | |
git checkout -b serverfix origin/serverfix | |
#Remover branch local |
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
sudo python -m smtpd -n -c DebuggingServer localhost:25 |
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
_slugify_strip_re = re.compile(r'[^\w\s-]') | |
_slugify_hyphenate_re = re.compile(r'[-\s]+') | |
def slugify(value): | |
""" | |
Normalizes string, converts to lowercase, removes non-alpha characters, | |
and converts spaces to hyphens. | |
From Django's "django/template/defaultfilters.py". | |
""" | |
import unicodedata |