"%.3f" % (1.0/7) # "0.143"
"%5.1f" % 345.6789 # "345.7"
"%05d" % 123 # "00123"
"%-5s" % "ID" # "ID "
"%04x" % 0xfc14 # "fc14"
"%6.2f, %05d" % [345.6789,123] # "345.68, 00123"
"%-5s: %04x" % ["ID", 0xfc14] # "ID : fc14"
All hardware and software things including network, system, UI, maintaining tools and the information security field
12/30/2009
11/14/2009
codeploy? It's hard to use it
Recently, I tried to use codeploy to upload my program to many planetlab nodes.
But seeing the setting instruction, it's too inconvenient.
There are too many parameter to set.
So I write a simple ruby script to implement this multiple upload function.
usage: ./multi-upload directly_you_want_to_upload
script:
#! /usr/bin/ruby
arr = IO.readlines("node_list")
arr.each { |x|
puts "node name:#{x.chomp}"
cmd = "scp -r #{ARGV[0]} ACCOUNT@#{x.chomp}:/home/ACCOUNT"
puts `#{cmd}`
}
See, 9 lines code can do the same thing.
Why don't use it?
訂閱:
文章 (Atom)