Replace shebang by /usr/bin/env
Added gitignore
Add str.encode() for Python 3 compat. Thanks to eric-zhu.