Might as well work as much as you can in the days you have left. Don't look into the past - you cannot change it. Instead, find a room to work in (library or lecture theatre etc) take all your stuff and just work. Don't worry if you don't finish it - actually doing some work is going to get you a higher grade than nothing at all.
There will be a large temptation to look into the past and blame yourself for the situation you are in. You should avoid doing this - everyone makes mistakes and has times when they screw up, but you just need to focus on the present so that you don't screw up more things. Don't focus on the future either, as it is not an inevitability - you are going to change it by working.
To summarise: focus on the present situation and only that. Work out ways to improve the situation you are in, not necessarily aiming to completely solve the problem.
Don't think about the past or future, they are irrelevant right now. If they come into your mind, shoo them away, they are unwanted.
PS: Avoid caffeine if at all possible. It will only succeed in stimulating your anxiety. This is something I've learned from first-hand experience. Trust me, it's not worth the alertness and awakening it provides.