Skip to content

Instantly share code, notes, and snippets.

@sasha1sum
Created October 26, 2013 19:54
Show Gist options
  • Save sasha1sum/7173748 to your computer and use it in GitHub Desktop.
Save sasha1sum/7173748 to your computer and use it in GitHub Desktop.
Simple ruby script to print an audible bell when the battery is low on linux.
#!/usr/bin/ruby
$threshold = 20
/Discharging, (\d+)/.match(`acpi`) do |v|
print "\a" if v[1].to_i < $threshold
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment