Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Pachamaltese pachamaltese

🎯
Focusing
View GitHub Profile
@pachamaltese
pachamaltese / 00-install-intel-mkl-64bit
Last active Jan 14, 2021
Install Intel MKL (64 bit) on Ubuntu 17.10
View 00-install-intel-mkl-64bit
# Option 1: Use apt-get
# keys taken from https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo
cd ~/GitHub/r-with-intel-mkl/
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
sudo apt-get update && sudo apt-get install intel-mkl-64bit
@pachamaltese
pachamaltese / yotov_ch1_application1_1000rows.csv
Created Nov 17, 2020
random sample of Yotov's AGTPA application 1 from chapter 1
View yotov_ch1_application1_1000rows.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 23 columns, instead of 22. in line 3.
exporter,importer,pair_id,year,trade,dist,cntg,lang,clny,log_trade,log_dist,y,log_y,e,log_e,total_e,remoteness_exp,log_remoteness_exp,total_y,remoteness_imp,log_remoteness_imp,exp_year,imp_year
ROM,PRT,2197,2006,29.6067590815127,2926.63232206783,0,0,0,3.388002682611129,7.981607662835646,66298.04836186398,11.101915739268053,106818.18165712024,11.578883431254216,26248052.9686006,661604212.536981,20.31017806884965,26248052.9686006,995955630.3332468,20.7192132666984,ROM2006,PRT2006
NGA,NPL,2014,2006,0,8533.95813886414,0,0,0,-Inf,9.051808558517276,99373.4161630537,11.506639913847772,4881.484603951256,8.493204674702186,26248052.9686006,493911281.07403946,20.017866466055917,26248052.9686006,1525909073.422258,21.145856183120095,NGA2006,NPL2006
FIN,GRC,691,1990,148.285043270111,2544.74481018791,0,0,0,4.999136389506888,7.841785652911137,74506.29053439197,11.21863883750632,39912.5679797954,10.594446540242267,12246859.677430546,944377422.2668016,20.66603645592967,12246859.677430546,967819738.2760613,20.690556407110414,FI
View pokemon.json
[{"id":1,"name":"Bulbasaur","height":0.7,"weight":6.9,"base_experience":64,"type_1":"grass","type_2":"poison","attack":49,"defense":49,"hp":45,"special_attack":65,"special_defense":65,"speed":45,"color_1":"#78C850","color_2":"#A040A0"},{"id":2,"name":"Ivysaur","height":1,"weight":13,"base_experience":142,"type_1":"grass","type_2":"poison","attack":62,"defense":63,"hp":60,"special_attack":80,"special_defense":80,"speed":60,"color_1":"#78C850","color_2":"#A040A0"},{"id":3,"name":"Venusaur","height":2,"weight":100,"base_experience":236,"type_1":"grass","type_2":"poison","attack":82,"defense":83,"hp":80,"special_attack":100,"special_defense":100,"speed":80,"color_1":"#78C850","color_2":"#A040A0"},{"id":4,"name":"Charmander","height":0.6,"weight":8.5,"base_experience":62,"type_1":"fire","attack":52,"defense":43,"hp":39,"special_attack":60,"special_defense":50,"speed":65,"color_1":"#F08030"},{"id":5,"name":"Charmeleon","height":1.1,"weight":19,"base_experience":142,"type_1":"fire","attack":64,"defense":58,"hp":58,"
View simplify_graph.R
library(igraph)
library(ggraph)
mtcars_cor <- (cor(mtcars))^2
mtcars_cor <- (-1) * mtcars_cor
g <- graph_from_adjacency_matrix(mtcars_cor, weighted = TRUE,
mode = "undirected", diag = FALSE)
g_mst <- mst(g, algorithm = "prim")
@pachamaltese
pachamaltese / .block
Last active Aug 22, 2020
OEC's countries list and hs92 codes
View .block
license: mit
@pachamaltese
pachamaltese / r_python_homebrew.sh
Last active Aug 21, 2020
Install R and Python via Homebrew
View r_python_homebrew.sh
# See http://pacha.hk/2017-07-12_r_and_python_via_homebrew.html
# XCode CLT
xcode-select --install
# Update Homebrew and add formulae
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
View padronpdfhtml.sh
#!/bin/bash
set -o nounset
case "${1:-}" in
--)
pdf="$2"
html="${pdf%.pdf}".html
dest="${html}".gz
[ -e "$dest" ] && exit
View ufdolar.R
library(mindicador)
library(readr)
valoruf <- mindicador_importar_datos(
series = "uf",
anios = 2020,
tipo = "data.frame",
max_intentos = 5,
usar_cache = FALSE,
archivo = NULL
View guaguas.R
source("00-leer-datos.R")
library(dplyr)
# ejemplo 1: filtrar, agrupar y contar
guaguas %>%
filter(anio >= 1990 & nombre == "Bryan") %>%
group_by(anio) %>%
count()
View hcmap-europe.R
library(dplyr)
library(highcharter)
mapData <- tibble(
country = c("PT", "IE", "GB", "IS",
"NO", "SE", "DK", "DE", "NL", "BE", "LU", "ES", "FR", "PL", "CZ", "AT",
"CH", "LI", "SK", "HU", "SI", "IT", "SM", "HR", "BA", "YF", "ME", "AL", "MK",
"FI", "EE", "LV", "LT", "BY", "UA", "MD", "RO", "BG", "GR", "TR", "CY",
"RU"),
value = c(rep(1,4), rep(2,25), rep(3,12), 4))