Scripture, of course, teaches us not to take revenge ("never avenge yourselves" Romans 12:19), but to leave room for God's wrath (Romans 12:19). God says, "Vengeance is mine; I will repay" (Hebrews 10:30). In other words, God is just and he will make sure that ultimately all wrongs are made right. But this calls for trusting God, that the Judge of all the earth will do right (Genesis 18:25). We usually don't want to wait for God to "get" them; we want the pleasure of doing it ourselves!
John Calvin shows us how believing in the sovereignty and providence of God - that God rules over all his creation - helps us refrain from taking revenge:
That's right. Look past the one who has unjustly attacked us, to the Lord who allowed it for a good reason. Job looked beyond the men who stole his cattle, even beyond the Devil (who was immediately responsible), to the Lord who had the devil on a leash and permitted this for a reason only known to God.Had Job turned to the Chaldees, by whom he was plundered, he should instantly have been fired with revenge, but recognizing the work of the Lord, he solaces himself with this most beautiful sentiment: "The Lord gave, and the Lord has taken away; blessed be the name of the Lord" (Job 1:21). ...The whole comes to this. When unjustly assailed by men, overlooking their malice (which could aggravate our grief, and whet our minds for vengeance), let us remember to ascend to God, and learn to hold it for certain, that whatever an enemy wickedly committed against us was permitted, and sent by his righteous dispensation. (Institutes of the Christian Religion, Book 1, Ch. 17.8)
Calvin points out that this is also what Joseph did, who was sold into slavery by his brothers. If he had meditated on their crime all those years in prison he might have killed them in revenge! But he turned to the Lord and trusted in him. And when his brothers came before him, he was able to forgive them, comfort them and declare, "You meant it for evil, but God meant it for good" (Genesis 50:20). Yes, God meant it. And it hurt. But Joseph believed in God's sovereignty and trusted God's goodness.
Terry Simpson used to ask something like, "Can you, in your wildest dreams, imagine Jesus on the cross yelling at the soldiers and Pharisees, 'I'll get you for this if it's the last thing I ever do!!'" Of course you can't. He forgave. He trusted God, who could have stopped them from crucifying him, but had allowed this great offence - the worst sin in human history - for a good reason.
May God give us grace to do the same.