Skip to content

Instantly share code, notes, and snippets.

View bradurani's full-sized avatar

Brad Urani bradurani

View GitHub Profile
@bradurani
bradurani / install-oracle-java-7-debian.sh
Created September 26, 2013 15:51
Install Oracle Java7 on Debian
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit
@bradurani
bradurani / archive-branch.sh
Last active December 24, 2015 00:29
Archive local branch in Git
git tag archive/<branchname> <branchname>
git branch -d <branchname>
#checkout archived branch
git checkout -b <branchname> archive/<branchname>
@bradurani
bradurani / create-ssh-key.sh
Created September 27, 2013 01:07
Create SSH key
ssh-keygen -t rsa -C "your_email@example.com"
@bradurani
bradurani / git-commit-dry-run.sh
Created October 2, 2013 18:04
Git commit dry run
git merge --no-commit --no-ff $BRANCH
@bradurani
bradurani / git-diff-single-file
Created October 2, 2013 18:28
Git diff single file
git diff <branch>:<dir>/<filename> <branch>:<div>/<filename>
@bradurani
bradurani / git-cache-pw-12-hours.sh
Created October 3, 2013 01:24
Set Git to cache password for 12 hours
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=43200'
@bradurani
bradurani / zscore-formula.txt
Last active December 24, 2015 13:19
Z score formula
Z = (X - M) /SD
X = raw score
M = Mean
SD = Std. Deviation
Z-Score is 0 for mean
# of std deviations above or below mean
@bradurani
bradurani / variance-formula.txt
Created October 3, 2013 04:31
Variance Formula
Variance = SD^2
SD^2 = [SUM((X-M)^2)]/N
Square the deviation so it doesn't sum to zero
SQRT(SD^2) = SD
SS = SUM of Squares = SUM((X-M)^2
MS = Mean Squares = [SUM((X-M)^2)]/N
@bradurani
bradurani / RFileCommands.R
Last active December 24, 2015 13:29
R file commands
save.image() # save to .RData
load(".RData")
save.image(file="workspace21.RData") #save data to binary
load("workspace21.RData");
save.image()
savehistory() #save to .RHistory in current directory
savehistory(file="workspace.RHistory"); #save history to file
@bradurani
bradurani / RSummaryStatistics.R
Created October 3, 2013 05:40
RSummaryStatistics
#given timeframe
mean(timeframe$colname)
sd(timeframe$colname)
describe(timeframe) #table of common summary stats
#filtering
describeBy(impact, impact$condition) #split into separate table based on condition
control <- subset(impact, impact[, 2]=="control") #new timeframe filtered by col 2 == "control"
concussed <- subset(impact, impact[, 2]=="concussed") #new timeframe filtered by col 2 == "concussed"