a Dios rogando y con el mazo dando

Etymology
lit. 'strike with your rod while you beg to God'.

Proverb

 * 1) God helps those who help themselves