Skip to content

Instantly share code, notes, and snippets.

View spceaza's full-sized avatar

Cristian Sandoval-Pineda spceaza

  • Bogota, Colombia
View GitHub Profile
@spceaza
spceaza / Plumber.R
Last active February 11, 2022 18:30
TokenManager.R
# Plumber.R
GetTokens = function( code_data )
{
callback_url = URLdecode( code_data )
body_ = list()
body_$grant_type = "authorization_code"
body_$refresh_token = ""
body_$access_type = "offline"
body_$code = callback_url
@spceaza
spceaza / Grafico.R
Created November 16, 2020 23:29
Scripts varios
data_table = read.csv2( "ruta/del/archivo/" )
raw_data = unname( unlist( data_table ) )
raw_data = raw_data[which( !is.na( raw_data ) )]
View( data_table )
max_x = max( raw_data )
min_x = min( raw_data )
timedatectl set-timezone America/Bogota
echo "es_CO.UTF-8 UTF-8" > /etc/locale.gen
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "ja_JP.EUC-JP EUC-JP" >> /etc/locale.gen
echo "ja_JP.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
echo "desktop" > /etc/hostname
echo "127.0.0.1 localhost" > /etc/hosts
@spceaza
spceaza / script.R
Created December 18, 2019 12:25
República Checa 1 año Datos Históricos Rendimiento de Bonos
#install.packages( "XML" )
#install.packages( "httr" )
url_data = "https://es.investing.com/instruments/HistoricalDataAjax"
params = list()
params$curr_id = 29248
params$smlID = 205189
params$header = "República+Checa+1+año+Datos+Históricos+Rendimiento+de+Bonos"
24.
x² + 2dx + d² = 0
Se reescribe de otra forma equivalente
(1)x² + (2d)x + (d²) = 0
La ecuación tiene la forma:
(a)x² + (b )x + (c ) = 0.
Donde:
a es 1
b es 2d
c es d²
base_url = "https://etfdb.com/data_set/?tm=40284&cond={%22by_etf%22:1272}&no_null_sort=true&count_by_id=&sort=weight&order=desc&limit=15&offset="
CleanString = function( string )
{
result = gsub( "<a.*stock/", "", string )
gsub( "/.*", "", result )
}
WeightsFromUrl = function( json_url )
{
@spceaza
spceaza / script.sh
Created May 20, 2019 22:33
Este script descarga todos los informes consolidados de contratación de la Universidad Nacional de Colombia desde el 2013 hasta la fecha actual.
wget http://contratacion.unal.edu.co/nal/
grep 'rico20[0-9][0-9]' index.html > ids.txt
sed -i -E -e "s|.href=\"|\nhref=\"|" ids.txt
sed -i -E -e "s|.href=\"|\nhref=\"|" ids.txt
sed -i -E -e "s|.href=\"|\nhref=\"|" ids.txt
sed -i -E -e "s|.href=\"|\nhref=\"|" ids.txt
sed -i -E -e "s|<.*||" ids.txt
sed -i -E -e "s|>.*||" ids.txt
sed -i -E -e "s| target.*||" ids.txt
sed -i '/^ *$/d' ids.txt
@spceaza
spceaza / CREGWebScraping.sh
Last active December 11, 2018 14:05
Descarga de documentos Comisión de Regulación de Energía y Gas
wget http://www.creg.gov.co/index.php/es/prensa/presentaciones
grep "\-presentaciones\-" presentaciones > links.txt
sed -i -E -e "s|.*<div class=\"pd-subcategory\" style=\"margin-left:20px; margin-top:20px;\"><a href=\"|http://www.creg.gov.co|" links.txt
sed -i -E -e "s|\" title=\"Presentaciones .*||" links.txt
cat links.txt | xargs wget
grep "PDF" *-presentaciones-* > links.txt
grep "Descargar" *-presentaciones-* >> links.txt
sed -i -E -e "s|.*href=\"|http://www.creg.gov.co|" links.txt
sed -i -E -e "s|\".*|\"|" links.txt
sed -i -E -e "s|http|\"http|" links.txt
data = matrix(nrow = 20, ncol = 5, byrow = T,
c(8,8,0,9,6,
7,1,1,1,0,
2,1,7,2,0,
6,6,6,6,4,
1,1,1,1,0,
3,2,1,3,0,
7,6,6,2,2,
9,3,1,3,1,
0,0,0,0,4,
@spceaza
spceaza / Fern2D.json
Last active June 20, 2019 14:50
Fractals
{
"transformation": [
[
[ 0, 0 ],
[ 0, 0.16 ]
],
[
[ 0.85, 0.04 ],
[ -0.04, 0.85 ]
],