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
@pachamaltese
pachamaltese / getHexValue.gs
Created May 18, 2018
extract cells background color
View getHexValue.gs
function getHexValue(range) {
return SpreadsheetApp.getActive().getRange(range).getBackground();
}
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 Aug 30, 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
@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
@pachamaltese
pachamaltese / titanic.csv
Created Apr 26, 2019
datos pasajeros del titanic
View titanic.csv
pclass survived name sex age sibsp parch ticket fare cabin embarked boat body home.dest
1 1 Allen, Miss. Elisabeth Walton female 29 0 0 24160 211.3375 B5 S 2 St Louis, MO
1 1 Allison, Master. Hudson Trevor male 0.9167 1 2 113781 151.5500 C22 C26 S 11 Montreal, PQ / Chesterville, ON
1 0 Allison, Miss. Helen Loraine female 2 1 2 113781 151.5500 C22 C26 S Montreal, PQ / Chesterville, ON
1 0 Allison, Mr. Hudson Joshua Creighton male 30 1 2 113781 151.5500 C22 C26 S 135 Montreal, PQ / Chesterville, ON
1 0 Allison, Mrs. Hudson J C (Bessie Waldo Daniels) female 25 1 2 113781 151.5500 C22 C26 S Montreal, PQ / Chesterville, ON
1 1 Anderson, Mr. Harry male 48 0 0 19952 26.5500 E12 S 3 New York, NY
1 1 Andrews, Miss. Kornelia Theodosia female 63 1 0 13502 77.9583 D7 S 10 Hudson, NY
1 0 Andrews, Mr. Thomas Jr male 39 0 0 112050 0.0000 A36 S Belfast, NI
1 1 Appleton, Mrs. Edward Dale (Charlotte Lamson) female 53 2 0 11769 51.4792 C101 S D Bayside, Queens, NY
You can’t perform that action at this time.