I think this is where planning and leaving notes for yourself comes into play. If you can spend one hour long span planning out what you're going to work on for the next 6 days of 30 minute sprints, it should lessen the time loss due to context switching. That's what I found worked best during my year of writing code every day. I would sit down on a weekend day and plan out a bunch of bite sized tasks. That way I could look at the list, pick something that could be done in 30 minutes without much thinking and get right to the task of writing code.
(That being said, I didn't restrict myself to 30 minute sprints during that year and there were certainly things I did that either could not be done in 30 minute sprints or would require quite a bit of extra planning to be able to be broken up into subtasks and done in 30 minute sprints.)