Guest User

Untitled

a guest
May 26th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. irb(main):001:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s/).map do |i|
  2. irb(main):002:1* i.match(/([0-9]*(\.|\,)[0-9]*)/).captures[0].to_f
  3. irb(main):003:1> end
  4. => [0.2, 1.8, 11.5, 86.4, 0.0, 0.0, 0.1, 0.0]
  5. irb(main):004:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s*/).map do |i|
  6. irb(main):005:1* i.match(/([0-9]*\.[0-9]*)/).captures[0].to_f
  7. irb(main):006:1> end
  8. => [0.1, 1.8, 11.8, 85.6, 0.8, 0.0, 0.1, 0.0]
  9. irb(main):007:0> `cat /etc/issue`
  10. => "Ubuntu 16.04 LTS \\n \\l\n\n"
Add Comment
Please, Sign In to add comment