Skip to content

Instantly share code, notes, and snippets.

@Ethanhackett
Last active June 4, 2020 10:44
Show Gist options
  • Save Ethanhackett/e40439ca518f5afe185c to your computer and use it in GitHub Desktop.
Save Ethanhackett/e40439ca518f5afe185c to your computer and use it in GitHub Desktop.
GitFit is a Git Hook that randomly selects an Exercise and Reps with an option to challenge a fellow co-worker.
#!/usr/bin/env python
# NAME: GitFit
# AUTHOR: @EthanHackett www.ethanhackett.com
# PURPOSE: Get engineers to be more active by adding exercises to daily git processes.
# INSTALL: Place this file in local git repo in hooks folder .git/hooks/this-file
# NOTES: For more information on Git visit https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
import ctypes # An included library with Python install.
import random # Includes random function for randomly picking Numbers & Exercises,
# Class colors for wrapping GitFit dialog message in terminal
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
#Define Arrays of Counts and Excecises.
reps = ["5", "10", "15"];
exercises = ["Jumping Jacks", "Barbell Curls", "Crunches", "Pushups"];
participants = ["Michael N", "Andrew", "Kevin", "Jonathan"];
ranReps = random.choice(reps);
ranExercise = random.choice(exercises);
ranParticipant = random.choice(participants);
# Uncomment only one mode below
#Solo
#print bcolors.WARNING + "GitFit: Do " + ranReps + " " + ranExercise + "." + bcolors.ENDC;
#Co-op
print bcolors.WARNING + "GitFit: Challenge " + ranParticipant + " to " + ranReps + " " + ranExercise + "!" + bcolors.ENDC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment