píng shí bù shāo xiāng , lín shí bào fó jiǎo
lit. to clasp the Buddha's feet when danger arises (idiom); fig. to profess devotion only when in trouble
doing things at the last minute
to make a hasty last-minute effort (often refers to cramming for exams)