Compare commits

..

No commits in common. "da0387417b01f581142f886b1a852586fcf5de57" and "4203d6269a910452edbfa090561ca4d05e1320f2" have entirely different histories.

3 changed files with 6 additions and 60 deletions

View File

@ -3,7 +3,7 @@
class ModDate < Worker class ModDate < Worker
def mainloop() def mainloop()
while true do while true do
self.write Time.now.getlocal(@my_config['offset']).strftime(@my_config['format']) self.write Time.now.strftime(@my_config['format'])
sleep(1) sleep(1)
end end
end end

28
mod/gpu
View File

@ -1,28 +0,0 @@
# vim: ft=ruby
class GPU < Worker
require 'open3'
def mainloop()
while true do
Open3.popen2("nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader") {|i,o,t|
gpu_temp = o.gets.to_i
if gpu_temp > @my_config['temp_crit'].to_i
fg_colour = "crit_colour"
elsif gpu_temp > @my_config['temp_warn'].to_i
fg_colour = "warn_colour"
else
fg_colour = "ok_colour"
end
rstr = "%%{FC{%s}}%s%%{F-}" % [ fg_colour, gpu_temp ]
self.write(rstr)
}
sleep(1)
end
end
end
Modules.add("gpu", "GPU")

View File

@ -1,26 +0,0 @@
# vim: ft=ruby
class GPU2 < Worker
def mainloop()
IO.popen("nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader -l 3") do |pipe|
pipe.each do |line|
line.chomp!
t = line.to_i
if t > @my_config['temp_crit'].to_i
fg_colour = "crit_colour"
elsif t > @my_config['temp_warn'].to_i
fg_colour = "warn_colour"
else
fg_colour = "ok_colour"
end
rstr = "%%{FC{%s}}%s%%{F-}" % [ fg_colour, t ]
self.write(rstr)
end
end
end
end
Modules.add("gpu2", "GPU2")