Patañjali's Yogasūtra I.33

Yogasūtra I.33 - maitrī-karuṇā-muditā-upekṣāṇāṁ sukha-duḥkha-puṇya-apuṇya-viṣayāṇāṁ bhāvanātaḥ-citta-prasādanam

In daily life, we see around us those who are happier than we are and those who are less happy. Some may be doing things worthy of praise, while others engaged in ignoble deeds. Whatever our usual attitudes towards such people and their actions,

If we can be happy for those who are happier than ourselves, compassionate towards those who are not as happy, appreciative towards those whose actions are praiseworthy and non-judgemental towards those commit sins, our minds will remain traquil.