#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Ruby+Haiku # Check the page for copyright notice and explanations open('output.txt','w').puts(open('input.txt').sort) def qsort(list) return [] if list.size == 0 x, *xs = list less, more = xs.partition{|y| y < x} qsort(less) + [x] + qsort(more) end def qs(l) return [] if (x,*xs=l).empty? less, more = xs.partition{|y| y < x} qs(less) + [x] + qs(more) end require 'socket' addr,sport,eport=ARGV[0],ARGV[1].to_i,ARGV[2].to_i puts "porte aperte:" sport.upto(eport) {|x| puts x if (TCPSocket.new (addr,x) rescue false) } require 'socket' server = TCPServer.open(1234) while true Thread.start(server.accept) do |s| s.puts(s.gets) end end require 'webrick' include WEBrick s = HTTPServer.new( :Port => 2000, :DocumentRoot => "/" ) s.mount("/nomedir", HTTPServlet::FileHandler, 'lamia_dir',true) s.start require 'net/http' input = Net::HTTP.get "it.finance.yahoo.com", "/d/quotes.csv?s=EURUSD=X&f=sl1d1t1c1ohgv" a,b,c,d,e=input.split(/;/) puts "EUR/USD: #{b} (#{e}, #{d})" regex = /#{ARGV.shift}/ ARGF.each { |line| puts line if regex.match(line) } ruby -r md5 -e "puts MD5.new(File.open('filename').read).hexdigest" require 'sdl' SDL.init( SDL::INIT_CDROM ) (Cd=SDL::CD.open(0)).status def play(trk) Cd.playTracks(trk,0,0,0) end def stop Cd.stop end ruby -rwebrick -e 'WEBrick::HTTPServer.new(:DocumentRoot=>".").start' puts ARGV[0].tr('[a-zA-Z]', '[n-za-mN-ZA-M]') if ARGV[0] or raise "No string passed"