Skip to content

Instantly share code, notes, and snippets.

View sergiospagnuolo's full-sized avatar
🐕‍🦺

Sérgio Spagnuolo sergiospagnuolo

🐕‍🦺
View GitHub Profile
@yanofsky
yanofsky / LICENSE
Last active May 7, 2024 12:36
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@letanure
letanure / estados-cidades.json
Last active April 30, 2024 23:07
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@jlomako
jlomako / openai_in_R.R
Created October 27, 2022 15:34
use GPT-3 in R with the OpenAI API
#####################################################
# Use GPT-3 in R with the OpenAI API. You need to install the reticulate package.
# Additionally, an API key is required that must be saved in a separate file, called .openaikey
# Get your API key here: https://openai.com/api/
#####################################################
# install.packages("reticulate") # run only once
library(reticulate)
# create python env
@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)
@fernandobarbalho
fernandobarbalho / gist:40f7e6c0cf925065e21084062e5ad513
Last active August 9, 2022 20:55
script para leitura e tratamento de tabela do ibama sobre oleamento de praias do NE
library(tabulizer)
library(dplyr)
setwd("~/GitHub/oleogate/data")
#Extrai tabelas do arquivo pdf.
#Esse arquivo foi baixado do seguinte link
# https://politica.estadao.com.br/blogs/estadao-verifica/wp-content/uploads/sites/690/2019/10/Ibama.pdf
#A tabela é extraída para um arquivo csv de forma a poder trabalhar melhor questões de encoding
tabulizer::extract_tables("ibama.pdf", output = "csv",outdir = getwd())
@benmarwick
benmarwick / PDF-2-text-or-CSV.r
Last active July 18, 2022 03:48
Convert PDFs to text files or CSV files (DfR format) with R
# Here are a few methods for getting text from PDF files. Do read through
# the instructions carefully! NOte that this code is written for Windows 7,
# slight adjustments may be needed for other OSs
# Tell R what folder contains your 1000s of PDFs
dest <- "G:/somehere/with/many/PDFs"
# make a vector of PDF file names
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
@fernandobarbalho
fernandobarbalho / get_cofog_data.r
Created July 14, 2021 15:02
Extração de dados do cofog diretamente da base de dados abertos do Tesouro Transparente
library(readxl)
library(ckanr)
library(purrr)
ckanr::package_search()
package<- ckanr::package_show(id= "22d13d17-bf69-4a1a-add2-25cc1e25f2d7",
url= "https://www.tesourotransparente.gov.br/ckan") #busca todos os dados do dataset que se refere aos dados de COFOG
@jpravetz
jpravetz / product_generator.rb
Created December 2, 2011 21:24
Jekyll generator to read json data file and generate product and ingredient pages
#------------------------------------------------------------------------
# encoding: utf-8
# @(#)product_generator.rb 1.00 29-Nov-2011 16:38
#
# Copyright (c) 2011 Jim Pravetz. All Rights Reserved.
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
#
# Description: A generator that creates product, products and
# ingredients pages for jekyll sites. Uses a JSON data
# file as the database file from which to read and
@fernandobarbalho
fernandobarbalho / script_indice_FIRJAN.R
Last active May 25, 2021 17:33
Script para cálculo do índice de autonomia da FIRJAN usando o pacote rsiconfi
# install.packages("devtools")
devtools::install_github("tchiluanda/rsiconfi")
library(rsiconfi)
library(dplyr)
library(tidyr)
###########Trabalhando as despesas
#Monta um vetor com todos os códigos de UFs do Brasil