Skip to content

Instantly share code, notes, and snippets.

@JohnMount
JohnMount / h2o.R
Last active January 24, 2017 16:59 — forked from edgararuiz-zz/h2o.R
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
pkgs <- c("methods","statmod","stats","graphics","RCurl","jsonlite","tools","utils")
for (pkg in pkgs) {
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
}
@JohnMount
JohnMount / confEc2RServer.bash
Last active September 6, 2021 09:49
Configure an Amazon EC2 instance to serve a tunneled RStudio Server instance (from a Unix client)
#!/bin/bash
# on local
pempath="$1"
ec2target="$2"
ssh -T -i "${pempath}" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${ec2target} << 'EOBLOCK'
# on remote machine
sudo apt-get -y update
sudo apt-get -y upgrade
@JohnMount
JohnMount / base_fns.R
Created March 23, 2018 14:25
Small strengthenings of base R functions to be more pipe compatible.
# Re-expose basic R data manipulation tools in more pipe friendly wrappers.
library("wrapr")
#' Evaluate an expression with a data frame acting as the inner environment.
#'
#' References can be forced to the environment with a .e$ prefix
#' and forced to the data frame with a .d$ prefix (failure to
#' lookup returns null). Only works on in-memory data.frames.