Here are some excercises that someone wiser then me was kind enough to share. I still do them but probably not often enough.
The aim is to be smooth and deliberate.
Go find a carpark with a decent surface, pick a marker and practise passing it at - exactly - 25mph. Do this two or three times so you know how it feels, it is not as easy as you might think. When you are comfortable that you have the speed under control, you are ready to begin.
As you pass the marker, pull the clutch and hit the back brake. Try not to lock up, but still stop as quickly as you can. Two or three attempts and you will have the lockups under control. Note where you finish up (drop a coin or bottle top on the ground) and try to stop the bike a bit sooner. You will quickly find that releasing your brake stops you faster then letting it lock up.
Do the same excercise but don't pull the clutch this time. Deliberatly let the bike stall a couple of times until you know exactly how it feels, then try using the clutch at the last possible moment to prevent the stall. Note where you can stop consistently.
Same speed, same marker, pull the clutch and apply pressure to the front brake slowly.
Repeat, pulling the front brake harder and harder to shorten the braking distance until you feel the front lock up. Don't worry, you will know when this happens because it scary and very fucking distracting. So do it again and again until it is scary but not so distracting that you can't do something about it like ease the brake enough to release the lock. Try to keep the front on the edge of locking up all the way to a stop.
Now try again without pulling the clutch. Things will be happening quickly now so when you get a chance, double check you are still passing the marker at - exactly - 25mph. Try it in a higher gear and a lower one to feel the difference it makes.
Now try again using the back brake as well (this is the excercise I find hardest). Not locking the rear will take a few tries as if you are loading up the front leaving very little weight on the back wheel to stop it locking. Try this a few times and you will probably find your self pulling front and rear together, but the rear frimly and front softly, easing up on the rear to avoid locking while firming up the front as the weight transfer gives it more grip.
Take a breather before trying it all again from 30mph.