There's a workflow I'm working on. It's so far been web forms filling databases with occasional writing configuration scripts for analysis instruments instruments, and I've written it all, in Perl, Javascript, HTML, Javascript, MySQL. 

And right now, the task in front of me is generating a post-instrument analysis Bash script. Or, rather, a Perl-written post-instrument analysis script generator. And it is taking forever.

I have had this as the front-burner task for a while now, and progress has been horribly, embarrassingly slow. In fact, last Friday, I sat, looking at the screen, trying to find my way into the next step of the project, and the first sign of ... inspiration? Of capability? Of knowing and attacking any aspect of the task and being able to code it? Well, it started at 4:30pm, and I rode it until 8:20. 

I am looking for and hoping for ideas and techniques to get into that mental space consistently and on my schedule. Any pointers?