This file contains 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 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): |
This file contains 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
#!/bin/sh | |
# 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: http://stackoverflow.com/questions/5894946/how-to-add-gits-branch-name-to-the-commit-message | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
DESCRIPTION=$(git config branch."$NAME".description) | |
echo "[$NAME"'] '$(cat "$1") > "$1" | |
if [ -n "$DESCRIPTION" ] |