Skip to content

Instantly share code, notes, and snippets.

View fniessink's full-sized avatar
🏠
Working from home

Frank Niessink fniessink

🏠
Working from home
View GitHub Profile
@fniessink
fniessink / .bashrc
Last active December 17, 2024 08:45
Automatically activate and deactivate Python virtual envs on change directory
# 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 () {
@fniessink
fniessink / speeddate.py
Created December 19, 2020 18:50
Create speed date schedules with multiple rounds and tables
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)