Don't over-compensate, don't explode!
Practise polite but firm responses, and use them. General whinging you will have to try and put up with (though you could say something like 'Actually, do you mind if we don't talk for a bit? I really need to concentrate on this' if desperate). Anything that impacts on you, you should deal with immediately.
I've had a colleague for years who is a complete pain. He has recently used strategic incompetence cynically to get out of the important task he was assigned, landing many of us with last-minute extra work to pull the organisation of of the mess he created. It was the final straw-I simply cannot bear him any more and avoid him.
But actually, the constant ranting about him at work and home was making it a bigger deal than it needed to be:- beware of doing this.
DH simply refused to listen to it. Now I come home and just say colleague's name. DH rolls his eyes and makes me a cup of tea. And that is more fitting, somehow, more proportionate. Twerps will always be with us, sadly. Don't give them an iota more headspace than you need to. In fact, be ruthless about taking the space you need to get your work done, without any qualms of conscience.