Skip to content

Instantly share code, notes, and snippets.

@trshafer
Created April 13, 2011 23:54
Show Gist options
  • Save trshafer/918672 to your computer and use it in GitHub Desktop.
Save trshafer/918672 to your computer and use it in GitHub Desktop.
kills teleport and runs the same command again. essentially it kicks people from you
Put this in an automator service as described by
http://blog.fosketts.net/2010/08/09/assign-keyboard-shortcut-applescript-automator-service/
# begin
teleport = `ps -e -f | grep [t]eleport.prefPane`
original_teleport = teleport.split("\n")[0]
File.open('/Users/change/teleport_command.txt', 'w') {|f| f.write("#{original_teleport}\n") }
return if original_teleport == nil
original_teleport = original_teleport.split(' ')
teleport_command = original_teleport[original_teleport.length-2..-1].join(' ') + ' &'
File.open('/Users/change/teleport_command.txt', 'a') {|f| f.write("#{teleport_command}\n") }
x = system("kill -9 #{original_teleport[1]}")
system("#{teleport_command}")
# rescue Exception => e
# File.open('/Users/change/teleport_command.txt', 'a') {|f| f.write("#{e}\n") }
# end
@trshafer
Copy link
Author

I should do this in a shell script. But I know ruby. Everything is a nail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment