Skip to content

Instantly share code, notes, and snippets.

@lgelape
lgelape / stopwords_pt.R
Last active March 7, 2023 18:45
Create a dataset with stopwords in Portuguese (from Stopwords ISO, tidytext and tm packages)
### STOPWORDS IN PORTUGUESE
## Create a unique dataset from several datasets with stopwords in Portuguese
# Lucas Gelape
# Packages
library(dplyr)
library(stringi)
library(readr)
@bcks
bcks / index.js
Last active November 27, 2020 07:36
tableau-covid-scraping
// Works with Node v12.0 and puppeteer 4.0
const URL = 'https://public.tableau.com/views/PPV_15924847800480/ppv_db?%3Aembed=y&%3AshowVizHome=no&%3Adisplay_count=y&%3Adisplay_static_image=n&%3AbootstrapWhenNotified=true&%3Alanguage=en&:embed=y&:showVizHome=n&:apiID=host0';
const puppeteer = require('puppeteer');
function parseDataDictionary(jsonParsed) {
@freejoe76
freejoe76 / nbc-news-data-graphics-intern.md
Last active April 22, 2026 17:10
NBC News Data / Graphics internship

NBC News Data / Graphics team intern

The Data / Graphics team at NBC News is responsible for explaining the news through visualizations and data analysis.

We build interactives, charts, maps, illustrations, graphics and more to tell the news in a compelling and thoughtful way. See our recent work: https://www.nbcnews.com/datagraphics

The intern should be interested in data visualizations and be an avid news reader. They should have an interest in data journalism and will help find stories that we could be telling in a new and visual way. They will also help create charts, maps and graphics for breaking news stories and for reported features.

Note that this internship is only available to students actively enrolled in a degree-granting program throughout the entirety of the internship.

@gsalibi
gsalibi / validate_ibge.py
Last active March 2, 2022 17:12
This validates the IBGE municipal code and returns the 7th digit
def last_digit_ibge(cod6: str):
a = int(cod6[0])
b = (int(cod6[1]) * 2) % 10 + (int(cod6[1]) * 2) // 10
c = int(cod6[2])
d = (int(cod6[3]) * 2) % 10 + (int(cod6[3]) * 2) // 10
e = int(cod6[4])
f = (int(cod6[5]) * 2) % 10 + (int(cod6[5]) * 2) // 10
digit = (10 - (a + b + c + d + e + f) % 10) % 10
return str(digit)
@jph00
jph00 / webserver.py
Last active August 28, 2025 04:52
Minimal web server demo in Python (requires fastcore: `pip install fastcore`)
from fastcore.utils import *
host = 8888,'localhost'
sock = start_server(*host)
print(f'Serving on {host}...')
while True:
conn,addr = sock.accept()
with conn:
data = conn.recv(1024)
print(data.decode())
@bplmp
bplmp / script.sh
Last active July 12, 2021 17:35
Extrair autos de infração do IBAMA de HTML para CSV
# baixe os dados
curl http://dadosabertos.ibama.gov.br/dados/SIFISC/auto_infracao/auto_infracao/auto_infracao.html > autos.html
# gere csv
# (primeiro passo é quebrar as linhas, acelera o processamento)
cat autos.html \
| sed -e 's|<\/tr>|\n|g' \
| sed -e 's/.*<thead\sbgcolor\=\"\#808080\">//' \
-e 's|\salign\=\"center\"||g' \
-e 's|<\/th>|\|\|\||g' \
@tanho63
tanho63 / scoobydoo_pivot.R
Last active September 25, 2023 19:19
pivot_longer sentinel .value - scoobydoo tidy tuesday
library(tidyverse)
scooby_data <- read.csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-07-13/scoobydoo.csv")
x <-
scooby_data %>%
select(season, title,
starts_with("caught"),
starts_with("captured"),
starts_with("unmask"),
unidade_gestao<- 255000 #funasa
ano<-2020
#aqui pega todas as combinações de dia e mês. Pode-se alterar a partir da necessidade do usuário
dia_do_mes<- str_pad(as.character("1":"31"), side = "left",width=2, pad="0")
nome_mes<- str_pad(as.character("1":"12"), side = "left",width=2, pad="0")
data_com_erro<- tibble(dia=character(),mes=character(),ano=character())
mapa_completo_dados_abertos<-
@lgelape
lgelape / redes_sociais_candidatos2022.R
Created August 18, 2022 20:25
Obtém handle de redes sociais de candidatos (Twitter, Facebook, Instagram e Youtube) a partir de informações do Repositório de Dados Eleitorais do TSE
################################################################################
################################################################################
##########
########## OBTER HANDLE DE REDES SOCIAIS DE CANDIDATOS
########## A PARTIR DE INFORMACOES DO REPOSITORIO DO TSE
### Lucas Gelape
# Pacotes
library(dplyr)
@palewire
palewire / old-school.ipynb
Created October 15, 2024 16:25
"Old School" Machine Learning Classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.