2 Samuel 16:5 When King David came to Bahurim, there came out a man of the family of the house of Saul, whose name was Shimei, the son of Gera, and as he came he cursed continually. And he threw stones at David and at all the servants of King David, and all the people and all the mighty men were on his right hand and on his left. And Shimei said as he cursed, “Get out, get out, you man of blood, you worthless man! The Lord has avenged on you all the blood of the house of Saul, in whose place you have reigned, and the Lord has given the kingdom into the hand of your son Absalom. See, your evil is on you, for you are a man of blood.”
Then Abishai the son of Zeruiah said to the king, “Why should this dead dog curse my lord the king? Let me go over and take off his head.” But the king said, “What have I to do with you, you sons of Zeruiah? If he is cursing because the Lord has said to him, ‘Curse David,’ who then shall say, ‘Why have you done so?’” And David said to Abishai and to all his servants, “Behold, my own son seeks my life; how much more now may this Benjaminite! Leave him alone, and let him curse, for the Lord has told him to. It may be that the Lord will look on the wrong done to me, and that the Lord will repay me with good for his cursing today.” So David and his men went on the road, while Shimei went along on the hillside opposite him and cursed as he went and threw stones at him and flung dust. And the king, and all the people who were with him, arrived weary at the Jordan. And there he refreshed himself.
Genesis 50:20 As for you, you meant evil against me, but God meant it for good, to bring it about that many people should be kept alive, as they are today.
1 Kings 22:21-23 Then a spirit came forward and stood before the LORD, saying, ‘I will entice him.’ And the LORD said to him, ‘By what means?’ And he said, ‘I will go out, and will be a lying spirit in the mouth of all his prophets.’ And he said, ‘You are to entice him, and you shall succeed; go out and do so.’ Now therefore behold, the LORD has put a lying spirit in the mouth of all these your prophets; the LORD has declared disaster for you.”
Lamentations 3:38-39 Is it not from the mouth of the Most High that good and bad come? Why should a living man complain, a man, about the punishment of his sins?
John 18:11 So Jesus said to Peter, “Put your sword into its sheath; shall I not drink the cup that the Father has given me?”
Job 9:12 Behold, he snatches away; who can turn him back? Who will say to him, ‘What are you doing?’
Matthew Henry Commentary; – David bore Shimei’s curses much better than Ziba’s flatteries; by these, he was brought to pass a wrong judgment on another, by those to pass a right judgment on himself: the world’s smiles are more dangerous than its frowns. Once and again David spared Saul’s life, while Saul sought his. But innocence is no defense against malice and falsehood; nor are we to think it strange, if we are charged with that which we have been most careful to keep ourselves from. It is well for us, that men are not to be our judges, but He whose judgment is according to truth. See how patient David was under this abuse. Let this remind us of Christ, who prayed for those who reviled and crucified him. A humble spirit will turn reproaches into reproofs, and get good from them, instead of being provoked by them. David the hand of God in it, and comforts himself that God would bring good out of his affliction. We may depend upon God to repay, not only our services but our sufferings.
jamieson-Fausset-Brown Commentary; Shimei, … a man of the family of Saul—The misfortune of his family, and the occupation by David of what they considered their rightful possessions, afforded a natural, if not a justifiable cause for this ebullition of rude insults and violence. He upbraided David as an ambitious usurper, and charged him, as one whose misdeeds had recoiled upon his own head, to surrender a throne to which he was not entitled. His language was that of a man incensed by the wrongs that he conceived had been done to his house. David was guiltless of the crime of which Shimei accused him, but his conscience reminded him of other flagrant iniquities; and he, therefore, regarded the cursing of this man as a chastisement from heaven. His answer to Abishai’s proposal evinced the spirit of deep and humble resignation—the spirit of a man who watched the course of Providence and acknowledged Shimei as the instrument of God’s chastening hand. One thing is remarkable, that he acted more independently of the sons of Zeruiah in this season of great distress than he could often muster courage to do in the days of his prosperity and power.