Skip to content

Instantly share code, notes, and snippets.

Avatar
💼

Sam Abbott seabbs

💼
View GitHub Profile
View update-estimate-git.sh
#!bin/bash
cd /home/azureuser/covid-rt-estimates
git add --all
git commit -m "update estimates"
git push
View update-site.sh
#!bin/bash
cd /home/azureuser/
git clone git@github.com:epiforecasts/covid-rt-estimates.git
cd covid-rt-estimates
sudo bash bin/update-docker.sh "build"
sudo bash bin/update-via-docker.sh
FILE=last-update/update-complete
while [ ! -f "$FILE" ]; do
@seabbs
seabbs / change_with_rw_padding
Last active Aug 21, 2020
Evaluates Rt over two fixed time points with Rt assumed to vary based on a random walk in-between the two time points and after a period of time.
View change_with_rw_padding
library(EpiNow2)
library(data.table)
# Get example case counts
reported_cases <- EpiNow2::example_confirmed[1:60]
# Add a dummy breakpoint (used only when optionally estimating breakpoints)
reported_cases <- reported_cases[, breakpoint := data.table::fifelse((date >= as.Date("2020-03-16") & date <= as.Date("2020-03-29")) | date >= as.Date("2020-04-11"),
1, 0)]
# Set up example generation time
@seabbs
seabbs / set-up-epinow2.sh
Last active Aug 14, 2020
Set up an instance of EpiNow2 on a clean server with an interactive Rstudio server at localhost:8787 (username/login: epinow2)
View set-up-epinow2.sh
#!bin/bash
sudo apt-get update
sudo apt-get install -y docker.io
sudo docker login docker.pkg.github.com
sudo docker pull docker.pkg.github.com/epiforecasts/epinow2/epinow2:latest
sudo docker tag docker.pkg.github.com/epiforecasts/epinow2/epinow2:latest epinow2
@seabbs
seabbs / update-rt-estimates.sh
Last active Aug 17, 2020
Update Rt estimates on a remote server over SSH. Run with: sudo bash update-rt-estimates.sh server-public-ip
View update-rt-estimates.sh
#!/bin/bash
# Get rid of the older update script
rm update-via-ssh.sh
# Get the new update script
curl --fail https://raw.githubusercontent.com/epiforecasts/covid-rt-estimates/master/bin/update-via-ssh.sh > update-via-ssh.sh
# Run the update script
bash update-via-ssh.sh ~/.ssh/id_rsa azureuser@$1 github-username-here github-pat-here
@seabbs
seabbs / deploy_pages.sh
Created Jul 2, 2020
Deploy GitHub pages from the docs folder to gh-pages
View deploy_pages.sh
git subtree split --squash --prefix docs -b gh-pages
git push -f origin gh-pages:gh-pages
git branch -D gh-pages
@seabbs
seabbs / simulate-cases
Created May 29, 2020
Simulates cases by date of report from input Rt and initial case seed
View simulate-cases
library(EpiNow)
library(EpiSoon)
library(data.table)
#1. Input a vector of Rt estimates, and vector to initialise cases, and a generation time
initial_cases <- 100
initial_date <- as.Date("2020-03-01")
rts <- c(rep(2, 20), (2 - 1:15 * 0.1), rep(0.5, 10))
## Simulating cases
@seabbs
seabbs / memory-leak
Created May 11, 2020
Test memory leak
View memory-leak
# Packages -----------------------------------------------------------------
require(data.table, quietly = TRUE)
require(future, quietly = TRUE)
## Require for data and nowcasting
# require(EpiNow, quietly = TRUE)
# require(NCoVUtils, quietly = TRUE)
## Required for forecasting
# require(future.apply, quietly = TRUE)
@seabbs
seabbs / clean_git.sh
Last active Apr 7, 2020
Clean .rds and .png from git histories using BFG
View clean_git.sh
#!bin/bash
## This requires java and bfg to be installed
## bfg: https://rtyley.github.io/bfg-repo-cleaner/
## Assumes that the repo is in the current directory
## Remove all .rds and .png from the Git history
java -jar bfg.jar --delete-files "*.rds" $1
java -jar bfg.jar --delete-files "*.png" $1
@seabbs
seabbs / rco_on_getTBinR.sh
Created Dec 16, 2019
Testing {rco} on {getTBinR}
View rco_on_getTBinR.sh
sudo docker pull jcrodriguez1989/rco
mkdir rco_results
sudo docker run -v /rco_results:/rco_results -e RCO_PKG=getTBinR jcrodriguez1989/rco
cd rco_results
You can’t perform that action at this time.