Shaking the ketchup bottle is a euphemism for male masturbation. The metaphor comes from both the vigorous shaking motion applied to a ketchup bottle, and the "splooging" of ketchup when you've shaken it for long enough. Note: If what comes out is actually ketchup coloured, then you should very likely consult a doctor.
BRB - need to shake the ketchup bottle.
I was vigorously shaking the ketchup bottle last night.
I think I spent too long shaking the ketchup bottle - I'd ran out of ketchup by the time I was finished.
Shaking the ketchup bottle is a great way to pass the time.