Start with not hating yourself. That can go far.
Then, when interacting with others, be nice for purely self-interested and functional reasons.
remember that there are two types of people in the world: those you choose to interact with (usually friends), and those you are obliged to interact with (usually work-related).
If you find you don’t want to be nice to your friends, then why are they your friends?
If you find you don’t want to be nice to people at work, remember that the only reason to be nice to them is because they probably can make your life easier, and are far more likely to if you are nice to them. At the end of the day you’re basically being paid to talk to them, so you’ve got nothing at all to lose. Grit your teeth, smile, breathe deeply, be polite.
A former co-worker was constantly in a bad mood. She was mean and unpleasant and she made her life so much worse by being like that. She confidentially warned me about people we worked with who were jackasses, and I started to realize that everyone she had ever worked with was, in her eyes, a jackass. I also realized that most of these people were quite nice to me. It didn’t take me long to realize that it was her hideous personality that put people in uncooperative moods.
Next time you want to lose your temper, think:
“How will this work out if I lose it on this person?” and “How will this work out if I put on my best phony polite smile?” Pick the alternative that you would prefer: if you stop to think, it will almost always be option #2, since that will inspire people to maybe be nicer to you, to help you, and to get out of your face sooner.
They never need to know that you would have much preferred to punch their lights out.
Re: inanimate objects that don’t co-operate, like the pen that falls on the floor or the button that pops off your pants: I have no advice. Those drive me around the bend as well. Fucking inanimate objects !