Sunday, March 22, 2009

Division Binned


Division Binned, originally uploaded by Allen Hutchison.

Looking out our window this morning we saw the heads from Pink Floyd's Division Bell album cover in the skip behind EMI's offices in London. The album came out in 1994, so I wonder where these have been all those years.

Wednesday, March 4, 2009

Really like Shell Sink

I stumbled across Shell Sink the other day. It's an appengine app that allows you to capture and tag all of the commands you run from a command prompt. That means that you can synchronize your bash history for several machines, and tag and annotate commands in the web interface.

This is such a great idea. I often find myself looking for some huge complex command that I ran on one machine, to run again sometime later. Of course I could manually search through all of my bash_history files, but then I would have to remember which machine I ran the command on.

Shell Sink allows you to save all of those commands in one place and search for them, so I don't have to worry about where I ran that complex command the next time I need it.

There are a couple of things I wish Shell Sink supported:

  1. Should allow people to delete old commands. If I run a command with some sensitive data on the command line (even though I know I shouldn't) I'd like to be able to delete that command from the Shell Sink history. Shell Sink does give me the option to disable command collection for a time, but I'm afraid that I'll forget to do that.
  2. It should aggregate commands. Right now it just lists your history as it would in a plain text file. It would be great if it actually aggregated your commands so that there is only one entry for 'ls' in my history.
  3. If it aggregates, it would also be great to have a counter for each command. So if I only have one 'ls' entry I can know that I ran it 500 times.

If you are a command line addict, then check out Shell Sink, and let the author know you like it.


Appengine remote_api example on OS X

The appengine team recently published an article on using remote_api, a new feature for accessing your appengine data store from a remote process. In the example they start off with a script that will allow you to get a console into your data store. The code on the site doesn't work as in for Mac OS X.

Below you'll find an updated example that does work for Mac. Basically you have to add the yaml lib directory to the sys.path.

#!/usr/bin/python
import code
import getpass
import os
import sys

DIR_PATH = "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine"

EXTRA_PATHS = [
  DIR_PATH,
  os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
]

sys.path = EXTRA_PATHS + sys.path

from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db

def auth_func():
  return raw_input('Username:'), getpass.getpass('Password:')

if len(sys.argv) < 2:
  print "Usage: %s app_id [host]" % (sys.argv[0],)
app_id = sys.argv[1]
if len(sys.argv) > 2:
  host = sys.argv[2]
else:
  host = '%s.appspot.com' % app_id

remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)

code.interact('App Engine interactive console for %s' % (app_id,), None, locals())

That's all it takes. Hope you find it helpful. I'll also drop a line to the appengine team to let them know about these changes.