1. Silence. I'm not smart enough to get anything done with a lot of noise or music going on.
2. Distracting my mind. I read long, complex fiction novels for 30-60 minutes at night before bed. This is the most valuable part of my day because it acts like a shutdown script for my mind. Afterwards I feel completely disconnected from what I'm working on, worrying about, or struggling with. Some novels that I've used in the past: War & Peace, Ulysses, As I Lay Dying, Moby Dick.
3. Frequent breaks. While working I make sure to pause regularly and often stop altogether, walk-around, etc. This helps and hurts because it can interrupt flow, but the big benefit is that I find myself less tired at the end of the day when I stick to this.
4. Pen & paper. I buy spiral-bound notebooks at Walgreens for $0.35 and fill one every 3-6 months or so. I use pen and paper to plan programming projects, do class designs, brainstorm ideas, draw diagrams, almost everything.
5. Org-mode. I also use org-mode to more formally track things. I consider my notebook an "informal" workspace, while my org-mode files are more "formal". I utilize the agenda feature to produce to-do lists and calendar.
6. Diversity of projects. I try to always have some toy or pet project to play with when I find myself lacking motivation or hitting dead-ends on my primary work.
7. Try to keep it to 8 hours per day. This often seems (or "is" depending on your management) impossible, but it really does make an enormous difference in your ability to stay consistently productive and creative.