This file contains hidden or 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
require 'net/ssh' | |
print "Enter host: " | |
host=gets.chomp | |
print "Enter username: " | |
user=gets.chomp | |
print "Enter password: " | |
password=gets.chomp | |
Net::SSH.start(host, user, :password => password) do |ssh| |
This file contains hidden or 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
require 'pp' | |
a=[1,[2,[3]],4,5,[6,7,[8,9]]] | |
pp a.inject([]){|b,x| if Array===x then x.each {|y| b << y } else b << x end;b;} |
This file contains hidden or 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
"It's your own choosing," said the man with the withered arm once more. | |
I heard the faint sound of a stick and a shambling step on the flags in | |
the passage outside. The door creaked on its hinges as a second old man | |
entered, more bent, more wrinkled, more aged even than the first. He | |
supported himself by the help of a crutch, his eyes were covered by | |
a shade, and his lower lip, half averted, hung pale and pink from his | |
decaying yellow teeth. He made straight for an armchair on the opposite | |
side of the table, sat down clumsily, and began to cough. The man with | |
the withered hand gave the newcomer a short glance of positive dislike; |
This file contains hidden or 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
require 'sqlite3' | |
require 'active_record' | |
db = SQLite3::Database.new ('demo.db') | |
db.execute('DROP TABLE IF EXISTS demos') | |
db.execute('CREATE TABLE demos ( id TEXT PRIMARY KEY, data TEXT)') | |
ActiveRecord::Base.logger = Logger.new(File.open('database.log', 'a')) | |
ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', | |
:database => 'demo.db') | |
db.close |
NewerOlder