Archive for April, 2009

Alt+F2

I just wrote a class in ruby for the backend for the ALT+F2 replacement i’m working on.

here is the class in ruby


#! /usr/bin/ruby
require 'pathname'
class Doer
def initialize
path=ENV['PATH'].to_s.split(":")
@li=""
@cmdlst=[]
@command=Hash.new()
path.each do |indpath|
inpath=Pathname(indpath)
files=inpath.children(false)
files.each do |fls|
testval=FileTest::executable?(File.join(indpath,fls))
if testval
cmdpth=File.join(indpath,fls).to_s
cmd=fls.to_s
@command.store(cmd,cmdpth)
@cmdlst.push(cmd+"\n")
end
end
end
@cmdlst=@cmdlst.join
end
def updatefind(str)
pattern=Regexp.compile("#{str}.*",Regexp::IGNORECASE)
@li=@cmdlst.scan(pattern)
return @li
end
end

You can try it by passing a string to the updatefind function for getting the list of commands similar to the give string.

For eg:
x=Doer.new()
puts x.updatefind(ARGV[0])

if you are passing the string from command line..
Hope ppl find this useful!!
will update soon with the Qt front end as soon i’m done with it. :)

Add comment April 12, 2009


Tags

airtel on linux amarok beryl bluetooth and ubuntu bootloader chainloader compiz compiz fusion cube dual boot evil first look on ubuntu fun gdm gnome grub GUI root install KDE4 lilo linux linux basic software M$ nautilus scripts obex pidgin restore grub root ruby script shipit shutdown su sudo sudo -i time up dude ubuntu vi vim vlc windows windows sucks wvdial zenity zenwalk

 

April 2009
S M T W T F S
« Mar   May »
 1234
567891011
12131415161718
19202122232425
2627282930  

About Me

Cyriac Thomas

A GNU/Linux enthusiast, Amateur Photographer, Design enthusiast who loves simplicity. An active tweeter @cyriacthomas.

RSS Photoblog

My Recent Tweets

Links

Archives

Blog Stats

Flickr Photos

I <3 the web

20032008(026)

20032008(021)

More Photos

del.icio.us/cyriacsmail

Bot Comments ;)