Some things that improved my productivity — writing them down here so that others can benefit as well!

Automatically switch Conda environments

Use direnv to automatically switch between Conda environments for different projects.

If you have repo SecretProject with corresponding Conda environment called topsecret, create an .envrc file in the root of your SecretProject repo containing:

source activate topsecret
export PYTHONPATH=`pwd`

Now whenever you cd to SecretProject root or any subdirectory, direnv will automatically switch to your topsecret Conda environment and make sure that your imports work. This also works well with multiple windows/panes in tmux.

Squash useless Git commits

To squash previous N commits into one:

git reset --soft HEAD~N

And then proceed as usual.

Viewing images on a server

Credit: via Russell Stewart

Run this from the directory with images:

python -m http.server 8080      # python3

python -m SimpleHTTPServer 8080 # python2

On your computer: View at localhost:8080 in your browser

On remote server: View at

If the server doesn’t expose ports, set up an ssh tunnel before viewing:

ssh -NfL localhost:8080:localhost:8080