Skip to content

Instantly share code, notes, and snippets.

@leptoquark1
Last active April 13, 2025 15:44
Show Gist options
  • Select an option

  • Save leptoquark1/598c51369a004aa4191814b89c49a61e to your computer and use it in GitHub Desktop.

Select an option

Save leptoquark1/598c51369a004aa4191814b89c49a61e to your computer and use it in GitHub Desktop.
a_zsh_motivator.sh Terminal MOTD
#!/bin/zsh
## A SHELL MOTIVATOR (zsh)
## =======================
## Displays a random greeting and motivation.
##
## Assuredly to guarantee at least one of the following effects*
##
## It may:
## - cheer you up
## - boost your productivity
## - exasperates you
## - heal leukemia
## - be absoulte pointless
## - waste your time
## - call the cops
##
## [*] exception cannot be ruled out
##
## Usage Example:
##
## 1. Run when a new session starts:
## Add `~/.path-to-this-file YourName` at the end of ~/.zshrc
###
## Start Configuration
###
CLEAR_CONSOLE=true
SHOW_UPTIME=true
USE_QUOTES=true
DEFAULT_NAME='David'
## Overwrite the default values
# MOTIVATIONS=()
# SUFFIXES=()
# GREETINGS=()
# COLOR="%F{green}"
## End Configuration
## ===========================
##
## If you want to edit below this line please consider the following points:
##
## - Don't be rude to yourself.
## - Don't spam either.
## - Dare you to brake this peace of garbage. It cost at least an hour of my free time.
###
## Init Variables
###
if [ $# = 1 ]
then NAME=$1
else NAME=${DEFAULT_NAME}
fi
if ! [ -v "$GREETINGS" ]
then GREETINGS=(
"Welcome back ${NAME}"
"Nice to see you ${NAME}.."
"Oh ${NAME}! You're back.. cool cool.."
"Just as I said ${NAME}, this is it.."
"Oh shit, here we go again.."
"Did you hear that too ${NAME}?"
"I remember this place.."
"No time to break the ice ${NAME}.."
"This is just crazy, ${NAME}!"
"Gosh ${NAME}, let's start again.."
"${NAME}, right? I'm just kidding.."
"It's almost done ${NAME}.."
"That's weird ${NAME}, I'm sure I just see you left.."
"Did you just close me ${NAME}?"
"Believe me ${NAME}, this is going to be huge!"
"Just another shell? Ok ${NAME}, do your thing.."
"${NAME}! Your Grace.."
"Well, ${NAME}"
"Take a deep breath! That smell is suspicious ${NAME}.."
"${NAME} Your Highness! The shell shall be yours."
"I just swept ${NAME}, please watch your steps.."
"If you listen very carefully, you can hear the sea from the shell."
)
fi
if ! [ -v "$SUFFIXES" ]
then SUFFIXES=(
''
'¯\\_(ツ)_/¯'
'( ͡° ͜ʖ ͡°)'
'(☞゚ヮ゚)☞'
'ᕕ( ᐛ )ᕗ'
'•ᴗ•'
'ԅ(≖‿≖ԅ)'
'ಠᴗಠ'
'(စ ͜ စ)'
'(𐨨𐭃𐨨)'
'( ^◡^)っ✂╰⋃╯'
'(ง •̀_•́)ง'
'(~‾▿‾)~'
)
fi
if ! [ -v "$MOTIVATIONS" ]
then
if [ "${USE_QUOTES}" ]
then
MOTIVATIONS=(
"When the going gets tough the tough get going."
"Opportunities don’t happen you create them."
"We are what we repeatedly do. Excellence then is not an act but a habit."
"It is during our darkest moments that we must focus to see the light."
"Always make a total effort even when the odds are against you."
"Start where you are. Use what you have. Do what you can."
"Action may not always bring happiness; but there is no happiness without action."
"Success comes from having dreams that are bigger than your fears."
"If you want to lift yourself up lift up someone else."
"The distance between insanity and genius is measured only by success."
"Never do tomorrow what you can do today. Procrastination is the thief of time."
"Don’t spend time beating on a wall hoping to transform it into a door."
"The road to success and the road to failure are almost exactly the same."
"There are far far better things ahead than any we leave behind."
"Remember that not getting what you want is sometimes a wonderful stroke of luck."
"Perfection is boring. Getting better is where all the fun is."
"The future belongs to those who believe in the beauty of their dreams."
"Build your own dreams or someone else will hire you to build theirs."
"Never give up for that is just the place and time that the tide will turn."
"It’s not what you look at that matters it’s what you see."
"It is better to fail in originality than to succeed in imitation."
"Sometimes you win sometimes you learn."
"Don’t be afraid to give up the good to go for the great."
"Don’t let what you cannot do interfere with what you can do."
"Things work out best for those who make the best of how things work out."
"Make sure your worst enemy doesn’t live between your own two ears."
"Life is not about finding yourself. Life is about creating yourself."
"Always remember that you are absolutely unique; just like everyone else."
"You may have to fight a battle more than once to win it."
"If you have everything under control you’re not moving fast enough."
"Nothing will work unless you do."
"One way to keep momentum going is to have constantly greater goals."
"The starting point of all achievement is desire."
"Whatever the mind of man can conceive and believe it can achieve."
"Change your thoughts and you change your world."
"What seems to us as bitter trials are often blessings in disguise."
"Only put off until tomorrow what you are willing to die having left undone."
"What we achieve inwardly will change outer reality."
"We aim above the mark to hit the mark."
"Don’t be pushed by your problems; be led by your dreams."
"You don’t drown by falling in water; you drown by staying there."
"Don’t let the fear of losing be greater than the excitement of winning."
"Don’t judge each day by the harvest you reap but by the seeds that you plant."
"Better to do something imperfectly than to do nothing flawlessly."
"Don’t live the same year 75 times and call it a life."
"We can’t help everyone but everyone can help someone."
"If you’re offered a seat on a rocket ship don’t ask what seat! Just get on."
"Change your life today. Don’t gamble on the future act now without delay."
"I am not a product of my circumstances. I am a product of my decisions."
"When you’ve got something to prove there’s nothing greater than a challenge."
"Keep your eyes on the stars and your feet on the ground."
"Zeal without knowledge is fire without light."
"I find that the harder I work the more luck I seem to have."
"Failure is the condiment that gives success its flavor."
"Throw me to the wolves and I will return leading the pack."
"There are better starters than me but I’m a strong finisher."
"The only place where success comes before work is in the dictionary."
"I would rather die of passion than of boredom."
"Aim for the moon. If you miss you may hit a star."
"If you can dream it you can do it."
"Little minds are tamed and subdued by misfortune; but great minds rise above it."
"Do not wait to strike till the iron is hot; but make it hot by striking."
"Do or do not. There is no try."
"The best way to predict the future is to create it."
"Strive not to be a success but rather to be of value."
"Certain things catch your eye but pursue only those that capture the heart."
"If you want to achieve greatness stop asking for permission."
"A diamond is merely a lump of coal that did well under pressure."
"All men who have achieved great things have been great dreamers."
"Don’t judge each day by the harvest you reap but by the seeds that you plant."
"Dream as if you’ll live forever live as if you’ll die today."
"Winners never quit and quitters never win."
"In a gentle way you can shake the world."
"Nurture your mind with great thoughts. To believe in the heroic makes heroes."
"If you’re going through hell keep going"
"What great thing would you attempt if you knew you could not fail?"
"Do what you have to do until you can do what you want to do."
)
else
MOTIVATIONS=(
'You are awesome!'
"Let's rock!"
'Just do it!'
"It's like watching a Pro!"
'Keep it up!'
'Nice hat pal!'
'Another God at work.'
"I'm proud of you!"
'You look GREAT today!'
'The Hero we need!'
'Destroy the shell!'
'I see! You have the will and the look!'
'Save the day, dude!'
"They've called a better, but you were busy!"
'I like this readiness you exude!'
'Thats what I call willpower!'
'Neat!'
)
fi
fi
if ! [ -v "$COLOR" ]
then COLOR="%F{green}"
fi
## Get random values
###
GREETING=${GREETINGS[$(( $RANDOM % ${#GREETINGS[@]} + 1 ))]}
MOTIVATION=${MOTIVATIONS[$(( $RANDOM % ${#MOTIVATIONS[@]} + 1 ))]}
SUFFIX=${SUFFIXES[$(( $RANDOM % ${#SUFFIXES[@]} + 1 ))]}
## Execution
###
if [ "$CLEAR_CONSOLE" = true ]
then clear;
fi
if [ "$SHOW_UPTIME" = true ]
then
UPTIME="$(uptime | sed -E 's/^[^,]*up *//; s/, *[[:digit:]]* users.*//; s/min/minutes/; s/([[:digit:]]+):0?([[:digit:]]+)/\1 hours and \2 minutes/')"
UPTIME_PROMT="%{\x1b[3m%}The current uptime is ${UPTIME}.%{\x1b[0m%}"
fi
print -P " ${(%)COLOR}>>%f ${GREETING} ${UPTIME_PROMT}"
print -P " ${(%)COLOR}>> ${MOTIVATION}%f ${SUFFIX}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment