Skip to content

Instantly share code, notes, and snippets.

joethorley /
Created Oct 24, 2018 — forked from francoisromain/
A bash script to create a Git post-receive hook to deploy after a Git push
# Call this file with `bash ./ project-name [service-name]`
# - project-name is mandatory
# - service-name is optional
# This will creates 4 directories and a git `post-receive` hook.
# The 4 directories are:
# - $GIT: a git repo
# - $TMP: a temporary directory for deployment
joethorley /
Created May 2, 2017 — forked from douglas/
Update all git repositories under a base directory
# store the current dir
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
joethorley / dprint.R
Last active Jan 10, 2017
print when debugging
View dprint.R
dprint <- function(x, note = NULL, do = getOption("", TRUE)) {
if (!do) return(invisible())
if (!is.null(note))
cat("\n**", note, "**\n")
cat("\n", deparse(substitute(x)), ": \n", sep = "")
View normalize.R
normalize <- function(x) {
if (min(x) > 0) {
if (max(x) < 1) {
x <- logit(x)
} else
x <- log(x)
joethorley /
Created Apr 4, 2016 — forked from t-io/
Install most of my Apps with homebrew & cask
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL"
joethorley / brewR
Last active Apr 18, 2016
brewing R
View brewR
First of all made sure that command line developer tools (but not XCode were installed)
brew tap caskroom/cask
brew install Caskroom/cask/xquartz
brew cask install java
brew cask install basictex
joethorley / brewbasictex
Created Apr 1, 2016
Install basictex using brew for R
View brewbasictex
brew tap caskroom/cask
brew cask install basictex
sudo tlmgr update --self
sudo tlmgr update --all
sudo tlmgr install titling framed inconsolata
joethorley / ext.R
Last active Aug 29, 2015
Wrappers to get, remove, replace, add and test file name extensions
View ext.R
#' @title Filename extension utilities
#' @description Replaces, adds or removes (rm) extensions from filenames or test whether
#' filename has an extension or is a filename with a particular extension.
#' Functions are primarily wrappers
#' on the tools package functions \code{file_ext} and \code{file_path_sans_ext}.