Skip to content

Instantly share code, notes, and snippets.

@mathiasfls
mathiasfls / json2csv.R
Created February 26, 2021 23:09 — forked from retrography/json2csv.R
JSON to CSV convertor. Uses `jsonlite` R package, flattens all the hierarchical structure and converts all remaining lists/arrays into strings.
#!/usr/bin/Rscript
if (!require(jsonlite, quietly = TRUE, warn.conflicts = FALSE)) {
stop("This program requires the `jsonlite` package. Please install it by running `install.packages('jsonlite')` in R and then try again.")
}
args <- commandArgs(trailingOnly = TRUE)
if (length(args) == 0) {
input <- readLines(file("stdin"))
@mathiasfls
mathiasfls / script.sh
Created July 12, 2021 17:35 — forked from bplmp/script.sh
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' \
@mathiasfls
mathiasfls / new-school.ipynb
Created October 15, 2024 22:44 — forked from palewire/new-school.ipynb
"New School" LLM Classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mathiasfls
mathiasfls / old-school.ipynb
Created October 15, 2024 22:44 — forked from palewire/old-school.ipynb
"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.