Whenever you find yourself in a grumpy, complaining mood, immediately think of something to be grateful for. You might even try to think of ten things to be grateful for. That takes some time. Take the time to enunciate each thing slowly:

My family.
Good health.
My Good Friend.
A regular paycheck.
The air that I breathe.
And so on. By then, you might have completely forgotten what was making you grumpy!

What is interesting about this practice is that it is not at all difficult. If I were to ask you now to pause in your reading and think of two or three things to be grateful for, I'm sure you would have no difficulty. The reality of gratitude is so strong, so deeply present in our lives, that shifting the attention to gratitude is one of the most reliable ways you can alter your state of mind. If you do it every day, it is interesting to see how the list changes, how often something that just happened — some small kindness or unexpected pleasure in the course of our day — spontaneously makes it onto the list.

Lewis Richmond in Work as a Spiritual Practice