Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created February 4, 2009 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/58108 to your computer and use it in GitHub Desktop.
Save metaskills/58108 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
APPS = ['Address Book','Calculator','Dictionary','DVD Player','Font Book','iCal','QuickTime Player','Safari']
UTILS = ['Activity Monitor','Console','Disk Utility','Network Utility']
def launch_app(app)
puts "Launch: #{app}"
`open /Applications/#{app.sub(' ','\ ')}.app`
end
def launch_util(util)
puts "Launch: #{util}"
`open /Applications/Utilities/#{util.sub(' ','\ ')}.app`
end
def launch_apps
APPS.each { |app| launch_app(app) }
UTILS.each { |util| launch_util(util) }
end
def kill(app)
puts "Kill: #{app}"
`killall "#{app}"`
end
def kill_apps
APPS.each { |app| kill(app) }
UTILS.each { |util| kill(util) }
end
10_000.times do |n|
launch_apps
sleep(5)
kill_apps
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment