抱佛腳

Etymology
The sense of "profess Buddhism" was attested in 's poem:

The sense of "to do something at last minute" is short for, an idiom which was derived from the above poem.

Verb

 * 1) to leave something to do at the last minute; to make a last-minute effort
 * 2)  to profess Buddhism