Skip to content

Instantly share code, notes, and snippets.

View maurobaraldi's full-sized avatar

Mauro Navarro Baraldi maurobaraldi

View GitHub Profile
/**
* Submittr v1.0
* jQuery plugin for form validation
* by Arthur <arthur@corenzan.com.br>
*
* Usage:
*
* $(':submit').submittr();
*
* Optional parameters:
@maurobaraldi
maurobaraldi / flask.local
Created July 15, 2011 01:54 — forked from jyr/flask.local
Flask on nginx
server {
listen 80;
server_name flask.local;
root /Applications/MNPP/htdocs/flask;
#location = / { rewrite ^ /flask/; }
location / {
try_files $uri @flask;
}
@maurobaraldi
maurobaraldi / .gitconfig
Created November 6, 2011 23:37 — forked from tomster/.gitconfig
An example git configuration including convenience aliases, some saner default behavior, a neat shell prompt and tab completion that can display the name of the tracking remote
# ~/.gitconfig
[branch]
autosetupmerge = true
[push]
default = current
[core]
excludesfile = .gitignore
@maurobaraldi
maurobaraldi / donotuse.py
Created December 5, 2011 13:22 — forked from e000/donotuse.py
How to NEVER use lambdas.
##########################################################
# How to NEVER use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda constru-#
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] #
# by: e000 (13/6/11) #
##########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much anonymous "one line" functions
@maurobaraldi
maurobaraldi / gist:1542214
Created December 31, 2011 00:36 — forked from JeffreyWay/gist:1525217
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@maurobaraldi
maurobaraldi / replacer_utf8
Created March 27, 2012 20:13 — forked from LucasMagnum/replacer_utf8
UTF-8 KILLER!
replacer = lambda s: s.replace('&Atilde;', 'Ã').replace('&Otilde;', 'Õ').replace('&Aacute;','Á').replace('&Eacute;', 'É').replace('&Iacute;','Í').replace('&Oacute;', 'Ó').replace('&Uacute;', 'Ú').replace('&Ccedil;', 'Ç').replace('&Acirc;','Â').replace('&Ecirc;','Ê').replace('&Ocirc;','Ô')
@maurobaraldi
maurobaraldi / gist:e9a57a366cf5c3dea9ff
Last active August 29, 2015 14:08 — forked from ThiagoAnunciacao/gist:cc54b806d4a10bf3408f
Informações para parser de dados da Bovespa
# Retorna dados sobre o pregão
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDados.asp?CodDado=IBOV,ticker&CA=undefined
# Retorna ações e seus últimos valores negociados
http://www.bmfbovespa.com.br/Pregao-OnLine/ExecutaAcaoCarregarDados.asp?CodDado=Ticker
# Retorna o histórico do dia de um papel
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDadosPapeis.asp?CodDado=petr4
# Retorna dados de um papel
@maurobaraldi
maurobaraldi / gist:899a88fe0bf7471574c1
Created December 29, 2015 16:56 — forked from anonymous/gist:dc9c249318f3f92d716b
Download math books from springer
from urllib2 import urlopen
from re import findall, search
base_url = "http://link.springer.com"
links = []
for i in xrange(1, 13):
index = base_url + '/search/page/%d?facet-series="136"&facet-content-type="Book"&showAll=false' % i
links.extend(findall('<a class="title" href="(.*?)"', urlopen(index).read()))
@maurobaraldi
maurobaraldi / nina.zsh-theme
Created January 27, 2016 17:08 — forked from nnja/nina.zsh-theme
My zshell prompt theme, a bastardization of robbyrussel & kolo themes
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u%B%F{green} '
@maurobaraldi
maurobaraldi / echo.py
Created February 1, 2016 13:11 — forked from benburry/echo.py
Python 2 - mock & unittest example for Popen
from subprocess import Popen, PIPE
def shell_out(command):
return Popen(command.split(' '), stdout=PIPE,stderr=PIPE).communicate()[0].strip('\n').split('\n')
def main():
return shell_out('echo one\ntwo\nthree\n')