Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active December 7, 2022 16:11
Show Gist options
  • Save MichaelDimmitt/8f0d7680d3f84188fd123e7baa3bc26e to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/8f0d7680d3f84188fd123e7baa3bc26e to your computer and use it in GitHub Desktop.
Keep track of time and listen to music!

Keep track of time and listen to music! 🎉

I want to listen to my music from command line,
but I have a meeting in 20 minutes!

timeout 20m pianobar || reset

^ use this one

With the timeout command you can specify: minutes, hours, days, seconds

‘s’ for seconds (the default)
‘m’ for minutes
‘h’ for hours
‘d’ for days

Links

https://stackoverflow.com/a/16436335/5283424
https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html#timeout-invocation

Pro Tip:

This would also be great for teaching yourself to switch tasks.
Instead of spending the entire day on a single item.

Edge Case

timeout 20s pianobar || reset
# reset the terminal if the cursor gets stuck (stdio) after pianobar process is killed.

Command used most often

timeout 20m pianobar || reset
alias pianomin="timeout 20m pianobar; reset"
function pianomin() {
    time=${1:-20};
    ask="timeout ${time}m pianobar; reset";
    echo $ask;
    eval $ask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment