This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
options = {} | |
$name = nil | |
$age = nil | |
optparse = OptionParser.new do|opts| | |
opts.on( '-h', '--help', 'Display this screen' ) do | |
puts opts | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "readline" | |
while cmd = Readline.readline(("line ")+"> ", true) | |
puts cmd | |
method, commands,para = cmd.split | |
if method | |
if respond_to?(method) | |
parameter_count = method(method.to_sym).arity | |
puts parameter_count | |
if parameter_count == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'readline' | |
class Commands | |
def banner | |
puts 'This is a banner.' | |
end | |
def loka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'readline' | |
require './lib/trollop' | |
class Commands | |
def banner | |
puts 'This is a banner.' | |
end | |
def name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'net/http' | |
module Request | |
def req_get(url) | |
uri = URI(url) | |
Net::HTTP.start(uri.host, uri.port) do |http| | |
request = Net::HTTP::Get.new uri.request_uri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
selected = 2 # this can be changed anytime . the second of null changed to 2nd beause of this variable | |
total = 10 #total nulls | |
word = ",null" | |
count= word * (total-1) | |
puts "somesite.com/?id=1 null#{count}--" | |
#I want the output as | |
# somesite.com/?id=1 null,2nd,null,null,null,null,null,null,null,null-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
def look | |
puts "this is somthing else to look at but should be end in here " | |
#exit --- I dont want to put a exit here :( help | |
end | |
(1..10).each do |e| | |
puts e | |
if e == 5 | |
print "somthing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require './lib/trollop' | |
opts = Trollop::options do | |
version "test 1.1 " | |
banner <<-EOS | |
This is a sample banner for my test script | |
EOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require './lib/trollop' | |
opts = Trollop::options do | |
version "test 1.1 " | |
banner <<-EOS | |
This is a sample banner for my test script | |
EOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require './lib/trollop' | |
opts = Trollop::options do | |
version "test 1.1 " | |
banner <<-EOS | |
This is a sample banner for my test script | |
EOS |
OlderNewer