hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Wiki Shell Scripting for MouseHole #

by why in inspect

A wiki. That stores scripts. Run them from the URL. You have a personal Yubnub. This idea is Jake Donham’s and he dropped in on the MouseHole list a few weeks ago. My incarnation of his script is called MouseCommand.

To give you an idea of what’s possible, a few recipes du jour. For best effect in Firefox, go to about:config and set keyword.URL to http://127.0.0.1:37004/cmd/. Restart Firefox and make sure MouseHole is running and MouseCommand is installed.

del

A simple redirect to a del.icio.us tag.

 location "http://del.icio.us/tag/#{args.join '+'}" 

date

Display the system date and time. Arguments optionally passed into String#strftime.

 if args.empty?
   Time.now.to_s
 else
   Time.now.strftime( args.join( ' ' ) )
 end

url

For debugging. Pass another command in (try: url date or url del ruby) and get a dump of the headers and content generated by that command.

 run( args.join '/' ) rescue nil
 body = "<p>" 
 response.header.map do |k,v|
   body += k + ": " + v + "<br />" 
 end
 body + "</p><pre>#{ response.body }</pre>" 

links

Make a list of links for a given URL.

 body = "<ul>" 
 doc = read_xhtml_from "http://#{ args.join '/' }" 
 doc.each_element( "//a" ) do |link|
   if link.attributes['href']
     body += "<li>#{ link.attributes['href'] }</li>" 
   end
 end
 body + "</ul>" 

If you have MouseCommand setup as keyword.URL, you can also type new shortcut to create a new command with the name shortcut. Also, list all to see your command list and edit shortcut to… you know… (Again, credit goes to Jared. A bunch of useful command ideas is elsewhere.)

said on 22 Sep 2005 at 10:33

This is the darkest and most powerful Voodoo yet!

IA IA RUBY FHTAGHN !

said on 22 Sep 2005 at 14:02

should I do

internet : privoxy : mousehole : firefox

or

internet : mousehole : privoxy : firefox?

said on 23 Sep 2005 at 07:13

Cool stuff! When testing it in Firefox though I noticed that the commands only execute when they are given an argument, otherwise I get a WEBrick “Service Unavailable” error. For example, just typing ‘date’ gets the error, but ‘date %d/%m/%Y’ works fine.

said on 23 Sep 2005 at 15:39

Oh and if you have the gem called Syntax, then the code will be highlighted.

keith23: yeah, firefox doesn’t really do one-word keywords. try typing in keyword:date.

said on 16 Nov 2005 at 06:02

Uuurgh lovethis.

said on 16 Nov 2005 at 06:09

location "http://yubnub.org/parser/parse?command=#{args.join '+'}" 

Well that worked!

Comments are closed for this entry.