Skip to content

Instantly share code, notes, and snippets.

View robsalasco's full-sized avatar
🏠
Working from home

Roberto Salas robsalasco

🏠
Working from home
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const searchParams = new URL(request.url).searchParams
let url = searchParams.get('url')
if (url && !url.match(/^[a-zA-Z]+:\/\//)) url = 'http://' + url
@robsalasco
robsalasco / config.fish
Created November 29, 2021 02:34
Default fish config
set -U fish_greeting "🐟"
set -Ux RSTUDIO_WHICH_R /usr/local/bin/R
set -Ux EDITOR /usr/local/bin/subl
set default_path /usr/bin /usr/sbin /bin /sbin
set homebrew_arm /opt/homebrew/bin /opt/homebrew/sbin
set homebrew_x86 /usr/local/bin /usr/local/sbin
set architecture (arch)
library(jsonlite)
library(purrr)
library(stringr)
library(tibble)
library(tidyr)
library(janitor)
library(glue)
extract_results <- function(distrito) {
g <- read_json(glue("https://www.servelelecciones.cl/data/elecciones_convencionales_g/computo/distritos/60{distrito}.json"),
library(ggforce)
#> Loading required package: ggplot2

circulo <- data.frame(
  x = 0,
  y = 0,
  r = 1
)
library(sf)
#> Linking to GEOS 3.8.1, GDAL 3.1.1, PROJ 7.1.0
library(tmap)
library(purrr)
library(jsonlite)
#> 
#> Attaching package: 'jsonlite'
#> The following object is masked from 'package:purrr':
#> 
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from requests import get
from lxml import html, etree
import camelot
import pandas as pd
import numpy as np
url = 'https://www.minsal.cl/nuevo-coronavirus-2019-ncov/casos-confirmados-en-chile-covid-19/'
response = get(url)
from requests import get
from lxml import html, etree
import camelot
import pandas as pd
import numpy as np
url = 'https://www.minsal.cl/nuevo-coronavirus-2019-ncov/casos-confirmados-en-chile-covid-19/'
response = get(url)
from requests import get
from lxml import html, etree
import camelot
import pandas as pd
import numpy as np
url = 'https://www.minsal.cl/nuevo-coronavirus-2019-ncov/casos-confirmados-en-chile-covid-19/'
response = get(url)