Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################### | |
## ## | |
## Setup ## | |
## ## | |
############################################################################################### | |
# install.packages("Rfacebook") # from CRAN | |
# install.packages("Rook") # from CRAN | |
# install.packages("igraph") # from CRAN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
// Below, largely cribbed from Thomas Dondorf at https://stackoverflow.com/questions/52969381/how-can-i-capture-all-network-requests-and-full-response-data-when-loading-a-pag | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const [page] = await browser.pages(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE qgis_style> | |
<qgis_style version="2"> | |
<symbols> | |
<symbol name="qartoon" force_rhr="0" clip_to_extent="1" alpha="1" type="fill"> | |
<layer class="SimpleFill" enabled="1" locked="0" pass="0"> | |
<prop v="3x:0,0,0,0,0,0" k="border_width_map_unit_scale"/> | |
<prop v="0,0,0,255" k="color"/> | |
<prop v="round" k="joinstyle"/> | |
<prop v="1,1" k="offset"/> | |
<prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Proof of concept of using V8 to parse HTML in R | |
# Example taken from rvest readme | |
# Jeroen Ooms, 2015 | |
library(V8) | |
stopifnot(packageVersion("V8") >= "0.4") | |
# Get Document | |
html <- paste(readLines("http://www.imdb.com/title/tt1490017/"), collapse="\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rJava) | |
library(coreNLP) | |
initCoreNLP() | |
#in this case, 'test' is a data frame with a col named 'text' | |
for (i in 1:dim(test)[1]) { | |
cat(paste0(i / dim(test)[1] * 100, '% completed')) | |
ann <- annotateString(paste(test$text[i]), format = c("obj"), outputFile = NA, includeXSL = FALSE) | |
gd <- getDependency(ann) |
NewerOlder