Considering "music" is always one of the most common answers to this question, and undoubtedly something you've tried before, you might also want to consider "no music". Time and time again I've realized how much I get invested in whatever I'm listening to, want to switch tracks, which makes me open up my browser/Spotify, makes me want to research new music, I end up on Facebook... It's best for me to just turn it all off. You may want to try doing the same, if music has been the norm for you.
Ignoring people who want/insist that you be "like everyone else". E.g. living in a noisy dorm, studying in the library at a table full of chatters, working in an open floor of cubicles.
Be yourself. In the long run, you'll gain more acceptance that way, anyway. And you'll be able to effectively work.
And the long hours come naturally, when you're doing something that interests you. Note that, not infrequently, that interest will have more of a social context -- and motivation -- than you might expect. Just, approach that context on your own terms.
Usually several factors go into being focused (not necessarily ranked in order):
* Determination. How much do I care about this feature / bug fix?
* Long blocks of quiet. No distractions. This is usually why late at night works really well for me (no interruptions for meals, no emails, etc).
* Interesting factor. Doing drudge work is highly unmotivating. Using a new technology or building something I consider cool (say, a compiler) is tons of fun and I can't rip myself away from it.
I use the Pomodoro Technique through this website: http://tomatoi.st/
25 min of work, 5 min short break, 25 min of work, 5 min short break, 25 min of work, 5 min short break, 25 min of work, 15 min long break. rinse repeat
Im interested in knowing what kind of music? not genre, necessary...but level of familiarity. I learned that I can use a playlist of really otherwise distracting music like pop, but if it's pop that i've heard 100x before, it works as well as background noise. But also with the added benefit of a good beat which helps sometimes to keep me going
You might try searching for something more recent (I joined the site well after that post was made, so I'm sure it's been asked more recently) and/or ask again. I'm not really a hacker. My son suggested I listen to music when I code, which is not a whole lot, and it did help me. But I mostly do other things and, besides, my oldest son tends to have lyric-less music on much of the time that I am home and on the computer (or he's playing a game, which has a similar effect in terms of background noise).
When I'm stressed out, he sometimes intentionally plays the background music from some video game he had when he was a kid. For me, it sets the mood of "all is right with the world because my kids are okay". It's very effective in calming me down. But that's something very specific to me and I can't even tell you the name of the video game (though my son could).