Musings of an aging computer nerd hitting 0x32
Articles

read more
Autumn leaves

Autumn leaves via Instagram instagr.am/p/RNWdDkN-rI/ October 25, 2012 at 03:27PM http://flic.kr/p/dnHTFn, October 25, 2012 at 04:27PM
Articles

read more
Moth other side
Note: 1 of this post’s 2 links is now broken — mostly deleted or made-private Flickr photos, dead Flickr
farmNsubdomains, and defunct feed-syndication infrastructure. Left as originally published.

Moth other side via Instagram instagr.am/p/RNQG1Vt-m-/ October 25, 2012 at 02:31PM http://flic.kr/p/dnHRFQ, October 25, 2012 at 04:17PM
Articles

read more
Moth

Moth via Instagram instagr.am/p/RNOYYWt-mK/ October 25, 2012 at 02:16PM http://flic.kr/p/dnHano, October 25, 2012 at 03:16PM
Articles
read more
Bashing about the command line
Sometimes the best solution is the quickest one, sure I could have written a Ruby script to format the results of the find but a few bash commands achieved the same result.
Doodle's Geek Monkey by Alastair Montgomery
find
/svn/repos -name "authz" -exec grep dev {} ";" | grep -v
@dev | cut -d"=" -f 2|sed 's/,/\n/g'|sed 's/ //g'|sort|uniq >
/tmp/dev.txt
Doodle's Geek Monkey by Alastair Montgomery
Articles

read more
Happy cat
Note: 1 of this post’s 2 links is now broken — mostly deleted or made-private Flickr photos, dead Flickr
farmNsubdomains, and defunct feed-syndication infrastructure. Left as originally published.

Happy cat via Instagram instagr.am/p/RIyaIit-rR/ October 23, 2012 at 08:55PM http://flic.kr/p/dngZ99, October 23, 2012 at 10:29PM
Articles
Doing a lot of work on remote Linux servers lately, lots of login in over SSH running commands logging out.
So wrote this simple script to use Ruby to send a single command or a file of commands to a Linux server over SSH. Needs some error trapping etc but functional at the moment.
It requires the Ruby Gem net-ssh installed.
#!/usr/bin/ruby
require 'rubygems'
require 'net/ssh'
require 'optparse'
opts = OptionParser.new
opts.on("-h HOSTNAME", "--hostname NAME", String, "Hostname of Server") { |v| @hostname = v }
opts.on("-u SSH USERNAME", "--username SSH USERNAME", String, "SSH Username of Server") { |v| @username = v }
opts.on("-p SSH PASSWORD", "--password SSH PASSWORD", String, "SSH Password of Server") { |v| @password = v }
opts.on("-c SHELL_COMMAND", "--command SHELL_COMMAND", String, "Shell Command to Execute") { |v| @cmd = v }
opts.on("-f FILE_COMMAND", "--command FILE_COMMAND", String, "File containing shell Commands to Execute") { |v| @fileCmd = v }
begin
opts.parse!(ARGV)
rescue OptionParser::ParseError => e
puts e
end
raise OptionParser::MissingArgument, "Hostname [-h]" if @hostname.nil?
raise OptionParser::MissingArgument, "SSH Username [-u]" if @username.nil?
raise OptionParser::MissingArgument, "SSH Password [-p]" if @password.nil?
raise OptionParser::MissingArgument, "Command to Execute [-c/-f]" if @cmd.nil? and @fileCmd.nil?
begin
ssh = Net::SSH.start(@hostname, @username, :password => @password)
if @cmd != nil then
ssh.exec!(@cmd) do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
else
puts "Processing file #{@fileCmd}"
file = File.new(@fileCmd, "r")
file.each {|line|
ssh.exec!(line) do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
}
file.close
end
ssh.close
rescue Exception => e
puts "Unable to connect to #{@hostname} using #{@username}/#{@password}"
puts e
end
Doodle's Geek Monkey by Alastair Montgomery
read more
Using Ruby to send commands over SSH
Doing a lot of work on remote Linux servers lately, lots of login in over SSH running commands logging out.
So wrote this simple script to use Ruby to send a single command or a file of commands to a Linux server over SSH. Needs some error trapping etc but functional at the moment.
It requires the Ruby Gem net-ssh installed.
#!/usr/bin/ruby
require 'rubygems'
require 'net/ssh'
require 'optparse'
opts = OptionParser.new
opts.on("-h HOSTNAME", "--hostname NAME", String, "Hostname of Server") { |v| @hostname = v }
opts.on("-u SSH USERNAME", "--username SSH USERNAME", String, "SSH Username of Server") { |v| @username = v }
opts.on("-p SSH PASSWORD", "--password SSH PASSWORD", String, "SSH Password of Server") { |v| @password = v }
opts.on("-c SHELL_COMMAND", "--command SHELL_COMMAND", String, "Shell Command to Execute") { |v| @cmd = v }
opts.on("-f FILE_COMMAND", "--command FILE_COMMAND", String, "File containing shell Commands to Execute") { |v| @fileCmd = v }
begin
opts.parse!(ARGV)
rescue OptionParser::ParseError => e
puts e
end
raise OptionParser::MissingArgument, "Hostname [-h]" if @hostname.nil?
raise OptionParser::MissingArgument, "SSH Username [-u]" if @username.nil?
raise OptionParser::MissingArgument, "SSH Password [-p]" if @password.nil?
raise OptionParser::MissingArgument, "Command to Execute [-c/-f]" if @cmd.nil? and @fileCmd.nil?
begin
ssh = Net::SSH.start(@hostname, @username, :password => @password)
if @cmd != nil then
ssh.exec!(@cmd) do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
else
puts "Processing file #{@fileCmd}"
file = File.new(@fileCmd, "r")
file.each {|line|
ssh.exec!(line) do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
}
file.close
end
ssh.close
rescue Exception => e
puts "Unable to connect to #{@hostname} using #{@username}/#{@password}"
puts e
end
Doodle's Geek Monkey by Alastair Montgomery
Articles

read more
2012-10-20_20-54-05_170_Polak_Clip_Fountains_Abbey

Fountains Abbey at Night Upload from Dropbox October 23, 2012 at 11:43AM http://flic.kr/p/dnafHt, October 23, 2012 at 12:39PM
Articles

read more
Keeping awake #coffee

Keeping awake #coffee via Instagram instagr.am/p/RFfVKMt-nl/ October 22, 2012 at 02:10PM http://flic.kr/p/dmSTrJ, October 22, 2012 at 03:11PM
Articles

read more
Sleepy #dog

Sleepy #dog via Instagram instagr.am/p/RCXERct-tM/ October 21, 2012 at 09:00AM http://flic.kr/p/dmtbEv, October 21, 2012 at 10:01AM
Articles

read more
Fountains Abbey
Note: 1 of this post’s 2 links is now broken — mostly deleted or made-private Flickr photos, dead Flickr
farmNsubdomains, and defunct feed-syndication infrastructure. Left as originally published.

Fountains Abbey via Instagram instagr.am/p/RBVFaBN-iW/ October 20, 2012 at 11:24PM http://flic.kr/p/dmn227, October 21, 2012 at 12:24AM