Skip to content

Instantly share code, notes, and snippets.

View seabbs's full-sized avatar
🏠
Working from home

Sam Abbott seabbs

🏠
Working from home
View GitHub Profile
@seabbs
seabbs / gpu-test
Created January 25, 2019 11:55
Testing GPU set up in R for machine learning
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 January 25, 2019 11:55
Testing GPU set up in R for machine learning
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 May 23, 2019 15:40
Storyboard for GetTBinR 2017 data
## 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("tidyr")
p_load("forcats")
@seabbs
seabbs / playing_with_gams_in_tb
Created September 11, 2018 09:37
Playing with an example GAM model using TB data
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 August 8, 2018 21:26
Nginx conf generated by nginx auto proxy
# 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 July 6, 2018 16:29
Wrapper function to remove large files using BFG. Requires a version number and repo name
#!/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 08:43
Keybase confirmation

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 11:16
splash image for getTBinR 5.4
## 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")
@seabbs
seabbs / wrapper-dockerfile
Created April 24, 2018 17:35
wrapper docker file to overwrite server
FROM seabbs/showmeperseus:latest
MAINTAINER "Sam Abbott" contact@samabbott.co.uk
WORKDIR /home/rstudio/ShowMePerseus
EXPOSE 3838
CMD R -e 'shiny::runApp(port = 3838)'
@seabbs
seabbs / thresher-demo
Created April 12, 2018 08:59
Sample code for thresher
#' Load the package
library(Thresher)
#' Generate random data
set.seed(3928270)
ranData <- matrix(rnorm(100*12), ncol=12)
colnames(ranData) <- paste("G", 1:12, sep='')
#' Perform dim reduction