I bought this for about 20 € sometimes ago (about 27 $, by now they are cheaper) and I don´t regret one single cent I spent on it.
This one is a "Photonpump E7" and runs on 3 AAA standard batteries, but the modifications should work on models from other brands as well.
At first I fit the whole flashlight into a piece of bicycle innertube, which provides better grip and adds a certain degree of shockproofness and better protection against splash water.
Second step was to add a rubber mount for the handlebar of my bike as shown in the pictures.
Third step, I added some neodymium-magnets and placed three of them (enough for a reliable fixation on flat and round [magnetic] surfaces) under the innertube coating. Comes in pretty handy sometimes and does not effect anything.
If your own flashlight is heavier, you might add more or arrange them in an array.
Fourth step, for using it as a bike light, I wanted to be visible from the side, as well as from the front, but not blinding others.
If you see the lit flashlight from the side, it is hardly visible, the beam is focused and covered by the housing. Seen from the front it may blind you, even if you are not in the focus.
By adding a blend made of a half-cut semitransparent film container, I try to avoid / improve all of these things at once. Works like a lower-beam headlamp.
The light you personally don´t need to see better is diffused and dimmed to provide better visibility from the sides and for the opposing traffic without blinding it.
Just see the annotations in the pictures.