There are all sorts of things you can do. You can pray. Stop, think about why you're mad and analyze the details of the situation and come to a realization that you are choosing to feel the way you do. You could also stop, slowly count to ten and take deep breaths and think rationally when you're mind is clear and how you can avoid putting yourself in that situation again. Hope this helps. You can also write in a journal to let if off your chest and that helps too!
Depends on what you mean by "mad". Are you referring to feelings of anger, or the thoughts and feelings that come to you when one gets too deep into philosophy? If the former, try counting to ten or wait until someone more powerful than you adjusts your attitude for you. If the latter, alcohol helps, temporarily anyway.
Meditate - find a quiet room sit still with your eyes closed and observe your breath - let your thoughts go and when the noise comes in your head - say not now - if you can do this for 15-20 minutes you will find yourself becoming calmer and more focused. Good luck.