You're probably very familiar with the tools you use daily and operate them from muscle memory. But there are also these setup or maintenance tasks you only do every X months and their practical details are a bit hazy.
This is a random, work-in-progress collection of cheat sheets for these commands or workflows I use too infrequently to remember.
Jupyter/JupyterLab
-
List installed Jupyter/JupyterLab kernels (run from env that has jupyter installed):
jupyter kernelspec list
-
Add a new kernel for a custom virtual/conda env:
- Enter the virtual/env (e.g.
. bin/venv/activate
orconda activate $envname
) - Install ipykernel package: e.g.
pip install ipykernel
- Create kernel spec for jupyter/jupyterlab:
python -m ipykernel install --user --name $kernelname
Optionally add
--display-name "Pretty Name"
to give it a prettier name in the Jupyter(Lab) UI - Check that kernel is now listed atjupyter kernelspec list
(run this from env where you run Jupyter(Lab)) - Enter the virtual/env (e.g.
Conda/Anaconda
- Updating
- update conda (base environment):
conda update conda
- Update all packages in an environment:
conda update --all
- update conda (base environment):
-
Remove unused packages and caches (can save up multiple GB).
conda clean --all
(optionally add
--dry-run
) -
Remove environment
conda env remove -n $ENVNAME
Homebrew
- List installed formulas
- Including dependencies:
brew list
- Only the "leave" formulas:
brew leaves
-
How do I update my local packages?
# First update the formulae and Homebrew itself: brew update # You can now find out what is outdated with: brew outdated # Upgrade everything with: brew upgrade # Or upgrade a specific formula with: brew upgrade <formula>
-
By default, Homebrew does not uninstall old versions of a formula. To clean up the accumulation of old, unused versions:
brew cleanup <formula> # or clean up everything at once (add `-n` for dry run): brew cleanup
-
General checkup
brew doctor
Vim
(yes, I use vim too infrequently to remember these, sue me)
- Change a word (e.g. interactiv git rebase):
:cw
- show line numbers
:set number