Skip to content

Instantly share code, notes, and snippets.

@fernandolopez
Last active December 14, 2020 23:52
Show Gist options
  • Save fernandolopez/5010599 to your computer and use it in GitHub Desktop.
Save fernandolopez/5010599 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -n "$RANDOM" ]; then
# Bash
random(){ echo $RANDOM; }
elif which perl; then
random(){ perl -e "print(rand() * (10**15))"; }
elif which openssl; then
random(){ printf "%d" 0x$(openssl rand -hex $(date +%r)); }
else
random(){
python -c "from random import random; print('{0:d}'.format(int(random()*10**15)))"
}
fi
if which aplay; then
play() { aplay "$@"; }
else
play() { mplayer "$@"; }
fi
wget -O /tmp/ding.wav http://www.ctv.es/RECURSOS/SONIDOS/wav/ding.wav > /dev/null 2>&1
while sleep $(expr $(random) % 5); do
play /tmp/ding.wav &
if [ $(expr $(random) % 2) -eq 0 ]; then
zenity --error --title "Error de Windows" --text "Ocurrió el error $(printf "%04x:%04x" $(random) $(random)), el sistema puede quedar inestable.\n\nPor favor, si el problema persiste, contacte con el soporte de Windows para solucionarlo."
else
while zenity --question --title "Error inesperado" --text "Ha ocurrido un error $(printf "%04x:%04x" $(random) $(random)) accediendo a la librería mvc40.dll.\n\n¿Desea volver a intentarlo?"; do
play /tmp/ding.wav &
done
fi
done > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment