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?
View pip3-centos-amazon-linux.md
sudo yum install -y python34-setuptools
sudo easy_install-3.4 pip
View comparing_small_and_larger_samples.R
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)
View calculating_sem_formula.R
# Defining lambda and n
lambda <- 220
n <- 30
# Calculating SEM
sem <- sqrt(lambda / n)
View bootstrap_plot_1.R
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)) +
View av_peds_2.R
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
View centred_chart.R
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
View cleaning_data.R
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
View git_newrepo
# 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
View tools.py
import os, glob
#prints all fies ending in .pdf
os.chdir("~")
for file in glob.glob("*.pdf"):
print(file)
@chaityacshah
chaityacshah / pycharm.md
Created May 28, 2018 18:42
Resetting pycharm settings on macOS
View pycharm.md

rm -rf ~/Library/Preferences/<PRODUCT><VERSION>/
rm -rf ~/Library/Caches/<PRODUCT><VERSION>/
rm -rf ~/Library/Application\ Support/PyCharmCE2018.1/
rm -rf ~/Library/Logs/PyCharmCE2018.1/