Skip to content

Instantly share code, notes, and snippets.

View brunaw's full-sized avatar
💜
working on ML & bayesian stats

Bruna Wundervald brunaw

💜
working on ML & bayesian stats
View GitHub Profile
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@mjadkins
mjadkins / ggplot2_caterpillar.R
Created August 9, 2015 19:13
ggplot2 Caterpillar Plot
# Load libraries
lapply(c("R2MLwiN","arm","ggplot2","RColorBrewer","grid"),library, character.only=TRUE)
# Set working directory and load data
setwd("~/R")
data(tutorial)
str(tutorial)
# Fit a linear varying intercept multilevel model with group level predictors of normexam ~ sex + standlrt + vrband + schgend + avslrt + schav + (1|school)
fit.1 <-lmer(normexam ~ sex + standlrt + vrband + schgend + avslrt + schav + (1|school), data=tutorial)
anonymous
anonymous / pca_animation.m
Created January 26, 2017 21:47
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
library(tidyverse)
# Colliders
x1 <- rnorm(1000)
y <- 1.2 + 1.6 * x1 + rnorm(1000)
z <- 0.6 + 1.3*x1 + 1.5*y + rnorm(1000)