I tried the exercise thing to see if it interfered with or helped those types of cramps, didn't help for me though.
Heat or cold helped it a bit, but since I no longer have a bath that's one method out. Heat pads don't seem to generate much effect for me.
Far as codeine goes, it's a hardcore painkiller and I'd advise only using it once or a couple of times per shark week. It's addictive, being an opiate-based one, so I only use it when I have un-ignorable pain for something and very sparingly. Ibuprofen is also not a good one to take too much of as it can cause internal bleeding of the stomach and so on. The good thing about the former I found is that one proper dose is usually enough to kill the first and worst cramps, but only provided you don't go and do something soon after to "awaken" the uterine muscle again.