How to change color scheme in iPython 0.12

May 18, 2012

Took me awhile to find this in their documentation so I’m adding to search engine indecies. I wanted to change the color in iPython since it was a bit dark for me. The doc that shows you how to do this is here. The moral is, run

ipython profile create

and it’ll tell you where it created ipython_config.py. Go in there, search for color and you get 3 options. That’s pretty much it.

Printout Kifu

May 6, 2012

I run an after school go program at Evergreen School. I needed some blank kifu to record games and the ones available at the Seattle Go Center tended to be the ones where you write in the boxes instead of on the intersections, so I made my own. Feel free to use them as well.

9×9
13×13
19×19

Konami Code Plugin for JQuery

April 16, 2012

So the Konami Code is implemented on many websites. The latest I’ve seen is this French presidential candidate (I don’t know his politics but I’d vote for him). Anyway, I was sure that there already existed a JQuery plugin that did this, but I wrote my own anyway (it probably didn’t have to be a jquery plugin).

For reference, this is how JQuery does it. A bit cleaner than my version, I guess.

// Hehe.
if ( window.addEventListener ) {
        var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
        window.addEventListener("keydown", function(e){
                kkeys.push( e.keyCode );
                if ( kkeys.toString().indexOf( konami ) >= 0 )
                        window.location = "http://ejohn.org/apps/hero/";
        }, true);
}
view raw custom.js This Gist brought to you by GitHub.

And their include.

I’ll implement something here once I can come up with something creative (so give it half a decade).

Uberman is Hard – How About Everyman?

March 19, 2012

So I missed my last nap by a fair enough margin to throw myself off pretty bad. I’m now several hours off schedule. In truth, I don’t think I was even at the hardest part. I’m going to shift to what’s called the “Everyman” cycle. This will be a modified version which is hopefully easier to get into. The schedule goes something like this:

  • 4 hours of sleep (probably around 4am – 8am)
  • 20 minute naps every 5 hours or so resulting in 1 hour of naps throughout the day (once just before lunch, again in the afternoon, once more before midnight)
  • 5 hours total sleep for a 24 hour period

Uberman #1-6

March 19, 2012

#1 (2pm-6pm): Getting any sleep at all was difficult. I feel like I almost fell asleep when the alarm went off. Had water and quesadilla.

#2 (6pm-10pm): Getting to sleep was difficult again. Had spring roll and orange slice.

#3 (10pm-2am): Felt pretty tired, I think I missed the mark :( Ended up waking at around midnight instead of 10:30pm.

#4 (2am-6am): Pretty tough so far. One observation is that overcoming the “NYEH 5 MORE MINUTES” feeling to get out of bed is one of the harder parts. The transitions tend to be pretty tough. It will probably help if the heater is on so that the temperature outside the sheets is similar to under the sheets. Then, it’s the matter of actually getting sleep. I haven’t yet had a nap where I’ve actually woken up feeling a bit better except for the one where I overslept. Often I find myself struggling to clear my mind so I can sleep, but when I finally do, the alarm goes off. I suspect this will get easier as I get more tired. The hard part will probably be waking from it.

#5 (6am-10am): Finally got sleep. Getting up was really hard. I expect it to get harder. Showers seem to work well for filling time. I look forward to the next one…

#6 (10am-2pm): Missed another by a few hours. Tired.

Uberman Begins

March 18, 2012

So I started Uberman today at 10am. It’s 1:50pm (almost time for my first 25 minute nap) and really there’s nothing to write about how I feel since it’s really just normal so far (obviously). I did, however, want to get some things down in writing before starting as my goals for this first phase.

  • Be punctual
  • Eat something right after waking up
  • Drink a cup of water right after waking up
  • Nothing strenuous for the first 60 hours at least
  • Write an entry (short or long) after waking (this current phase will be #0)

Crimp Chimp Squirrel Equation

March 12, 2012

So a squirrel came in the mail today. Combined with the awesome powers of Crimp Chimps, it became a squirrel bag.

+ =


And now the obligatory introductory gallery. (action/location shots to come)

Turning off autocommit in jaydebeapi

March 1, 2012

I was doing some work in python, connecting to a derby database using the JDBC connector. My dataset had some Clobs which spit out the error:

java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back.

After some research, it turns out JDBC specifies that autocommit should be defaulted to on. This was causing the transaction to be committed immediately after execution so that my clob was freed and I couldn’t inspect it. JayDeBeApi follows the DBAPI2 specification which doesn’t have a native way to turn off autocommit. So I had to turn it off through the java connection object like this:

conn = jaydebeapi.connect('org.apache.derby.jdbc.EmbeddedDriver',derbydb)
conn.jconn.setAutoCommit(False)

view raw autocommit.py This Gist brought to you by GitHub.

After that, I was able to access my clobs through the clob api.

import jpype, jaydebeapi

jar = 'derby-10.7.1.1.jar'
derbydb = 'jdbc:derby:my/derby/db'

args = '-Djava.class.path=%s' % jar
jpype.startJVM(jpype.getDefaultJVMPath(),args)

conn = jaydebeapi.connect('org.apache.derby.jdbc.EmbeddedDriver',derbydb)
conn.jconn.setAutoCommit(False)

curs = conn.cursor()
curs.execute('SELECT someclobs FROM table')

for q in curs.fetchall():
print q[0].getSubString(1,q[0].length())

curs.close()
conn.close()
view raw clobstring.py This Gist brought to you by GitHub.

Polyphasic Sleep Experiment

February 22, 2012

I’m going to have some pretty significant downtime over the next months (starting in March or so) so I’m going to give polyphasic sleep a shot. The theory is that we, as humans, rely on REM sleep for our bodies to recover. In our normal (monophasic – 6-8 hours of sleep time per night) cycle, we get about 90-120 minutes of REM which doesn’t kick in until several hours of sleep. I’m going to be trying an uberman cycle which calls for 6 naps throughout the day at 4 hour intervals lasting around 20-30 minutes each. The idea is to force the body into REM immediately for the duration of these naps, yielding 2.5-3 hours of total REM sleep.

Anyway, this idea is not new at all as it was apparently used by Thomas Jefferson and Ben Franklin, among others. The idea isn’t new on the internet either with a bunch of bloggers documenting their experiences. I’m doing this really just to see how it’s like (since I’ve got a pretty good window of opportunity). I’ll document as much of it as I document.

My Rogue UI

January 23, 2012

As promised, here is my UI using the Naga Razer Epic.

The idea I had incorporating the Naga is pretty simple. Since I’m new with the mouse, I felt like I needed a guide to what buttons are available to me. Those are the “N” buttons on the right side of my action bars. I configured the keybinds using Bartender4 and the main framing is ElvUI. Those are the main ones. I’m using mouseover macros with the Naga buttons so I find it pretty convenient in both arenas and battlegrounds. Here’s an example of a macro I use:

/cast [@mouseover,exists] Shadowstep
/cast Shadowstep
view raw gistfile1.txt This Gist brought to you by GitHub.

In English, you shadowstep the mouseover if it exists, otherwise just shadowstep your current target.

As far as reviewing the Naga is concerned, I’d say it’s an excellent mouse for MMOs. My reaction times are improved significantly after the expected learning curve period. I’m still getting faster with it, though I do have trouble using the bottom 6 buttons (7-12) effectively.

Older Posts »