-
-
Save bashbunni/3880e4194e3f800c4c494de286ebc1d7 to your computer and use it in GitHub Desktop.
# study stream aliases | |
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro | |
declare -A pomo_options | |
pomo_options["work"]="45" | |
pomo_options["break"]="10" | |
pomodoro () { | |
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then | |
val=$1 | |
echo $val | lolcat | |
timer ${pomo_options["$val"]}m | |
spd-say "'$val' session done" | |
fi | |
} | |
alias wo="pomodoro 'work'" | |
alias br="pomodoro 'break'" |
This one for Fish
🐟 users
function pomodoro
echo $argv[1] | lolcat
timer "$argv[2]"m
spd-say "'$argv[1]' session done"
end
alias po="pomodoro"
alias wo="pomodoro work 45"
alias br="pomodoro break 10"
Hey! Can someone please explain how exactly to run it?
Hey! Can someone please explain how exactly to run it?
If you have zsh
you have to find your .zshrc
file in your home directory, open it with a text editor and paste the code at the bottom.
Thank you. Yes, this is what I did, I copied the code at the bottom of it, saved it and closed it.
But if I wanted to run 'work' or 'break' I got the error message: command not found.
Thank you. Yes, this is what I did, I copied the code at the bottom of it, saved it and closed it. But if I wanted to run 'work' or 'break' I got the error message: command not found.
did you try running it with wo
and br
?
Yes, but unfortunately I got the same errors:
zsh: command not found: wo
zsh: command not found: br
Yes, but unfortunately I got the same errors: zsh: command not found: wo zsh: command not found: br
Things you can try:
- Close your terminal and open it again, as the changes may not take effect until the terminal is restarted.
- Ensure that you have installed all necessary dependencies, such as timer, lolcat, and spd-say.
- Verify that the code you pasted is complete.
- Restart your system to see if that resolves the issue.
- Reinstall zsh and paste the code again.
- Realize that you were using Windows all along.
- Fall into despair and cry in the shower.
- Someone in the future will help you by posting the solution here. (happy ending)
Except the last 3 points I did everyhing and now it is working with 'wo' and 'br'.
Thank you for your help!
Use with:
./timer.sh work 10
./timer.sh break 10
Will be set in minutes.
Quick install instructions for debian:
sudo apt-get install lolcat
echo 'deb [trusted=yes] https://repo.caarlos0.dev/apt/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list
sudo apt update
sudo apt install timer
#!/bin/bash
clear
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1
if [ -z "$2" ]; then
minutes=${pomo_options["$val"]}
else
minutes=$2
fi
echo $val | lolcat
timer $minutes"m"
spd-say "'$val' session done"
else
echo "Usage: pomodoro <work|break> [minutes]"
fi
}
if [ "$1" == "work" ]; then
pomodoro "work" "$2"
elif [ "$1" == "break" ]; then
pomodoro "break" "$2"
else
echo "Usage: ./timer.sh <work|break> [minutes]"
fi
#Make sure to install https://github.com/caarlos0/timer
#And make sure to have lolcat installed```
So simple yet very useful, thank you! 💪🏻
I added some artificial intelligense neural network framework library laser surgery hack scripting hackerman logic to this:
# study stream aliases
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1
clear
echo $val | lolcat
timer ${pomo_options["$val"]}m
spd-say "'$val' session done"
fi
}
alias wo="pomodoro 'work'"
alias br="pomodoro 'break'"
which improves it by 405.33 (repeating of course) %
This is quite good.
Also, a suggestion of mine is that it would be nice if we can add like a "TODO" list along with it.
For those that use
bash
-shell instead of thezsh
-shell, here is a quick'n'dirty modification to the script.(Added an
Emacs
timer to it to avoid unlimited fiddling with myEmacs
-config for obvious reasons.)