Cross-examine yourself for every detail; try to evaluate your deeds through introspection whether they were meant for the realization of virtue or motivated otherwise. What motivated you to ask questions about mid-night prayers? Was it purely for the sake of God with an intention to perform such prayers, or for projecting your image as a deeply religiously person? Why is it that you are eager to inform others about your pilgrimage by all possible means and about the number of times you undertook it? Why are you not content with confining your charitable deeds to yourself alone, and what do you want to gain by informing the others of your acts of charity, for as soon as you find an opportunity you announce them? If it is undertaken for the sake of God, and you intend that people should imitate you, and you think in terms of الدال على الخير كفاعله (the one who shows the path of virtue is as worthy as the doer of it) while performing this deed, its display is justified; thank God, for He has enabled you to act with a clear conscience and pure heart.
Imam Khomeini (r), Forty Hadiths, p. 74-75