This file contains 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# first part, get temperature | |
temp_str = `aticonfig --adapter=0 --od-gettemperature` | |
temp = temp_str.scan(/Sensor 0: Temperature - (\d+\.\d+) C/)[0][0].to_i | |
# determine fan speed | |
thresholds = [ 40, 60, 70, 80, 85 ] | |
speeds = [ 10, 25, 30, 35, 50 ] |
This file contains 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
a = [1,2,3,4,5,6] | |
i = -1 | |
while current = a[i+=1] do | |
prev_one = i==0 ? nil : a[i-1] | |
next_one = a[i+1] | |
#insert before without iterating over it | |
if current == 3 then |
This file contains 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
#!/usr/bin/env ruby | |
#ln -s $PWD/ifwatch /usr/local/bin/ | |
LIMITS = { | |
red: 30*1024**2, | |
yellow: 20*1024**2, | |
green: 0 | |
} |
This file contains 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
describe 'describe 1' do | |
before(:all) do | |
puts '1: before all' | |
end | |
before(:each) do | |
puts '1: before each' | |
end | |
after(:each) do |