-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
c3woc-css.sh
executable file
·42 lines (34 loc) · 1.53 KB
/
c3woc-css.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
echo "$(date) $1" >> /tmp/foo
# Select random line from file using reservoir sampling, first argument should be filename.
function randomLine {
local selectedLine=''
local i=1
while read -r line; do
# If line is empty, ignore.
if [ -z "$line" ]; then
continue
fi
# If selected line is empty, use this
if [ -z "$selectedLine" ]
then
selectedLine=$line
else
# Replace selected Line with probability 1/i
if [ "$(($RANDOM % $i))" -eq "0" ]; then
selectedLine=$line
fi
fi
((i++))
done < "$1"
echo "$selectedLine"
}
# Space toolbox open/close:
if [ $1 = "open" ]; then
echo "#header h1 a.icon:before { color: lime; }" > /var/www/bodensee.space/web/spaceapi/c3woc/space_api.css
echo "#navButton .toggle:before { color: lime; }" >> /var/www/bodensee.space/web/spaceapi/c3woc/space_api.css
echo "#waffel-available, #space-opened { display: blocked; } #no-waffles, #space-closed { display: none; }" > /var/www/bodensee.space/web/spaceapi/c3woc/spacestatus.css
else
echo "#header h1 a.icon:before { color: inherit; }" > /var/www/bodensee.space/web/spaceapi/c3woc/space_api.css
echo "#navButton .toggle:before { color: #fff; }" > /var/www/bodensee.space/web/spaceapi/c3woc/space_api.css
echo "#no-waffles, #space-closed { display: blocked; } #waffel-available, #space-opened { display: none; }" > /var/www/bodensee.space/web/spaceapi/c3woc/spacestatus.css
fi