Excitation of high vibrational states of N$sub 2$ and CO via shape resonances