Skip to content

Instantly share code, notes, and snippets.

@s7anley
s7anley / test_setup_and_teardown.py
Last active March 28, 2017 03:19
Reusable setup and teardown for pytest
import pytest
def populate_tables(tables):
pass
def truncate_tables(tables):
pass
@s7anley
s7anley / commit-file.sh
Last active May 18, 2017 15:13
Amend of history commit for forgotten file.
#!/usr/bin/env bash
$(git diff-index --quiet HEAD $1) > /dev/null
FILE_CHANGED=$?
if [ $FILE_CHANGED -eq 1 ];then
COMMIT=$(git log -n 1 --pretty=format:%H -- $1)
git add $1
git commit --fixup=$COMMIT
git rebase --interactive --autosquash $COMMIT^
fi