Skip to content

Instantly share code, notes, and snippets.

@umr55766
umr55766 / .git ~ hooks ~ pre-commit
Last active December 14, 2021 03:54
A pre-commit hook to blacked the python code before verfying it with flake8 , this hook only blacken and verify those files which have extension "py" i.e. [*.py] and have been added to stage for committing. Unstaged files and other files are not considered. This hook also abort commit if flake8 throws any message.
#!/bin/sh
# blacken the staged files
for file in $(git diff --cached --name-only | grep -E '\.(py)$')
do
black "$file"
$(git add "$file")
done
for file in $(git diff --cached --name-only | grep -E '\.(py)$')
@Geoyi
Geoyi / install virtualenv ubuntu 16.04.md
Created September 16, 2017 12:19 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv