Skip to content

Instantly share code, notes, and snippets.

@thibaultcha
Last active December 19, 2015 18:28
Show Gist options
  • Save thibaultcha/5998651 to your computer and use it in GitHub Desktop.
Save thibaultcha/5998651 to your computer and use it in GitHub Desktop.
Bash function to prevent your Mac from sleeping for X hours. Put it in your .bash_profile and call it maybe.
function coffee() {
hours=${1}
time=$(( $hours*3600 ))
echo "Will prevent sleeping for $hours hours."
$(caffeinate -u -t "$time")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment