Skip to content

Instantly share code, notes, and snippets.


Zohar Jackson Jakobovski

View GitHub Profile
Jakobovski /
Created Apr 26, 2019
A simple timer for python code blocks
import time
class timer(object):
A simple timer used to time blocks of code. Usage as follows:
with timer("optional_name"):
some code ...
some more code
def __init__(self, name=None):
Jakobovski / prepare-commit-msg
Created Dec 7, 2015
Script to automatically add the branch name and description to commit messages.
View prepare-commit-msg
# Automatically adds branch name and branch description to every commit message.
# Rename .git/hooks/prepare-commit-msg.sample to prepare-commit-msg, paste the script and make the file executable.
# Modified from:
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
echo "[$NAME"'] '$(cat "$1") > "$1"
if [ -n "$DESCRIPTION" ]