This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include this in your .bashrc: | |
function activate_virtualenv () { | |
[[ -n $VIRTUAL_ENV ]] && deactivate; | |
venv=`python3 ~/.find_venv.py .`; | |
[[ ! -z "$venv" ]] && . $venv/bin/activate; | |
return 0 | |
} | |
function cd () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from itertools import zip_longest | |
from pprint import pprint | |
def grouper(iterable, n, fillvalue=None): | |
"""Collect data into fixed-length chunks or blocks""" | |
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx" | |
args = [iter(iterable)] * n | |
return zip_longest(*args, fillvalue=fillvalue) |