Skip to content

Instantly share code, notes, and snippets.

cm6051 / attic-backups
Last active September 30, 2016 20:56
Backup script using Attic
set -e
BACKUP_SOURCES="/etc /home /usr/share/nginx ${MYSQL_DIR}"
echo "================="
DASpringate / cond.R
Last active May 19, 2017 15:24
A simple R implementation of `cond` from Lisp. Allows for arbitrary numbers of conditionals without nested if statements
#' R implementation of `cond` from Lisp
#' allows for arbitrary numbers of conditionals without ugly nested if statements
#' conditionals are entered as pairs of expressions (clauses),
#' first the expression to be evaluated and second the return value if the expression is true
#' @param ... an even number of expressions as pairs (see example)
#' @param true the `else` expression (Taken from the Lisp (T resultN) see
#' @return The paired value of the first true conditional expression or the value of true
#' @examples
#' x <- runif(1)
#' cond(x < 0.2, "lower tail",