Things I will not do today, because I have real work to do

This is what pretty much every interaction I have with a computer is like:

So I’ve discovered that one of the better ways to combat insomnia is to just remember to turn the brightness down on my computer screen at night. Yeah, go figure, it turns out that staring directly at a daylight-bright rectangle for hours right before bed isn’t exactly conducive to a good night’s sleep.

But I keep forgetting to turn down the brightness on my own, and then it’s two in the morning and I’m not sleepy.

But this is a computer! And I’m a computer programmer! Or at least enough of one to know that other much more talented computer programmers will already have addressed this problem. Except those guys aren’t adjusting the brightness, they’re changing the color temperature of the screen to match the predicted ambient lighting color, which isn’t quite what I want (and I do enough graphics work where accurate color is important that I don’t want the color cast of my screen constantly changing anyway.)

But it turns out the Displays control panel can be controlled by AppleScript, and I know just barely enough applescript to know that I can use perl to bypass most of the stuff about applescript I don’t know, so I could run a perl script every minute or so to check the time of day and trigger the applescript to adjust the brightness. Which would be easy on a regular unix system, but OSX doesn’t have a cron tab and does weird things to the at queue I’ve never quite figured out, but I have figured out that I can use GeekTool to do pretty much the same thing, since it runs in the background and can call arbitrary urls or command-line scripts on a schedule.

And this weather feed includes the daily sunset and sunrise times, so I could have the script call that feed to decide whether the sun is out and therefore what brightness level to use.

But sunrise and sunset only gets me part of the way there: on cloudy days I want to turn the brightness down, too. Which, for that I could use the same weather feed as before, but that would be hard: they use like a billion different text descriptors for the current weather, and I’d have to write something to match against all of them, and there doesn’t seem to be a canonical list of them anywhere so I’d never be sure I had them all, and even if I did that it wouldn’t work that well because, say, “cloudy”, does that mean thick black dark-as-night clouds or light fluffy bright-as-noon clouds? And even if I could sort that out somehow the nearest weather station is all the way in North Adams so it’s not always that accurate for Savoy anyway. So the weather feed is out.

But I do have a much better source of information right here in the house: we use satellite internet access, and the satellite modem has its own web interface which reports the signal strength, which is a really good predictor for how thick the clouds are and therefore how bright it is outside and therefore how bright to set my monitor during daylight hours. So I could write my perl script to check the weather feed to find out if it’s daytime, and if so to scrape the signal strength from the satellite interface, and use all that information to trigger the applescript to control the display panel preferences to set the monitor brightness.

Did you follow all that? That’s five different interlocking software programs, two of which I’d have to write myself, pulling information from two different sources one of which is in geosynchronous orbit.

All so I don’t have to remember to push the brightness button on the side of my monitor.

And I didn’t even include the bit about checking the date to predict whether there’s snow on the ground, which reflects a surprising amount of extra light into the air, especially on moonlit nights (which would mean I’d need to include a data source for the current moon phase as well, which it looks like there are RSS feeds for or I guess I could just calculate it locally.)

It’s a lot of work being a geek sometimes, I tell you.

(The extra-irony part, of course, is that it probably would’ve taken just about as much time to actually build it as I just spent blogging about it.)






Now meeting all your syndication needs:
RSS Feed   RSS blog-only feed   RSS image-only feed