Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Pachamaltese pachamaltese

🎯
Focusing
Block or report user

Report or block pachamaltese

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gnu_nongnu_homebrew.sh
# See http://pacha.hk/2017-07-15_gnu_nongnu_homebrew.html
# XCode CLT
xcode-select --install
# Update Homebrew and add formulae
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@pachamaltese
pachamaltese / 00-install-intel-mkl-64bit
Last active Oct 31, 2019
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
View ejemplo1-codigo-tradestatistics.R
library(dplyr)
library(tradestatistics)
fji_usa <- ots_create_tidy_data(
years = 2017, reporters = "fji", partners = "usa",
include_shortnames = T
)
fji_usa_2 <- fji_usa %>%
select(product_shortname_english, export_value_usd) %>%
arrange(-export_value_usd) %>%
@pachamaltese
pachamaltese / getHexValue.gs
Created May 18, 2018
extract cells background color
View getHexValue.gs
function getHexValue(range) {
return SpreadsheetApp.getActive().getRange(range).getBackground();
}
@pachamaltese
pachamaltese / treemap.R
Created Aug 26, 2019
echarts4r advanced treemap hacks
View treemap.R
library(dplyr)
library(stringr)
library(echarts4r)
n <- 5
set.seed(123)
colors <- c("#d35400", "#2980b9", "#2ecc71", "#f1c40f", "#2c3e50", "#7f8c8d")
@pachamaltese
pachamaltese / d3po.js
Last active Aug 9, 2019
treemap error d3 4.13
View d3po.js
This file has been truncated, but you can view the full file.
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict'
exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var lookup = []
var revLookup = []
View reproducible_example.R
# packages ----
if (!require("pacman")) install.packages("pacman")
p_load(data.table, tidyr, tidytext, dplyr, ggplot2, viridis, ggstance, igraph, ggraph)
p_load_gh("dgrtwo/widyr")
# tidy ----
rick_and_morty_subs <- as_tibble(fread("rick_and_morty_subs_s01.csv")) %>%
mutate(text = iconv(text, to = "ASCII")) %>%
@pachamaltese
pachamaltese / r_ubuntu_17_10.sh
Last active Jun 25, 2019
Install R on Ubuntu 17.10
View r_ubuntu_17_10.sh
# Install R
sudo apt-get update
sudo apt-get install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/rstudio-xenial-1.1.383-amd64.deb
sudo gdebi rstudio-xenial-1.1.383-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
@pachamaltese
pachamaltese / r_python_homebrew.sh
Last active May 16, 2019
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
@pachamaltese
pachamaltese / 02-install-r-cran-openblas
Last active May 7, 2019
02-install-r-cran-openblas
View 02-install-r-cran-openblas
# 1: Add RStudio to apt sources
# key added after sudo apt-get update returned a warning following this guide: https://support.rstudio.com/hc/en-us/articles/218004217-Building-R-from-source
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
printf '#CRAN mirror\ndeb https://cran.rstudio.com/bin/linux/ubuntu artful/\ndeb-src https://cran.rstudio.com/bin/linux/ubuntu artful/\n' | sudo tee -a /etc/apt/sources.list.d/cran-mirror.list
# 2: Enable development repositories
# you need to enable multiverse repo or packages as xvfb won't be found
printf 'deb http://us.archive.ubuntu.com/ubuntu artful main restricted universe multiverse
You can’t perform that action at this time.