People on the subway grating on my nerves? I pretend I'm someone patient. Need to bang out a particularly annoying task? I pretend I'm someone who's really interested in that task. Wife irritated by my sloth about the house? I pretend I'm someone who cleans up promptly. Feeling particularly miserable today? I pretend I'm someone who's naturally happy.
It doesn't work forever, and it doesn't work perfectly, but it works better than any other mental trick I've discovered.