Skip to content

Instantly share code, notes, and snippets.

View JolleJolles's full-sized avatar

JolleJolles JolleJolles

View GitHub Profile
# List all currently running processes:
ps -a
# Look for one that says "python" or "python3" in the output, like this:
PID TTY TIME CMD
1218 tty1 00:00:00 bash
1169 pts/0 00:00:00 python
8960 pts/1 00:00:00 ps
# Use the command "kill -KILL [PID#]" to stop the python process. For this example, the command was
# Create virtual environment
mkvirtualenv -p python3 PROJECTNAME
# From inside the environment install ipykernel
pip install ipykernel
# Install a new kernel
ipython kernel install --user --name=PROJECTNAME
# Start Jupyter lab
@JolleJolles
JolleJolles / remove-read-only.md
Last active November 18, 2019 14:20
raspberry pi stuck in read only

If your raspberry pi is somehow stuck in read-only mode after restart, it can often be released with the following commands:

sudo su
mount -o remount, rw /
exit
sudo apt-get update -y && sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y && wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz && tar xf Python-3.7.0.tar.xz && cd Python-3.7.0 && ./configure && make -j 4 && sudo make altinstall && cd .. && sudo rm -r Python-3.7.0 && rm Python-3.7.0.tar.xz && sudo apt-get --purge remove build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y && sudo apt-get autoremove -y && sudo apt-get clean
@JolleJolles
JolleJolles / python-2-3-compatibility.md
Created November 8, 2018 09:08
Short list of key changes to make python 2.7 code compatible for python 2.7 and 3.x

## Making python 2 and 3 compatible:

Import above everything

from future import print_function

All print statements have to have brackets, like

print("sint")

Exceptions need to be in brackets as well

raise ValueError("dodgy value")

@JolleJolles
JolleJolles / python-opencv-install.sh
Last active November 8, 2018 08:28 — forked from rizky/install-opencv.sh
Install OpenCV 4 with Python 3 and 2.7 on Mac
### Forked from Rizkyario, implemented improvements based on
### Pyimagesearch https://bit.ly/2PJsK1Y, and adapted to:
### - install OpenCV 4.0
### - install with both 2.7 and 3.x versions of python
### - work with virtual environments
# 1. Install Xcode
# Before we can even think about compiling OpenCV, we first need to install Xcode,
# which can be downloaded in the app store