C
CrazedNerd
Guest
Sometimes google being good at predicting what you want to find is kind of boring and un-adventurous, this script randomizes a set of options based on time, and makes it a little less predictable by putting the potential websites you have in the slot in reverse order based on whether your last system clock digit is even or odd...it's practical if you want to look at familiar/regularly-updated websites from a different perspective...just use this to get a website without getting useless error messages from firefox:
...in place of "echo slot _____"
A special thanks to @sphen, @dos2unix, and @KGIII for helping me figure this out:
In hundreds of years, you will need to change it to "cut -c 11", because it will have been 10's of billions of seconds since the dawn of unix instead of a mere billions of seconds...
EDIT:
Oops! Above is logically wrong....
ACTUALLY, the even odd thing doesn't make any sense because you make it impossible to hit 9 and 7....it's better to just use a factor of 10 for ten options:
You could also use combinations of the last number of seconds to produce more possibilities (adding/multiplying/dividing the last two numbers), you would just keep adding more tests for possibilities...i just think that practical and fun and basically the same...
Code:
firefox <URL> &> /dev/null/ &
...in place of "echo slot _____"
A special thanks to @sphen, @dos2unix, and @KGIII for helping me figure this out:
Code:
#!/bin/bash
#if your total outcomes are less that 10, then subtract from digit:
#for example: modified=$(d-1) if you only want to display 9 options
now=$(date +%s)
eo=$((now%2))
d=$(echo $now | cut -c 10)
if [ "$eo" = 1 ]; then
case $d in
0)
echo "Slot 1"
exit 0
;;
1)
echo "Slot 2"
exit 0
;;
2)
echo "Slot 3"
exit 0
;;
3)
echo "Slot 4"
exit 0
;;
4)
echo "Slot 5"
exit 0
;;
5)
echo "Slot 6"
exit 0
;;
6)
echo "Slot 7"
exit 0
;;
7)
echo "Slot 8"
exit 0
;;
8)
echo "Slot 9"
exit 0
;;
*) echo "Slot 1"0
exit 0
;;
esac
else
case $d in
0)
echo "Slot 9"
exit 0
;;
1)
echo "Slot 8"
exit 0
;;
2)
echo "Slot 7"
exit 0
;;
3)
echo "Slot 6"
exit 0
;;
4)
echo "Slot 5"
exit 0
;;
5)
echo "Slot 4"
exit 0
;;
6)
echo "Slot 3"
exit 0
;;
7)
echo "Slot 2"
exit 0
;;
8)
echo "Slot 1"
exit 0
;;
*) echo "Slot 0"
exit 0
;;
esac
fi
In hundreds of years, you will need to change it to "cut -c 11", because it will have been 10's of billions of seconds since the dawn of unix instead of a mere billions of seconds...
EDIT:
Oops! Above is logically wrong....
ACTUALLY, the even odd thing doesn't make any sense because you make it impossible to hit 9 and 7....it's better to just use a factor of 10 for ten options:
Code:
#!/bin/bash
now=$(date +%s)
d=$(echo $now | cut -c 10)
case $d in
0)
echo "Slot 1"
exit 0
;;
1)
echo "Slot 2"
exit 0
;;
2)
echo "Slot 3"
exit 0
;;
3)
echo "Slot 4"
exit 0
;;
4)
echo "Slot 5"
exit 0
;;
5)
echo "Slot 6"
exit 0
;;
6)
echo "Slot 7"
exit 0
;;
7)
echo "Slot 8"
exit 0
;;
8)
echo "Slot 9"
exit 0
;;
*) echo "Slot 10"
exit 0
;;
esac
You could also use combinations of the last number of seconds to produce more possibilities (adding/multiplying/dividing the last two numbers), you would just keep adding more tests for possibilities...i just think that practical and fun and basically the same...
Last edited by a moderator: