I keep hearing that leg cramps are triggered by a low level of magnesium or potassium, so I try to eat a magnesium-heavy food (like a banana) and take a potassium supplement. I don't know if it's really made much of a difference, though. I still get bad leg cramps at night. I think the real cause of my leg cramps is the amount of time I have to be on my feet at work. I have to walk on a concrete floor all day, then stand next to a machine for hours if my boss assigns me to a plastic injection molder that day.
I try a few home remedies, like analgesic sports creams and a handheld massager. If I can get the knots out from previous leg cramps, I usually don't have leg cramps in bed that night. If my legs are still stiff and sore, however, I can expect to be awaken at least once by night leg cramps.