Skip to content

Instantly share code, notes, and snippets.

@joethorley
joethorley / project-create.sh
Created Oct 24, 2018 — forked from francoisromain/project-create.sh
A bash script to create a Git post-receive hook to deploy after a Git push
View project-create.sh
#!/bin/bash
# Call this file with `bash ./project-create.sh 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
joethorley / update_git_repos.sh
Created May 2, 2017 — forked from douglas/update_git_repos.sh
Update all git repositories under a base directory
View update_git_repos.sh
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# 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
joethorley / dprint.R
Last active Jan 10, 2017
print when debugging
View dprint.R
dprint <- function(x, note = NULL, do = getOption("dprint.do", TRUE)) {
if (!do) return(invisible())
if (!is.null(note))
cat("\n**", note, "**\n")
cat("\n", deparse(substitute(x)), ": \n", sep = "")
print(x)
}
View normalize.R
normalize <- function(x) {
if (min(x) > 0) {
if (max(x) < 1) {
x <- logit(x)
} else
x <- log(x)
}
x
}
@joethorley
joethorley / osx_install.sh
Created Apr 4, 2016 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
View osx_install.sh
#!/bin/sh
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 https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@joethorley
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)
<http://railsapps.github.io/xcode-command-line-tools.html>
```
brew tap caskroom/cask
brew install Caskroom/cask/xquartz
brew cask install java
brew cask install basictex
@joethorley
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
joethorley / ext.R
Last active Aug 29, 2015
Wrappers to get, remove, replace, add and test file name extensions
View ext.R
library(tools)
library(assertthat)
#' @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}.
#'