Skip to content

Instantly share code, notes, and snippets.

View leobarone's full-sized avatar

Leonardo S. Barone leobarone

View GitHub Profile
@leobarone
leobarone / pizza_model_method_of_lines.ipynb
Created April 5, 2022 15:07
pizza_model_method_of_lines.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leobarone
leobarone / linear_programming_ortools.ipynb
Last active March 23, 2022 14:45
linear_programming_ortools.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leobarone
leobarone / integer_programming_ortools.ipynb
Last active March 23, 2022 14:44
integer_programming_ortools.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leobarone
leobarone / probabilidade_nascimento
Created May 17, 2019 20:40
Probabilidade condicional do nascimento
prob_diaria <- function(dias_passados){
dia_quantile <- seq(from = -2,
to = 2,
length.out = 30)
prob <- pnorm(dia_quantile)
prob <- c(prob[1], prob[2:29] - prob[1:28], prob[1])
d <- data.frame(dia = (40 * 7 - 15):(40 * 7 + 14),
prob)
@leobarone
leobarone / cardapio_prato_aberto.R
Last active April 11, 2019 13:25
Raspagem do cardapio no app prato aberto com RSelenium
library(RSelenium)
library(rvest)
library(stringr)
library(dplyr)
remDr <- remoteDriver(port = 4445L)
remDr$open(silent = TRUE)
url_prato_aberto <- "https://pratoaberto.sme.prefeitura.sp.gov.br/"
remDr$navigate(url_prato_aberto)
library(dplyr)
library(rvest)
library(stringr)
url_tabela_discursos <- "http://www.camara.leg.br/internet/sitaqweb/resultadoPesquisaDiscursos.asp?txOrador=&txPartido=&txUF=&dtInicio=17%2F04%2F2016&dtFim=17%2F04%2F2016&txTexto=&txSumario=&basePesq=plenario&CampoOrdenacao=dtSessao&PageSize=5000&TipoOrdenacao=DESC&btnPesq=Pesquisar"
url_discursos <- url_tabela_discursos %>%
read_html() %>%
html_nodes(xpath = "//table[@class ='table table-bordered variasColunas']//td/a") %>%
html_attr(name = "href")
library(rvest)
library(stringr)
library(dplyr)
library(purrr)
library(tm)
library(wordcloud)
library(tidytext)
library(ggplot2)
url_obra_completa <- "http://machado.mec.gov.br/obra-completa-mainmenu-123"
/* Autor: Leonardo Sangali Barone (CEBRAP/DCP-USP) */
/* Data: 05/03/2017 */
/* Criação de database e tabela para dados de matricula no MySQL */
/* Cria database CIEDU */
CREATE database CIEDU;
/* Cria tabela matriculas_2010_2016 */
/* Dados disponiveis em http://dados.prefeitura.sp.gov.br/dataset/microdados-da-rede-municipal-de-ensino-matriculas */
USE CIEDU;
library(dplyr, quietly = T)
library(data.table, quietly = T)
library(purrr, quietly = T)
library(rvest, quietly = T)
get_tse <- function(url_repo){
temp_dir <- tempdir()
temp_file <- tempfile()
library(rvest)
library(purrr)
stf_incidente <- function(tipo, numero){
stf_session <- html_session("http://www.stf.jus.br/portal/processo/listarProcesso.asp")
stf_session$url <- "http://www.stf.jus.br/portal/processo/listarProcesso.asp"
stf_form <- html_form(read_html(stf_session))[[3]]
stf_form <- set_values(stf_form,
numero = numero)
stf_submission <- submit_form(stf_session, stf_form)