5mof tools: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
| Line 32: | Line 32: | ||
convert -size 45x35 \ | convert -size 45x35 \ | ||
-colors 256 -depth 8 \ | -colors 256 -depth 8 \ | ||
-background "$2" -fill white \ | -background "$2" \ | ||
-gravity | -fill white \ | ||
-font Noto-Sans -pointsize | -gravity North \ | ||
-font Noto-Sans -pointsize 16 label:"$1" \ | |||
png:- | pngtopnm - > timer.pnm | png:- | pngtopnm - > timer.pnm | ||
{ cat timer.pnm; \ | { cat timer.pnm; \ | ||
printf "0 0 10\r\n" ; | |||
} | cat > /dev/udp/$HOST/1337 | } | cat > /dev/udp/$HOST/1337 | ||
} | } | ||
| Line 46: | Line 47: | ||
lower () { | lower () { | ||
if [ "$SECS" -eq 0 ]; then | if [ "$SECS" -eq 0 ]; then | ||
if [ "$MINS" -eq 0 ]; then | if [ "$MINS" -eq 0 ]; then | ||
| Line 60: | Line 58: | ||
else | else | ||
SECS="$((SECS - 1))" | SECS="$((SECS - 1))" | ||
fi | |||
if [ "$MINS" -eq 0 ]; then | |||
COLOR=red | |||
fi | fi | ||
} | } | ||
| Line 65: | Line 66: | ||
while true; do | while true; do | ||
printf "%02d:%02d\n" "$MINS" "$SECS" | |||
display $(printf "%02d:%02d" "$MINS" "$SECS") "$COLOR" | display $(printf "%02d:%02d" "$MINS" "$SECS") "$COLOR" | ||
lower | lower | ||
sleep 1 | sleep 1 | ||
done | done | ||
</pre> | </pre> | ||
-lizzie | -lizzie | ||
Revision as of 19:33, 1 December 2016
Tools for use for Five Minutes of Fame
Logo

html 5 timers
- http://hackandtell.org/timer/
flaschentaschen and mary poppins control script
#!/bin/bash
set -e
HOST=localhost
if [ -n "$1" ]; then
HOST="$1"
fi
display () {
convert -size 45x35 \
-colors 256 -depth 8 \
-background "$2" \
-fill white \
-gravity North \
-font Noto-Sans -pointsize 16 label:"$1" \
png:- | pngtopnm - > timer.pnm
{ cat timer.pnm; \
printf "0 0 10\r\n" ;
} | cat > /dev/udp/$HOST/1337
}
MINS=5
SECS=0
COLOR='green'
lower () {
if [ "$SECS" -eq 0 ]; then
if [ "$MINS" -eq 0 ]; then
echo "done!"
curl -XPOST http://pegasus.noise:5000/ -d "text=your five minutes of fame are over"
exit 0
else
MINS="$((MINS - 1))"
SECS=59
fi
else
SECS="$((SECS - 1))"
fi
if [ "$MINS" -eq 0 ]; then
COLOR=red
fi
}
while true; do
printf "%02d:%02d\n" "$MINS" "$SECS"
display $(printf "%02d:%02d" "$MINS" "$SECS") "$COLOR"
lower
sleep 1
done
-lizzie