├── .gitignore ├── LICENSE ├── README.md ├── annoy-a-tron └── scripts ├── dashboard.applescript ├── friday.applescript ├── hide-all.applescript ├── random-mute.sh ├── random-system-sound.py ├── random-time.py ├── right-there.py ├── sleep.applescript ├── spotify-pause.applescript ├── spotify-play-something-annoying.applescript ├── spotify-read-info.applescript └── spotlight.applescript /.gitignore: -------------------------------------------------------------------------------- 1 | # Misc 2 | .DS_Store 3 | 4 | # Python 5 | .pyc 6 | 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | annoy-a-tron 2 | ============ 3 | 4 | I have a co-worker. We'll call him Brian. 5 | 6 | Brian likes to mess with people: practical jokes, sarcastic remarks, playing 7 | dumb, whatever. Lucky for those of us who are subjected to his grief, Brian 8 | leaves his computer unlocked when he walks away from it. Unlucky for Brian, 9 | he works with programmers. 10 | 11 | One day, while Brian was out to lunch, we wrote a script to annoy Brian at 12 | random intervals, and installed it on his computer. This was fun for a while, 13 | but now it's time to step it up. It's time to add the the ability to change 14 | the prank without having to touch his computer, and it's time to get people 15 | outside these walls involved. 16 | 17 | **Update**: _Brian eventually figured out what happened to his computer. A 18 | co-worker narced just as Brian was packing up his computer to return it to 19 | Apple because it was "acting funny". As a result, this project is no longer 20 | being actively developed. Pull requests and issues will be closed without 21 | review._ 22 | 23 | 24 | How it works 25 | ------------ 26 | 27 | Every few minutes, Brian's computer pulls down any updates from this repo. 28 | Additionally, the `annoy-a-tron` script is also run every few minutes, so 29 | changing the annoying behavior is as simple as changing the script called 30 | in `annoy-a-tron`. 31 | 32 | 33 | How you can help 34 | ---------------- 35 | 36 | Fork this repo, add a script that does something annoying, and issue a Pull 37 | Request. The annoying thing your script needs to be simple, funny, appropriate 38 | for a work environment, and cannot be destructive or hateful. Some things that 39 | we've had Brian's computer do so far: 40 | 41 | * Say "Ooo, right there" 42 | * Announce a randomly-generated time 43 | * Play a random system alert sound 44 | * Say "System Updates Available" 45 | * Hide/minimize all windows for currently-open applications 46 | 47 | If you'd like to see what we've done in the past, just dig through the repo and 48 | model your script on one of those. 49 | 50 | 51 | Miscellaneous notes 52 | ------------------- 53 | 54 | 1. Brian uses OS X, so any contribution should work on a stock, non-developer OS X 55 | install. 56 | 2. Scripts can be in any language (provided that language is available on 57 | a stock OS X system), but should stick to that language's standard library 58 | 3. If you shell out to anything in your script, please ensure that utility is 59 | installed on the system by default. 60 | 4. Scripts should include a shebang line, and should be executable. 61 | 5. Scripts should be entirely self-contained. 62 | 6. Any script that is destructive, racist, sexist, homophobic, transphobic, or 63 | deemed by me to be shitty will be rejected. 64 | 65 | 66 | LICENSE 67 | ------- 68 | 69 | See the included `LICENSE` file for more information, but in short: consider 70 | this repo a public service for anyone that has a co-worker like Brian. 71 | Hopefully your Brian also leaves his/her computer unlocked. 72 | 73 | -------------------------------------------------------------------------------- /annoy-a-tron: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import random 5 | import datetime 6 | import subprocess 7 | 8 | BASE_PATH = os.path.abspath(os.path.dirname(__file__)) 9 | SCRIPTS_DIR = os.path.join(BASE_PATH, 'scripts') 10 | SCRIPTS = filter(lambda x: not x.startswith('friday'), os.listdir(SCRIPTS_DIR)) 11 | 12 | def should_play_friday(): 13 | now = datetime.datetime.now() 14 | return now.isoweekday() == 5 and 10 < now.hour < 15 and now.minute == 0 15 | 16 | 17 | # If it's Friday, and top of the hour, then maybe we play some Rebecca Black? 18 | if should_play_friday() and random.randrange(0, 100) < 51: 19 | subprocess.call([os.path.join(BASE_PATH, 'scripts', 'friday.applescript')]) 20 | 21 | elif random.randrange(0, 100) < 5: 22 | random_script = random.choice(SCRIPTS) 23 | subprocess.call([os.path.join(BASE_PATH, 'scripts', random_script)]) 24 | 25 | -------------------------------------------------------------------------------- /scripts/dashboard.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "Dashboard" to launch 4 | delay 2 5 | tell application "Finder" to activate 6 | -------------------------------------------------------------------------------- /scripts/friday.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "Spotify" 4 | activate 5 | play track "spotify:track:4fK6E2UywZTJIa5kWnCD6x" 6 | end tell 7 | -------------------------------------------------------------------------------- /scripts/hide-all.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "System Events" 4 | keystroke "h" using {option down, command down} 5 | keystroke "m" using command down 6 | end tell 7 | -------------------------------------------------------------------------------- /scripts/random-mute.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | VOLUME=$(osascript -e "output volume of (get volume settings)") 4 | DELAY=$(expr $RANDOM % 4) 5 | 6 | osascript -e 'set volume 0' 7 | sleep $DELAY 8 | osascript -e "set volume output volume $VOLUME" 9 | -------------------------------------------------------------------------------- /scripts/random-system-sound.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import random 5 | import subprocess 6 | 7 | SOUNDS_DIR = '/System/Library/Sounds' 8 | SOUNDS = os.listdir(SOUNDS_DIR) 9 | REPEAT = random.choice(range(1, 4)) 10 | 11 | to_play = os.path.join(SOUNDS_DIR, random.choice(SOUNDS)) 12 | for x in range(REPEAT): 13 | subprocess.call(['afplay', '-v', str(random.choice(range(10, 51))), to_play]) 14 | 15 | -------------------------------------------------------------------------------- /scripts/random-time.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import random 4 | import subprocess 5 | 6 | HOURS = range(1, 13) 7 | MINUTES = ["o'clock"] + ["o %s" % x for x in range(1, 10)] + range(10, 60) 8 | AM_PM = ['a.m.', 'p.m.'] 9 | TIME = 'it is now {} {} {}'.format(random.choice(HOURS), 10 | random.choice(MINUTES), 11 | random.choice(AM_PM)) 12 | 13 | subprocess.call(['say', '-v', 'Alex', TIME]) 14 | -------------------------------------------------------------------------------- /scripts/right-there.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import random 4 | import subprocess 5 | 6 | VOICES = ['Victoria', 'Alex'] 7 | subprocess.call(['say', '-v', random.choice(VOICES), 'Ooo right there.']) 8 | 9 | -------------------------------------------------------------------------------- /scripts/sleep.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "Finder" to sleep 4 | 5 | -------------------------------------------------------------------------------- /scripts/spotify-pause.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | set num to (random number from 1 to 5) 4 | 5 | tell application "Spotify" 6 | set playerState to player state as string 7 | if (playerState is equal to "playing") then 8 | pause 9 | delay num 10 | play 11 | end if 12 | end tell 13 | 14 | -------------------------------------------------------------------------------- /scripts/spotify-play-something-annoying.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | set songList to { "spotify:track:24CXuh2WNpgeSYUOvz14jk", "spotify:track:6JEK0CvvjDjjMUBFoXShNZ", "spotify:track:0YYbQESOOReEZjVzbYJtMC", "spotify:track:2ZCTP54O2dMSbVrdsg60to", "spotify:track:6DCiwnk5QDEGIjXBFFJ14V", "spotify:track:03UrZgTINDqvnUMbbIMhql", "spotify:track:1Je1IMUlBXcx1Fz0WE7oPT", "spotify:track:3MjUtNVVq3C8Fn0MP3zhXa", "spotify:track:08VeSelC8QYD1MIsK9gAmY", "spotify:track:7jQBORjiir0pNSKGaHevq9", "spotify:track:1iJugqnq6VZjtDFQS89hRL", "spotify:track:2WZ1DjMEANu4zN3ww3NmkY", "spotify:track:5YScXJKtefsgdskIy60N7A", "spotify:track:66S14BkJDxgkYxLl5DCqOz", "spotify:track:2WElktskrNJEwgpp5Vouxk" } 4 | 5 | tell application "Spotify" 6 | set playerState to player state as string 7 | if (playerState is equal to "playing") then 8 | set theSong to some item of songList 9 | play track theSong 10 | end if 11 | end tell 12 | -------------------------------------------------------------------------------- /scripts/spotify-read-info.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "Spotify" 4 | set playerState to player state as string 5 | if (playerState is equal to "playing") then 6 | set currentTrack to name of current track as string 7 | set currentArtist to artist of current track as string 8 | 9 | pause 10 | say "now playing: " & currentTrack & " by " & currentArtist 11 | play 12 | end if 13 | end tell 14 | -------------------------------------------------------------------------------- /scripts/spotlight.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript 2 | 3 | tell application "System Events" 4 | keystroke space using {command down} 5 | end tell 6 | 7 | --------------------------------------------------------------------------------