Skip to content

Instantly share code, notes, and snippets.

@Thesola10
Last active January 31, 2022 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thesola10/b98be96a1a60dfad43ef7bd16a72b02c to your computer and use it in GitHub Desktop.
Save Thesola10/b98be96a1a60dfad43ef7bd16a72b02c to your computer and use it in GitHub Desktop.
(in)elegant weapons, for a more civilized age.
#!/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
@Thesola10
Copy link
Author

Thesola10 commented Feb 18, 2019

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 into xdg-open, essentially opening them on your favourite browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment