Posts Tagged ruby

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

Brainfuck++ Interpreter

Having fun coding on brainfuck and ruby for sometime, here is the result.
Jared Derinsk, had published a white paper on adding features to brainfuck. Having published his white paper for about 3 years (more…)

Add comment March 19, 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

 

November 2009
S M T W T F S
« Oct    
1234567
891011121314
15161718192021
22232425262728
2930  

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 ;)