Cheatsheet

Git

Command

Description

git init

Initialize git in the working directory

git add .

Add all modified files to the staging area

git clone <GIT_REPO> <DIR>

Clone the master branch from a GitHub repository

git clone -b <BRANCH_NAME> <GIT_REPO> <DIR>

Clone a specified branch from a GitHub repository

git checkout .

Discard all changes in your working copy

git status

Check files that are changed, and need to be committed

git remote set-url origin <URL_NAME>

Add a remote directory to origin so you can push your local repository to it

git remote -v

List all remote repositories

git push origin master

Push your local repository to the origin url into the master branch

git diff

Show changes between your working copy and the tree

git pull

Fetch and merge changes from remote repository to your working repository

git submodule add <GIT_REPO> <DIR>

Add submodule GitHub repositories to one of the subfolders of your working repository

git submodule recursive

Recursively update all submodules in your working repository

git config --global credential.helper cache

Git to start caching credentials

git config --global credential.helper 'cache --timeout=7200'

Git to cache credentials for 2 hours

Jupyter Labextension

Command

Description

jupyter labextension list

List all labextensions

jupyter labextension upgrade

Update all labextensions

jupyter labextension install <EXTENSION_NAME>

Install an extension and build

jupyter labextension uninstall <EXTENSION_NAME>

Uninstall an extension and build

jupyter labextension install <EXTENSION_NAME> --no-build

Install an extension but do not build

jupyter lab build

Build jupyter

Conda

Command

Description

source activate <ENV_NAME>

Activate an environment (Linux)

conda activate <ENV_NAME>

Activate an environment (Windows)

conda list

Show all packages in current environment

conda install <PKG1> <PKG2> <PKG3>

Install latest versions of Python packages <PKG1> <PKG2> <PKG3>

conda install <PKG1>=<VER>

Install version <VER> of Python package <PKG1>

conda list --explicit > 'my_env_packages.txt'

Write all packages in current environment into the txt file

conda create --name <ENV_NAME> --file 'my_eng_packages.txt'

Create a new environment and install all files in the txt file

conda env export > 'my_eng_packages.yml'

Export current environment and package informaion into a yml file

conda create -f 'my_env_packages.yml'

Create a new environment based on a yml file

conda config --get

Get summary of conda channel configuration

conda config --prepend channels <CHANNEL_NAME>

Add channel with highest priority

conda config --append channels <CHANNEL_NAME>

Add channel with lowest priority

conda config --set channel_priority false

Install the newest version of a package in any listed channel

conda remove -n <ENV_NAME> --all

Remove environment

Nikola

Command

Description

nikola build

Build nikola website

nikola serve -b

Display localhost:8000 version of website

nikola auto

Automatically scan changes to your edits of the website to build and serve on localhost:8000

nikola github_deploy

Publish website on GitHub Pages. Commits and pushed both the src and master branches of the GitHub Page.

nikola plugin -i <PLUGIN_NAME>

Install nikola plugins

nikola plugin -r <PLUGIN_NAME>

Uninstall nikola plugins

nikola subtheme <THEME_NAME>

Select a subtheme from bootswatch (i.e., lumen)

Markdown

Command

Description

[File Title](file.md)

Links to file.md in current directory

[File Title](subfolder/file.md)

Links to file.md in subfolder of current directory

[File Title](../folder/file.md)

Links to file.md from your repository folder (i.e., blog2)

![File Title](pic.jpg)

Shows picture of pic.jpg stored in current directory

<!-- TEASER_END -->

Teaser end for non .md and .html files

Kaggle API

Command

Description

kaggle competitions list

List all competitions

kaggle competitions list --category <CATEGORY>

List featured competitions

kaggle competitions download <COMPETITION>

Download all files associated to competition

reStructuredText

Command

Description

.. title:

Title of page

.. slug:

Slug of the page used as the last component of the page URL

.. date:

Date of the page

.. category:

Category of the page (only one)

.. tags:

Comma-separated list of page tags (multiple tags)

.. description:

Description of page used for SEO

.. author:

Author of page

.. has_math:

Activate MathJax/KaTeX (true/false)

.. status:

Used to indicate status of the page (published/private/draft/featured)

.. hidetitle:

Show/hide title (true/false)

.. hyphenate:

Activate hyphenation (true/false)

.. TEASER_END

Teaser end used for blog post previews

.. previewimage

Image preview that is used when sharing on social feeds

.. template

Template to render the package

.. updated

Date that post was updated

.. class:: alert alert-primary float-md-right

ReST directive to create a floating alert box to the right

.. contents::

ReST directive to create contents page

.. code:: python

ReST directive for a code-block in Python (shell for Linux, html for html, rst for reStructured, md for Markdown). Code-block must be indented.

:number-lines:

Include line numbers for code-blocks. Command must be indented

reStructuredText Directives

Directives

tmux

Command

Description

Ctrl + b w

List windows

Ctrl + b c

Create window

Ctrl + b &

Delete window

Ctrl + b p

Previous window

Ctrl + b n

Next window

Ctrl + b %

Split pane vertically

Ctrl + b "

Split pane horizontally

Ctrl + b <ARROW KEY>

Move to the pane in the direction of the <ARROW KEY>

Ctrl + b + <ARROW KEY>

Resize of pane according to the <ARROW KEY>