PyCharm type hints

For class variables that get assigned:

def foo():
    #: :type: ObservablePlanarGraph
    self._graph = graph

For input variables (in a docstring):

def foo(self, feature_finder):
    :type feature_finder FeatureFinder

For return types (also note, tuples and lists):

def foo(self):
    :rtype (list[PolicyData], list[PolicyData])
    return res

File prepending magic

To prepend some text at the start of each file, use sed:

sed -i '1i <pattern>' <files>

Useful examples:

Add emacs headers for LaTeX mode:

sed -i '1i % -*- mode:LaTeX; mode:visual-line; mode:flyspell -*-' *.tex

ipython tips and tricks

On OSX, if ipython crashes at startup it just needs to be re-installed:

sudo easy_install -U ipython