Forcing Your Monitor to Take a Nap

I usually don’t like power management touching my display devices. Things just never seem to function to meet my changing (by the minute) needs. I avoid screen savers as they usually drain far too many resources and come on and off at the least opportune moments.

This is a nice take it to the man kind of approach to sleeping your monitor on-demand. No screen saver, but all the benefits of blanking the screen. Just create a file with the following code and then you can go into your window managers key assignment menu and assign a keyboard press to run the script. I generally map all my machines’ pause/break key to do so.

#!/bin/bash

# set the monitor to sleep using xset
xset dpms force standby

-Matthew

Things anew…

Things are anew with less sinew here. *See the old place if you think I’m just throwing out some new blog assonance.

I guess I should place some content within the confines of this virtual cosmos. Content should, hopefully, be making it’s way over from the old location soon. I also hope to finally gather the scattered projects, code, and postings from all of my domains and let this serve as the central portal for all things moi.

For now, I guess we should kick things off with something interesting I’ve done recently.
Hmm, let me see.
Well, I made the banner you see at the top of the site. That’s pretty interesting if you are into art or wine or colorful drinks and the like. It’s a picture I took at the Smithsonian Natural History Museum in Washington, DC. The original is a photo of a display addressing science through the (modern) ages and this particular piece regarding a world’s fair. This version is a simple crop and had the cubism filter applied in GIMP.

The Serenity of Mutaku

Browse around and maybe you’ll find something else halfway interesting. Worst case scenario, you just ate another few minutes off of the clock of your workday. Congratulations and you are welcome.

-Matthew

Tempel 1 NASA Pass-by

Tempel 1 NASA Pass-by

 

Synopsis:

This is a brief project involving NASA’s STARDUST-NExT spacecraft. In 2006, the craft collected samples from Comet Wild 2 and turned back around on a follow-up mission to visit the comet Tempel 1. On February 15 of this year (2011), a series of images of a Tempel 1 fly-by were posted on the Jet Propulsion Laboratory website. Blown away by such an amazing event captured in stunning clarity, I immediately had to put together an animated version of these images. Below is a short summary of a quick hack to create such an animation as well as the resulting files.

More Information:

For more information on the mission, feel free to peruse the press-kit information or visit the fly-by page.

The hack:

Python Urllib2 and Urllib are used to grab the pages and download the images, respectively [urllib2,urllib]. Images are then processed with ImageMagick. NOTE: Using a parsing library like Beautiful Soup would be much better, but what would a hack be if it were the optimal method? Now to the code…

grabber.py – get the images download

This will dump all the images into the current directory so probably best to make a new directory and launch from within that desired location.

#!/usr/bin/env python

import urllib2,urllib

lines = urllib2.urlopen('http://www.jpl.nasa.gov/news/stardust/').readlines()

files = []
for line in lines:
	if '<a href="/news/stardust/index.php?fileID=' in line:
		files.append(line)

links = []
for line in files:
	if "<h3>Comet Tempel" in line:
		links.append(line)

pre = "http://www.jpl.nasa.gov"
linkslist = []
for line in links:
	this_l = line.split('"')[1]
	linkslist.append(pre+this_l)

x = 0
for link in linkslist:
	thislink = link
	thispage = urllib2.urlopen(thislink).readlines()
	images = []
	for line in thispage:
		c = []
		if "../../images/stardust/stardust2/" in line and "alt='Comet Tempel 1" in line:
			c.append(line)
		if c:
			images.append(c[0])
	for image in images:
		d = image.split("'")[1]
		g = thislink.rpartition("index.php")[0]+d
		thisimage = g.rpartition('/')[2]
		x += 1
		try:
			image = urllib.URLopener()
			image.retrieve(g,thisimage)
			print "Grabbed image # ",x," ==> ",thisimage
		except:
			print "**** Problem grabbing image # ",x," ==> ",thisimage

Making the animations:

The following will invoke a small ImageMagick GUI instance. Once the images are loaded the animation will play. To tweak/save, right click and the menu will appear where you can manipulate the GIF. Seen here.

animate *.jpg

Making a scaled version:

Use ImageMagick to scale all the images and animate the scaled products.

for i in *.jpg; do convert -scale 20% "$i" $(basename "$i" ".jpg")"_scaled.jpg"; done
animate *_scaled.jpg

Results:

Okay, enough for you already? Well here are the results: Large version and Scaled version.

 

… Then felt I like some watcher of the skies
When a new planet swims into his ken;
Or like stout Cortez when with wond’ring eyes
He stared at the Pacific …

– John Keats, ms of sonnet (1816)

-Matthew