git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
As configured in my dotfiles.
start new:
tmux
start new with session name:
import matplotlib.pyplot as plt | |
import numpy as np | |
import inspect | |
def hist_errorbars( data, xerrs=True, *args, **kwargs) : | |
"""Plot a histogram with error bars. Accepts any kwarg accepted by either numpy.histogram or pyplot.errorbar""" | |
# pop off normed kwarg, since we want to handle it specially | |
norm = False | |
if 'normed' in kwargs.keys() : | |
norm = kwargs.pop('normed') |
# New repository | |
mkdir <repo> && cd <repo> | |
git init | |
git remote add –f <name> <url> | |
git config core.sparsecheckout true | |
echo some/dir/ >> .git/info/sparse-checkout | |
echo another/sub/tree >> .git/info/sparse-checkout | |
git pull <remote> <branch> | |
# Existing repository |
Press minus + shift + s
and return
to chop/fold long lines!
import scipy.stats | |
def clopper_pearson(k,n,alpha=0.32): | |
""" | |
http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval | |
alpha confidence intervals for a binomial distribution of k expected successes on n trials | |
Clopper Pearson intervals are a conservative estimate. | |
""" | |
lo = scipy.stats.beta.ppf(alpha/2, k, n-k+1) | |
hi = scipy.stats.beta.ppf(1 - alpha/2, k+1, n-k) | |
return lo, hi |
# check.packages function: install and load multiple R packages. | |
# Check to see if packages are installed. Install them if they are not, then load them into the R session. | |
check.packages <- function(pkg){ | |
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] | |
if (length(new.pkg)) | |
install.packages(new.pkg, dependencies = TRUE) | |
sapply(pkg, require, character.only = TRUE) | |
} | |
# Usage example |
git clean -xfd | |
git submodule foreach --recursive git clean -xfd | |
git reset --hard | |
git submodule foreach --recursive git reset --hard | |
git submodule update --init --recursive |
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |