One thing I want to emphasize here is f.lux. It works. In fact it works brilliantly – it has had a profound effect on my sleep quality of the last year.
I personally have found that f.lux is insufficient. It does significantly tone down the amount of blue that my laptop screen puts out, but even when set to the most red-shifted setting possible, my laptop screen still puts out enough blue light to keep me from getting sleepy.
It has had a huge effect on my sleep as well. In fact, I jail broke my phone specifically to install f.lux and that's been even better.