Nothing beats being wise and avoiding situations and places that you really don't want to be in.
But if you do find yourself being attacked, remember: they made that choice and forced any choice that you make as a result onto you.
So don't feel guilty if you beat the shit out of someone.
If you have a gun and feel like shooting is justified, then empty the clip and aim for their body and then their head (kill-shot, gangsta-style, with the gun sideways).