Skip to content

Instantly share code, notes, and snippets.

Fernando Masanori fmasanori

Block or report user

Report or block fmasanori

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fmasanori
fmasanori / escolas.py
Created Feb 26, 2019
Escolas em funcionamento, sem luz, água e esgoto
View escolas.py
import requests
url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?'
situação = 'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on'
data = requests.get(url + situação).json()
print ('Primeiras 100 escolas:')
for escola in data[1]:
print (f'{escola["nome"]}, {escola["cidade"]}, {escola["estado"]}')
print ('Escolas em funcionamento, sem água, luz e esgoto:')
print (data[0])
@fmasanori
fmasanori / dinheiro.py
Created Nov 10, 2018
Conversão Monetária
View dinheiro.py
import locale
locale.setlocale(locale.LC_ALL, '')
valor = 1003353635.34
valor = locale.currency(valor, grouping=True,
symbol=None)
print (valor, type(valor))
valor = locale.atof(valor)
print (valor, type(valor))
View booyermoore.py
def boyermoore(p, t):
m = len(p)
n = len(t)
if m > n: return -1
pulo = [m for k in range(256)]
for k in range(m - 1):
pulo[ord(p[k])] = m - k - 1
pulo = tuple(pulo)
k = m - 1
while k < n:
View AST42.py
import ast
import codegen
expr='''
def resposta():
print ('Alô Mundo')
'''
p = ast.parse(expr)
p.body[0].body = [ast.parse('return 42').body[0]]
@fmasanori
fmasanori / bnmp_scraping_detail.py
Created Apr 27, 2018
BNMP Scraping Detail (by Felipe Koblinger)
View bnmp_scraping_detail.py
import pymongo
import requests
headers = {
'Host': 'www.cnj.jus.br',
'Connection': 'keep-alive',
'Accept': 'application/json, text/plain, */*',
'Origin': 'http://www.cnj.jus.br',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
'Content-Type': 'application/json;charset=UTF-8',
@fmasanori
fmasanori / bnmp_scraping_court_orders.py
Created Apr 27, 2018
BNMP Scraping Court Orders (by Felipe Koblinger)
View bnmp_scraping_court_orders.py
import pymongo
import requests
from redis import Redis
from rq import Queue
from bnmp_scraping_detail import download_court_order_detail
headers = {
'Host': 'www.cnj.jus.br',
'Connection': 'keep-alive',
'Accept': 'application/json, text/plain, */*',
@fmasanori
fmasanori / bnmp_scraping.py
Created Apr 27, 2018
BNMP scraping (by Felipe Koblinger)
View bnmp_scraping.py
import requests
import json
import time
import threading
from redis import Redis
from rq import Queue
from bnmp_scraping_court_orders import download_state_page
headers = {
'Host': 'www.cnj.jus.br',
@fmasanori
fmasanori / ER_para_limpar_dados.py
Created Mar 12, 2018
Limpeza de Dados com ER
View ER_para_limpar_dados.py
import re
p = re.compile(r'\d+')
d, m, a = p.findall('09-03-2018')
print (d, m, a)
d, m, a = p.findall('09/03/2018')
print (d, m, a)
a, m, d = p.findall('6(anos) 2(meses) 10(dias)')
print(a, m, d)
a, m, d = p.findall('6a2m10d')
@fmasanori
fmasanori / Maiores Valores Brutos UFRJ.txt
Created Dec 5, 2017
Maiores Valores Brutos Recebidos na UFRJ (out/2017)
View Maiores Valores Brutos UFRJ.txt
1608633 51019.17 ISAAC SIROTA ROTBANDE
2050691 49339.67 MARIA CRISTINA REIS AMENDOEIRA
1673322 49095.76 JOSE MONTEIRO SAD PEREIRA
1603131 47897.28 MARCELO SANTOS CRUZ
1897007 47294.72 MARTA RIBEIRO ROCHA E SILVA DE SENNA
2073488 47018.49 CARLOS ALBERTO DE MATOS PEIXOTO
1631227 46930.12 MARIA ARMANDA MONTEIRO DA SILVA VIEIRA
1660546 46648.80 GLORIA VALERIA DA VEIGA
1261609 46508.17 CLAUDIA MARIA DE ANDRADE EQUI
1817484 46253.84 RENATO TORRES GONCALVES
@fmasanori
fmasanori / raspa_cnj.py
Last active Apr 26, 2019
Raspa os mandados da BNMP
View raspa_cnj.py
import requests
import json
import pymongo
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.bnmp
mandados_mongoDB = db.mandados
cabeçalho = {
'Host': 'www.cnj.jus.br',
You can’t perform that action at this time.