Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Roberto Salas robsalasco

🏠
Working from home
View GitHub Profile
@robsalasco
robsalasco / streamschile
Last active Aug 29, 2015
TV Streams Chile
View streamschile
rtmp://wow2.cl.digitalproserver.com/redtv/redtvvivo/livestream1 pageUrl="http://www.lared.cl/online/" swfUrl="http://media.digitalproserver.com/v2/jw/6.7/jwplayer.flash.swf?v=67"
rtmp://chv.live.ztreaming.com:80/chvapp2/streamchv pageUrl="http://www.chilevision.cl/noticias/site/edic/base/port/senal_online.html" swfUrl="http://www.chilevision.cl/jwplayer/jwplayer.flash.swf"
rtmp://megatandas.ztreaming.com:80/megatandas/stream01megatandas04032013.sdp pageUrl="http://www.mega.cl/senal-en-vivo/" swfUrl="http://www.mega.cl/website/js/flowplayer/3.2.2/swf/player.swf"
rtmp://200.83.3.28:80/CNN-CHILE/CNN-CHILE
rtmp://13.cluster8.live.ztreaming.com:80/13hd/streamgrpz13hd pageUrl="http://envivo.13.cl/13.php" swfUrl="http://envivo.13.cl/forever/swf/flowplayer.commercial-3.2.7.swf" live=1
rtmp://190.96.94.214:80/13c/grpz13c pageUrl="http://envivo.13.cl/" swfUrl="http://envivo.13.cl/streaming.swf"
rtmp://wow2.cl.digitalproserver.com/ucvtv/_definst_/livestream1 pageUrl="http://www.ucvtv.cl/online.php" swfUrl="http://dps.vo
@robsalasco
robsalasco / lun.rb
Last active Aug 29, 2015
Las Ultimas Noticias (lun.com) - swf to pdf converter
View lun.rb
require 'open-uri'
time = Time.now.strftime("%Y-%m-%d")
match = open("http://www.lun.com/pages/LUNHomepage.aspx?BodyID=0&dt=" + time).read.scan(/(http\:\/\/images\.lun\.com\/luncontents\/NewsPaperPages\/.*\.swf)/).flatten
puts "Creando directorio temporal de descarga"
FileUtils.mkdir("/tmp/lun/")
match.each do |entry|
open("/tmp/lun/" + File.basename(entry), "wb") do |file|
View latercera.rb
require 'open-uri'
require 'net/http'
require 'fileutils.rb'
fecha = Time.now.strftime("%Y/%m/%d")
def remote_file_exists?(url)
url = URI.parse(url)
Net::HTTP.start(url.host, url.port) do |http|
return http.head(url.request_uri).code == "200"
View lacuarta.rb
require 'open-uri'
require 'net/http'
require 'fileutils.rb'
fecha = (Time.now - (60*60*24)).strftime("%Y/%m/%d")
def remote_file_exists?(url)
url = URI.parse(url)
Net::HTTP.start(url.host, url.port) do |http|
return http.head(url.request_uri).code == "200"
View elmercurio.rb
require 'open-uri'
require 'fileutils.rb'
cuerpo = {"Cuerpo A" => 1, "Cuerpo B" => 2, "Cuerpo C" => 3, "Cuerpo D" => 4, "Cuerpo E" => 5, "Cuerpo F" => 6}
def cuerpodown(cuerpo)
time = Time.now.strftime("%Y-%m-%d")
match = open("http://impresa.elmercurio.com/pages/LUNHomepage.aspx?BodyID=" + cuerpo + "&dt=" + time + "&dtB=" + time + "&dtB=" + time).read.scan(/(http\:\/\/images\.elmercurio\.com\/MerServerContents\/NewsPaperPages\/.*\.swf)/).flatten
@robsalasco
robsalasco / Transantiago public endpoints.md
Created Jul 12, 2017 — forked from radutzan/Transantiago public endpoints.md
APIs REST públicas con data del Transantiago. Respuestas en JSON.
View Transantiago public endpoints.md

Importante

Transantiago implementó estas APIs para uso interno, por lo que no hay ninguna garantía sobre su funcionalidad, mantenimiento o futura existencia. Úsalas bajo tu propio riesgo. (Probablemente no es aconsejable que las uses para nada crítico.)

Paraderos alrededor de un punto

http://www.transantiago.cl/restservice/rest/getpuntoparada?lat=-33.6089714&lon=-70.5742975&bip=1

Estimación de parada

http://www.transantiago.cl/predictor/prediccion?codsimt=PA420&codser=504 (código de servicio es opcional, pero el parámetro debe estar presente aunque esté vacío)

Lista de servicios

View RStudio_SII_acquire_data.R
library(readr)
library(dplyr)
library(stringr)
library(sp)
library(rgdal)
library(rgeos)
library(spatialEco)
##%######################################################%##
# #
View RStudio_SII_extract_kml.R
library(rvest)
library(stringr)
html <- read_html("http://www.asof.cl/apps/mapaferias/rm.php")
urls <- html %>% html_nodes("option") %>% html_attr("value") %>% na.omit()
maps <- sapply(urls, function(x) {
read_html(paste0("http://www.asof.cl/apps/mapaferias/",x)) %>%
View diplomados_data_science_chile.md
View uf.R
library(httr)
library(jsonlite)
uf <- function(x, year, apikey) {
response <- GET(paste0("http://api.sbif.cl/api-sbifv3/recursos_api/uf/",year,"?apikey=",apikey,"&formato=json"))
data <- fromJSON(txt=content(response))$UFs
data$Valor <- sub("\\.","",data$Valor)
data$Valor <- sub("\\,",".",data$Valor)
data$Valor <- as.numeric(data$Valor)
media <- mean(data$Valor)