programming & computer tips
- skip paywalls with archive.today (works for Financial Times, Washington Post, The Economist, Wall Street Journal, Medium, The Times, The Atlantic, Fortune, Bloomberg)
- free access to academic papers: Sci-Hub
- free access to books: Library Genesis
- a simple website to compare AWS instance prices
- download videos from YouTube: SaveFrom
- to copy text from (or translate) a password-protected
.pdf
file, send it from your GMail account or upload it to Google Drive
new Mac setup
- block ads immediately after getting a new computer: uBlock Origin (for Chrome, Firefox), AdGuard (for Safari)
- essential Mac software: VLC (open-source universal media player), Transmission (open-source Torrent client), The Unarchiver (decompress any file)
Python setup
use mambaforge
instead of conda
for Python development (it's way faster)
curl --ssl-reqd -sLo mambaforge.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash mambaforge.sh -b -p "$(pwd)/lib/mambaforge" && rm mambaforge.sh
lib/mambaforge/bin/mamba init $(basename $SHELL) && lib/mambaforge/bin/conda config --set auto_activate_base false && exec $SHELL --login
create a new env called dev
NOTE: don’t install packages into the base
environment because it cannot be deleted if you mess up
mamba create -n dev && mamba activate dev
mamba install --yes -c pytorch -c nvidia -c conda-forge -c defaults \
pandas numpyro jupyterlab tqdm matplotlib numba pyarrow \
ipywidgets boto3 lxml beautifulsoup4 flask scikit-learn scipy \
sympy dash psycopg2 sqlalchemy bokeh seaborn statsmodels altair \
xarray arviz corner einops requests pytorch torchvision \
torchaudio torchtext torchdata spacy ipympl \
pytorch-cuda=12.1 # optional, only of you want CUDA / GPU support in PyTorch
jupyter labextension disable '@jupyterlab/apputils-extension:announcements' # disable spam
Python debugging
import code; code.interact(local=locals())
Thanks Andrej Karpathy!
Linux cheatsheet
-
to make
git tree
draw a condensed tree of commits, add this to your~/.gitconfig
under the[alias]
section:tree = log --graph --all --format=format:'%C(bold blue)%h%C(reset)%C(dim white) %ar%C(auto)%d %s%C(dim white) %an%C(reset)'
-
copy folders with
rsync -aP --info=progress2 <src> <dst>
- supports local and remote pathsuser@host:path
(everything that is accessible viassh
) and handles folders in a smart way -
generate new
ssh
key, save it to~/.ssh/id_ed25519_server
(private key) and~/.ssh/id_ed25519_server.pub
(public key)$ ssh-keygen -t ed25519 -C "<COMMENT>"
add the public key (
cat ~/.ssh/id_ed25519_server.pub
) to.ssh/authorized_keys
on the server, then edit~/.ssh/config
:Host $SERVER HostName $SERVER_IP User $USERNAME IdentityFile ~/.ssh/id_ed25519_server IdentitiesOnly yes
generally each server / service (e.g. GitHub) should have its own private key