Skip to content

Instantly share code, notes, and snippets.

@chaityacshah
chaityacshah / pip3-centos-amazon-linux.md
Created March 11, 2017 15:18 — forked from diegopacheco/pip3-centos-amazon-linux.md
How to Install Pip3 on CentOS / Amazon Linux?
sudo yum install -y python34-setuptools
sudo easy_install-3.4 pip
set.seed(567)
# Sample of 30 (29 from the Poisson distribution and an outlier of 260)
sample1 <- c(rpois(29, lambda = 220), 260)
# Sample of 10 (9 from the Poisson distribution and an outlier of 260)
sample2 <- c(rpois(9, lambda = 220), 260)
# Defining lambda and n
lambda <- 220
n <- 30
# Calculating SEM
sem <- sqrt(lambda / n)
require(ggplot2); require(gridExtra)
# Set the colours for the graphs
barfill <- "#4271AE"
barlines <- "#1F3552"
line1 <- "black"
line2 <- "#FF3721"
# Plotting histogram of sample of daily page views
g1 <- ggplot(data=as.data.frame(sample), aes(sample)) +
av_peds_2 <- ddply(p.subset, c("date", "collapsed_sensors_2"), summarise,
n_peds = sum(Hourly_Counts))
# Extract weekday versus weekend
av_peds_2$day <- weekdays(av_peds_2$date, abbreviate = FALSE)
av_peds_2$weekend <- ifelse((av_peds_2$day == "Saturday" | av_peds_2$day == "Sunday"),
"Weekend", "Weekday")
av_peds_2$weekend <- as.factor(av_peds_2$weekend)
# Extract time of day
@chaityacshah
chaityacshah / centred_chart.R
Created September 27, 2017 14:07 — forked from t-redactyl/centred_chart.R
Code associated with blog post
library(ggplot2); library(gridExtra)
g1 <- ggplot(data=mtcars, aes(x=wt, y=mpg)) +
geom_point(alpha = 0.7, colour = "#0971B2") +
ylab("Miles per gallon") +
ylim(10, 35) +
xlab("Weight (`000 lbs)") +
ggtitle("Untransformed Weight") +
geom_vline(xintercept = 0) +
theme_bw()
@chaityacshah
chaityacshah / cleaning_data.R
Created September 27, 2017 14:07 — forked from t-redactyl/cleaning_data.R
Code associate with blog post
mtcars$am.f <- as.factor(mtcars$am); levels(mtcars$am.f) <- c("Automatic", "Manual")
mtcars$cyl.f <- as.factor(mtcars$cyl); levels(mtcars$cyl.f) <- c("4 cyl", "6 cyl", "8 cyl")
mtcars$vs.f <- as.factor(mtcars$vs); levels(mtcars$vs.f) <- c("V engine", "Straight engine")
mtcars$gear.f <- as.factor(mtcars$gear); levels(mtcars$gear.f) <- c("3 gears", "4 gears", "5 gears")
mtcars$carb.f <- as.factor(mtcars$carb)
@chaityacshah
chaityacshah / git_newrepo
Created September 28, 2017 04:17 — forked from c0ldlimit/git_newrepo
Git: Push a new or existing repo to Github
# Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/c0ldlimit/vimcolors.git
git push -u origin master
# Push an existing repository from the command line
import os, glob
#prints all fies ending in .pdf
os.chdir("~")
for file in glob.glob("*.pdf"):
print(file)

How can I remove a commit on GitHub?

git log  
git reset --hard ef2ef39d3c2842dd027b42fd96d7b3bc1db6e59d  
git push --force

2: git push -f origin HEAD^:master
3: git push origin +7f6d03:master