Ecclesiastes 8:10–17 (NKJV)
10 Then I saw the wicked buried, who had come and gone from the place of holiness, and they were forgotten in the city where they had so done. This also is vanity. 11 Because the sentence against an evil work is not executed speedily, therefore the heart of the sons of men is fully set in them to do evil. 12 Though a sinner does evil a hundred times, and his days are prolonged, yet I surely know that it will be well with those who fear God, who fear before Him. 13 But it will not be well with the wicked; nor will he prolong his days, which are as a shadow, because he does not fear before God.
14 There is a vanity which occurs on earth, that there are just men to whom it happens according to the work of the wicked; again, there are wicked men to whom it happens according to the work of the righteous. I said that this also is vanity.
15 So I commended enjoyment, because a man has nothing better under the sun than to eat, drink, and be merry; for this will remain with him in his labor all the days of his life which God gives him under the sun.
16 When I applied my heart to know wisdom and to see the business that is done on earth, even though one sees no sleep day or night, 17 then I saw all the work of God, that a man cannot find out the work that is done under the sun. For though a man labors to discover it, yet he will not find it; moreover, though a wise man attempts to know it, he will not be able to find it.
The Preacher concludes in this passage that, although he may get by with it for a while, the evil man eventually will have his life cut short due to his evil works. He may think he is slick and able to continue in his evil—with his mind convinced—but he will eventually die. Solomon summizes that the best a man can do is enjoy the fruit of his labor while he lives. Seek all you will, and try to understand the work of God, but you will not. His ways confound the wise and stupify the dull.