Miscellaneous Cheatsheet
1 min readFeb 2, 2018
Cheatsheet for commands/how-tos I frequently needed to google.
Add remote branch
git checkout --track origin/name_of_the_remote_branch
Save git credential to avoid typing user and password repeatedly
git config --global credential.helper 'cache --timeout=36000'
Download file from jupyter notebook
from IPython.display import FileLink
FileLink('something.csv')
Remove an SSH passphrase
ssh-keygen -f ~/.ssh/my-ssh-file -p
and enter only your old passphrase, enter no new passphrase.
Conda Clone from existing env
conda create -n new_env --clone root
xgboost
Conda’s version is old.
cd Downloads
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/minimum.mk ./config.mk; make -j4
cd python-package; sudo python setup.py install
Git setup for contributing to repo
- Fork the repo on github (e.g. https://github.com/dmlc/xgboost)
- Clone your forked repo: git clone https://github.com/yang-zhang/xgboost
- Add original owner’s repository: cd xgboost; git remote add dmlc https://github.com/dmlc/xgboost
- Show remote repo: git remote -v See here for reference.
Python 2 to 3
2to3 -w example.py
Control video speed
Make top
sort by memory usage
top -o MEM
Add link to imported modules on github
Move tabs using keyboard in Chrome
Kaggle
!kg config -g -u $KAGGLE_USER -p $KAGGLE_PW -c $competition_name
!kg download
!kg submit $submit_file -u $KAGGLE_USER -p $KAGGLE_PW -m $model_description
Install R package for in conda
In code
from rpy2.robjects.packages import importr
utils = importr('utils')
utils.install_packages(ro.StrVector(['entropy', 'psych', 'vcd']))
Run a R kernal in Jupyter and run
install.packages(c(‘entropy’, ‘psych’, ‘vcd’))