I doubt anyone who didn't have a gun at the time has lived to give advice on this one.
Apparently loud sound scares it away.
Nothing, you wouldn't have time it would be on you before you could shout out OH F*UCK.
OMG...run, Sahib...run like the wind....