Drush on 1and1 Shared Hosting php cgi

I’ve had to search for setting this up so many times I figure I should write my own howto on setting up drush on 1and1 hosting packages. Because 1and1 only has php-cgi and not php-cli we will have to force the drush.php file to behave differently.

NOTE: This only works on 1and1 packages with ssh.