Sunan Abi Dawud, Book 43, Hadith 330 (Abu Dawud 5104)

Abu Hurairah reported the Prophet (May peace be upon him) as saying:

when you hear the cocks crowing, ask Allah for some of His grace, for they have seen as angel; but when you hear an ass braying, seek refuge in Allah from the devil, for it has seen the devil.