Last active
August 29, 2015 14:04
-
-
Save romainfrancois/c304c1a59c6d73e9b658 to your computer and use it in GitHub Desktop.
mario beep on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The code below will probably only work on Linux and requires VLC on the path. | |
library(beepr) | |
library(stringr) | |
play_vlc <- function(fname) { | |
system(paste("open -a vlc --args --no-loop --no-repeat --playlist-autostart --no-media-library", fname), | |
ignore.stdout = TRUE, ignore.stderr=TRUE,wait = FALSE) | |
} | |
# Plays the mario theme while expr is executing, plays the flag pole jingle when the execution have finished. | |
# The file "main-theme-overworld.mp3" has to be on the path. | |
# It can be downloaded from here: https://dl.dropboxusercontent.com/u/5304231/main-theme-overworld.mp3 | |
mario_beep <- function(expr) { | |
play_vlc( "/tmp/main-theme-overworld.mp3" ) | |
expr | |
system("osascript -e 'tell application \"vlc\" to quit'") | |
beep(8) | |
} | |
# Use it like this: | |
mario_beep(Sys.sleep(10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment