Last active
January 31, 2022 10:12
-
-
Save Thesola10/b98be96a1a60dfad43ef7bd16a72b02c to your computer and use it in GitHub Desktop.
(in)elegant weapons, for a more civilized age.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WebRoulette by Karim Vergnes <me@thesola.io> | |
# License: WTFPL 1.0 | |
# Requires xdg-open and a web browser to work. | |
# Location of the sitefile | |
: ${LIST:="$HOME/.sitefile"} | |
# Time interval for sleep | |
: ${SLEEP_INT:="20-300"} | |
sleepstep=0 | |
while true | |
do | |
if [[ -f $LIST ]] | |
then | |
(xdg-open $(shuf $LIST -n 1) &) | |
else | |
echo "sitefile not found, using uroulette.com fallback..." | |
(xdg-open "http://www.uroulette.com/visit/snrtq" &) | |
fi | |
sleepstep=$(shuf -i $SLEEP_INT -n 1) | |
echo "Sleeping for $sleepstep seconds..." | |
sleep $sleepstep | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The format for the
~/.sitefile
file is very simple: One URL per line.webroulette
will pick one of the lines at random, and feed it intoxdg-open
, essentially opening them on your favourite browser.