I remember always struggling to keep myself awake in class due to going bed late or just being bored to death. So to combat this feeling of just putting my head down and thinking "forget the teacher I'm sleeping!" I always shake my leg back and forth, chew gum like crazy, get up and go to the bathroom. and if the sleepiness is really bad I do a mini workout outside of class.