Skip to content

Instantly share code, notes, and snippets.

View berlotto's full-sized avatar

Sérgio Berlotto Jr berlotto

View GitHub Profile
@berlotto
berlotto / smtp.sh
Created September 3, 2013 14:42
Run a simple python smtp server for development
sudo python -m smtpd -n -c DebuggingServer localhost:25
@berlotto
berlotto / gitcommands.sh
Last active January 31, 2017 16:52
git commands
#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
@berlotto
berlotto / .gitconfig
Created November 6, 2013 18:24
My git configuration
[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
@berlotto
berlotto / rhccommands.sh
Created November 21, 2013 00:45
Comandos da ferramenta de linha de comando do OpenShift (getupcloud.com)
#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]
@berlotto
berlotto / ckedit.py
Last active August 29, 2015 13:56 — forked from mrjoes/ckedit.py
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'
@berlotto
berlotto / realperson.py
Last active August 29, 2015 13:57
A Python server side implementation for jQuery Real Person Plugin
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
@berlotto
berlotto / chaves.sh
Created June 4, 2014 04:15
Chaves GPG e SSH
#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
@berlotto
berlotto / megasena.py
Last active December 21, 2021 21:49
Numeros da MegaSena
# -*- 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
# 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.
@berlotto
berlotto / .bashrc
Created November 10, 2014 18:57
Meu .basrhc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '