1) Go to the bottom - As long as air pressure and depth isn't an issue.
2) Use topography and features to your advantage - Do #1 and back up against something, take away part of the 360 environment you're in (angle of attacks). I know of no documented cases where sharks attack 'downward', they attack up or at somewhat level angels.
3) Keep eye contact focus on the shark - Keep it in front of you if at all possible, but don't forget to scan, if you attracted one, there may be others coming as well.
4) Do not shoot the shark with your gun - If the shark has any mass to it you probably won't kill it, keep it use it as a spear, poke it only if you have to.
5) Do not throw away your catch - No one can say the shark will go for the bag or stringer of fish and not you. Save it for #6.
6) If you have to surface, or do surface - Immediately tell the crew so they can keep an eye out with you. Get out as quickly as you can and WITH your catch if you can, don't hand it up. This is where you are most vulnerable and if you have to, you can release the catch to give it a second potential target.
7) Dive with a buddy - This does give the sharks more to focus on besides you and what you're holding. There is some safety in numbers.
** Use the next ones with caution. Depending on the species you'll just piss it off, not make it go away **
8) If you find yourself in a position to defend yourself:
- Gills - It's like kicking a guy in the balls, poke here with your spear gun
- Eyes - Causing it pain to act as a deterrent helps
- Swim Bladder / Liver - You will take it's ability to manage buoyancy away and it's maneuverability away. All fish have some kind of bladder or use specific organs to help maintain buoyancy. In the case of sharks only a few species have bladders, most have to swim to stay 'afloat' or they sink. An example is the Sand Tiger Shark: It actually surfaces to "gulp" air to help maintain it's buoyancy and you will occasionally see one 'burp' air bubbles out it's gill's to control buoyancy.
Last, but no least - FOCUS on your air consumption. This is a lot easier said then done, I realize that. But keep your eye's focused on the shark, scan on occassion, and listen to yourself breath. Focus on calming down and breathing easier.
I've been diving with sharks for years and done a ton of dives in both in confined and open water with a wide range of shark species and my advice, as is other peoples, based on that experience. That said, even my advice can be wrong - wild animals are wild animals and it's difficult to accurately predict their behavior, tho we can make 'educated' guesses.
Take some time and read about sharks in your area. Every animal has certain behavior characteristics, sharks are no different....but, just like a dog, they can nip/attack without showing those signs. Go Read.
...and if all else fails...there is a reason there is safety in numbers. You don't have to be the fastest person in the water, just not the slowest....funny how unsnapping a fin strap can affect how a person swims in the water
LOL
Now, go read.