Created
May 21, 2018 15:28
-
-
Save rgaufman/85a1d98dc7365f04b5049a49a6cf71c9 to your computer and use it in GitHub Desktop.
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
irb(main):001:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s/).map do |i| | |
irb(main):002:1* i.match(/([0-9]*(\.|\,)[0-9]*)/).captures[0].to_f | |
irb(main):003:1> end | |
=> [0.2, 1.8, 11.5, 86.4, 0.0, 0.0, 0.1, 0.0] | |
irb(main):004:0> `sudo top -bn2 | sed -n '/Cpu/p' | tail -n 1`.strip.split(/,\s*/).map do |i| | |
irb(main):005:1* i.match(/([0-9]*\.[0-9]*)/).captures[0].to_f | |
irb(main):006:1> end | |
=> [0.1, 1.8, 11.8, 85.6, 0.8, 0.0, 0.1, 0.0] | |
irb(main):007:0> `cat /etc/issue` | |
=> "Ubuntu 16.04 LTS \\n \\l\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment