Skip to content

Instantly share code, notes, and snippets.

Sam Abbott seabbs

View GitHub Profile
@seabbs
seabbs / benchmark-trest
Created Feb 11, 2019
Test of benchmarkme functionality.
View benchmark-trest
## Load latest CRAN version of benchmarkme
library(benchmarkme)
## Run a benchmark for a single core
single_perf <- benchmark_std()
## Run a benchmark on multiple cores (here 4)
mutli_perf <- benchmark_std(cores = 4)
@seabbs
seabbs / tidyverse-gpu-dockerfile
Last active Jan 25, 2019
A GPU enabled Tidyverse Dockerfile
View tidyverse-gpu-dockerfile
FROM rocker/tidyverse:latest
MAINTAINER "Sam Abbott" contact@samabbott.co.uk
## Shell tools
RUN apt-get update && apt-get install -y --force-yes --allow-unauthenticated --no-install-recommends --no-upgrade \
curl \
## R package dependencies
@seabbs
seabbs / gpu-test
Created Jan 25, 2019
Testing GPU set up in R for machine learning
View gpu-test
library(xgboost)
# load data
data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')
train <- agaricus.train
test <- agaricus.test
# fit model
bst <- xgboost(data = train$data, label = train$label, max_depth = 5, eta = 0.001, nrounds = 1000,
nthread = 2, objective = "binary:logistic", tree_method = "gpu_hist")
# predict
@seabbs
seabbs / gpu-test
Created Jan 25, 2019
Testing GPU set up in R for machine learning
View gpu-test
library(xgboost)
# load data
data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')
train <- agaricus.train
test <- agaricus.test
# fit model
bst <- xgboost(data = train$data, label = train$label, max_depth = 5, eta = 0.001, nrounds = 1000,
nthread = 2, objective = "binary:logistic", tree_method = "gpu_hist")
# predict
@seabbs
seabbs / storyboard-gettbinr-2017
Last active Sep 28, 2018
Storyboard for GetTBinR 2017 data
View storyboard-gettbinr-2017
## Get required packages - managed using pacman
if (!require(pacman)) install.packages("pacman"); library(pacman)
p_load("getTBinR")
p_load("ggplot2")
p_load("ggrepel")
p_load("scales")
p_load("viridis")
p_load("dplyr")
p_load("forcats")
p_load("ggridges")
@seabbs
seabbs / playing_with_gams_in_tb
Created Sep 11, 2018
Playing with an example GAM model using TB data
View playing_with_gams_in_tb
if (!require("pacman")) install.packages("pacman")
p_load("getTBinR")
p_load("tidyverse")
p_load("mgcv")
p_load("zoo")
tb <- get_tb_burden()
tb_features <- tb %>%
filter(e_inc_100k >= 200, e_inc_num > 100) %>%
@seabbs
seabbs / nginx-conf
Created Aug 8, 2018
Nginx conf generated by nginx auto proxy
View nginx-conf
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
@seabbs
seabbs / bgf_wrapper.sh
Created Jul 6, 2018
Wrapper function to remove large files using BFG. Requires a version number and repo name
View bgf_wrapper.sh
#!/bin/bash
cd $repo
git reflog expire --expire=now --all && git gc --prune=now --aggressive
cd ..
java -jar bfg-$(version).jar --strip-blobs-bigger-than 100M $repo
@seabbs
seabbs / keybase.md
Created May 17, 2018
Keybase confirmation
View keybase.md

Keybase proof

I hereby claim:

  • I am seabbs on github.
  • I am seabbs (https://keybase.io/seabbs) on keybase.
  • I have a public key ASDWcflm0qRi8bGzqTjCLreVJSfzjC9UKr0UnsWBtQzM4wo

To claim this, I am signing this object:

@seabbs
seabbs / splash.5.4.getTBinR
Last active May 16, 2018
splash image for getTBinR 5.4
View splash.5.4.getTBinR
## Get required packages - managed using pacman
if (!require(pacman)) install.packages("pacman"); library(pacman)
p_load("getTBinR")
p_load("ggplot2")
p_load("viridis")
p_load("dplyr")
p_load("forcats")
p_load("ggridges")
p_load_gh("thomasp85/patchwork")
You can’t perform that action at this time.