Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@youpy
Created July 19, 2012 11:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youpy/3143389 to your computer and use it in GitHub Desktop.
Save youpy/3143389 to your computer and use it in GitHub Desktop.
# noisy_typer.rb ~/Downloads/hammerhead_drum_sounds/*909*.wav
require "mac-event-monitor"
require "shellwords"
class NoisyTyper
def initialize(files)
@files = files
end
def monitor
m = Mac::EventMonitor::Monitor.new
m.add_listener(:key_down) do |e|
system("afplay %s &" % Shellwords.escape(@files[e.keycode % @files.size]))
end
m.run
end
end
def main
nt = NoisyTyper.new(ARGV)
nt.monitor
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment