Tuesday, October 30, 2012

Sleep in Windows

Many of us are aware that there is no sleep in Windows. For those of us who don't want Cygwin or something similar, I wrote this stupid little script just now.

#!/usr/bin/env python2 from time import sleep from sys import argv, stderr, exit try: duration = int(argv[1]) if duration <= 0: raise ValueError sleep(duration) except (IndexError, ValueError): print >>stderr, 'Usage: %s duration' % argv[0]

It's not significant, but I am not amused by the lack of such a command in Windows.

Wednesday, October 24, 2012

Musings During Jury Duty

While killing time during one of the long waits associated with jury duty yesterday, I scribbled this down:

My handwriting is also worthless.

It's not that it's boring; it's that I have trouble channeling a coherent train of thought without structured stimuli. My mind jumps from thought to thought without allowing any proper development. That is, unless I find something particularly interesting.

My attention span is worthless.

There really are all sorts of stimuli out there; those who claim to be bored are just ignoring them, which iss fairly normal as we are thought to do so. Really, paying attention to them more often than not prevents focusing on more important things.

The Web acts as a source of mildly structured stimuli for me, which is why I often, though not always, turn to it. Social interaction is a form of stimulus structuring with a somewhat useful contex.

I transcribed it verbatim, against my normal process of proofreading while I do so.


After my dissatisfaction with incognito mode in Chromium, I ended up writing this script, which I call 'tmpchrome' (despite it using Chromium).

My main issue is how all pages share a single incognito session; I'd rather have more control over how sessions are shared.

#!/usr/bin/env python2 from subprocess import Popen from sys import exit, argv from traceback import print_exc from os import rmdir from os.path import isdir from shutil import rmtree from tempfile import mkdtemp profile = mkdtemp() returncode = 1 p = None try: print 'Profile:', profile p = Popen(['chromium', '--user-data-dir=%s' % profile] + argv[1:]) p.wait() returncode = p.returncode except: if p is not None: p.kill() p.wait() returncode = p.returncode finally: try: rmtree(profile) if isdir(profile): rmdir(profile) except Exception: print_exc() finally: exit(returncode)

It isn't perfect, but is good enough for me.

Monday, October 22, 2012

Nico Nico Douga Download

The queue's a bit smaller this time, but I think these are some really good songs.

Saturday, October 20, 2012

My Typical Thought Process

I often follow the below process when deciding on what I should do.

  1. I should do $X.
  2. Hmm. $X is either:
    1. What everyone does ("It's too obvious").
    2. Something I have already done at least once ("Too boring").
    3. Not a challenge.
    So I'll spice it up by adding some new elements in
  3. Eventually: I'll do this crazy thing with some minor elements of $X added in here and there

It usually ends up working out quite well, though, so I'm happy with this process.