Python packages are installed in /Library/Python/2.7/site-packages by default.
To find the path programmatically,
from distutils.sysconfig import get_python_lib
print(get_python_lib())
Output:
/opt/anaconda/anaconda/lib/python3.5/site-packages
| import numpy as np | |
| import pandas as pd | |
| from sklearn import datasets, linear_model | |
| def metrics(m,X,y): | |
| yhat = m.predict(X) | |
| print(yhat) | |
| SS_Residual = sum((y-yhat)**2) | |
| SS_Total = sum((y-np.mean(y))**2) | |
| r_squared = 1 - (float(SS_Residual))/SS_Total |
| #!/usr/bin/python | |
| # | |
| # This script fetches the current open tabs in all Safari windows. | |
| # Useful to run remotely on your mac when you are at work and want | |
| # to read a page you have open (remotely) at home but don't remember | |
| # the url but can log in to your home system on the cmmand line | |
| # | |
| import sys | |
| from pprint import pprint |
Python packages are installed in /Library/Python/2.7/site-packages by default.
To find the path programmatically,
from distutils.sysconfig import get_python_lib
print(get_python_lib())
Output:
/opt/anaconda/anaconda/lib/python3.5/site-packages
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/
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
| import os, glob | |
| #prints all fies ending in .pdf | |
| os.chdir("~") | |
| for file in glob.glob("*.pdf"): | |
| print(file) |
| # 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 |
| 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) |
| 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() |
| 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 |