(Go read, then come back to my thoughts.)
Shimei believed God had told him to curse David, and David accepted it as if it truly was from God. But I know that later God restored the kingdom to David.
So here's David, who truly doesn't know what God is planning, and look at his attitude in verse 12: "It may be that the Lord will see my distress and repay me wtih good for the cursing I am receiving today."
What an attitude! He looked beyond the immediate discomfort, and saw God's ultimate desire for good for him. Too many times all I can see is the discomfort, the unfairness, the difficulty.
May God help us all to look beyond that, and have the same attitude as David. Humility to accept that perhaps this cursing has been sent from (or at least allowed by) God, and trust in God's goodness.