Skip to content

Instantly share code, notes, and snippets.

View maxi-w's full-sized avatar

Maxi maxi-w

  • Berlin
View GitHub Profile
@maxi-w
maxi-w / versioned-venv.sh
Last active January 18, 2023 20:01
Create a python venv with a specific python version on Ubuntu
# Add deadsnake package archive
# https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
sudo add-apt-repository ppa:deadsnakes/ppa
# Install specific python version e.g. 3.9
sudo apt install python3.9 python3.9-dev python3.9-venv
# Create a venv with a specific python version e.g. 3.9
python3.9 -m venv venv
@maxi-w
maxi-w / python-debugger.sh
Created January 5, 2023 18:19
Launching a python script with a debugger
# pip install debugpy
python -m debugpy --listen 5678 --wait-for-client my_python_script.py
# VS Code -> Run and Debug -> Remote -> localhost:5678
@maxi-w
maxi-w / jupyter-local-venv.sh
Last active February 2, 2023 16:02
Add your projects venv as ipykernel for use inside juptyer notebooks.
# Activate your venv
source venv/bin/activate
# Install ipykernel inside your venv
pip install ipykernel
# Add the kernel from within your venv
ipython kernel install --user --name=name-of-my-kernel
# You can now select the kernel from your notebook editor.
@maxi-w
maxi-w / continous-nvidia-stats.sh
Last active February 3, 2023 17:21
Show nvidia-smi stats with continuous ouput for better overview.
# nvidia-smi stats with continuously updated output
watch -d -n 0.1 nvidia-smi
@maxi-w
maxi-w / appimage-desktop.sh
Created March 3, 2023 09:41
Steps required to add an .AppImage to the menu on Ubuntu.
# make the .AppImage file executable
chmod +x obsidian.AppImage
# create a .desktop file (https://wiki.ubuntuusers.de/.desktop-Dateien/)
cd ./local/share/applications
nano obsidian.desktop
# add the following content to the file
# [Desktop Entry]
@maxi-w
maxi-w / screen-session.sh
Last active March 5, 2023 16:30
Use screen to start a process on a remote machine via ssh and detach from it.
# list all active screen sessions
screen -ls
# start a screen session a) without and b) with a name
screen
screen -S <session_name>
# now start whatever is supposed to run in the screen session
# detach from the screen session