Jami` at-Tirmidhi, Book 27, Hadith 84 (Tirmidhi 2046)

'Ibn 'Abbas narrated that a man cursed the wind in the presence of the Prophet, so he said:

"Do not curse the wind, for it is merely doing as ordered , and whoever curses something undeservingly, then the curse returns upon him."