Hisnul Muslim 228

Upon hearing a rooster crow or the braying of an ass

أَعُوذُ بِاللَّهِ مِنَ الشَّيْطَانِ الرَّجِيـمِ

'A 'oothu billaahi minash-Shaytaanir-rajeem.

When you hear the cock's crow, ask Allah for His favor upon you for surely it has seen an angel. When you hear the bray of a donkey, seek refuge in Allah from Satan, for surely it has seen a devil.