Skip to content

Instantly share code, notes, and snippets.

@jwelshiv
Created March 25, 2013 20:07
Show Gist options
  • Save jwelshiv/5240230 to your computer and use it in GitHub Desktop.
Save jwelshiv/5240230 to your computer and use it in GitHub Desktop.
Tail heroku logs and make sound when match found
#!/usr/bin/ruby
# brew install portaudio
# gem install bloopsaphone
require 'bloops'
# the bloops o' phone
bloops = Bloops.new
bloops.tempo = 150
# beats
simpsons = bloops.sound Bloops::SQUARE
# Simpsons
bloops.tune simpsons, "32 + C E F# 8:A G E C - 8:A 8:F# 8:F# 8:F# 2:G"
input = ARGV[0] || 'heroku logs --tail --app dev-instacanvas'
matcher = ARGV[1] || '/my-cart/complete'
IO.popen(input) do |io|
io.each do |out|
if out.match matcher
bloops.play
puts out
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment