# Email: # ["m", "o", "c", ".", "l", "i", "a", "m", "g", "2", "+", "T", "F", "I", "H", "S", "o", "u", "l", ".", "m", "o", "t"].reverse.join # 2010/03/12 1. Install ruby if you have not done so. $sudo apt-get install ruby 2. Save the following scripts as rrrss.rb #!/usr/bin/ruby # 2010/03/07 # Oscar night require 'rss/2.0' require 'open-uri' def rss(rss_url) 80.times.to_a.each {print '^'} puts open(rss_url) do |http| response = http.read result = RSS::Parser.parse(response, false) puts result.channel.title.reverse 80.times.to_a.each {print '^'} puts result.items.each_with_index do |item,i| if i<=15 then # puts ". #{item.title.split(/ /).reverse.join(" ")}" puts ". #{item.title}" puts " #{item.description}" puts end end end end urls =[] urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml' urls << 'http://rss.cbc.ca/lineup/topstories.xml' urls << 'http://rss.cbc.ca/lineup/canada.xml' urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/technology/rss.xml' urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/health/rss.xml' urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/business/rss.xml' urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/asia-pacific/rss.xml' urls << 'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/uk_news/magazine/rss.xml' urls << 'http://rss.cbc.ca/lineup/canada-calgary.xml' # Add your favorite rss feeds version = (RUBY_VERSION.split(/\./))[1].to_i if version == 8 then u = urls.choice # random choice in 1.8.7 elsif version == 9 then u = urls.sample # random choice in 1.9 end rss(u) unless u.nil? # urls.each {|u| rss(u) } 3. Add the following lines into ~/.vimrc :imap gg dG :nmap gg dG :nmap :r! /home/oracle/my_ruby/news/rrrss.rb :nmap :set rl! 4. vi 5. Press F5 to load a RSS news 6. Press F6 to clean the screen 7. Press F5 to load anoterh RSS new 8. Press F4 to rotate the text when your boss is coming to your desk. Enjoy Tom Luo