Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

DAB Radio


#!/bin/bash
# Filename: dab-radio.sh
# Version.: 07022018
# Author..: robz
# Basic DAB radio via a cheap DVB-T dongle using a "zenity" gui and the command
# line version of "vlc player", see man vlc. The utility "wmctrl" places the gui
# top left of the screen. The initial scanning for radio stations I used the
# "w_scan" utility to create a playlist text file.

text="Make a selection"
optn=":dvb-frequency=522000000 :dvb-bandwidth=8 :dvb-ts-id=4168 \
:dvb-code-rate-hp=2/3 :dvb-modulation=64QAM :dvb-transmission=8 \
:dvb-guard=1/32 :program="

get_mplex () {
prog=$(zenity --list --radiolist --height=400 --width=200 --hide-header \
--title='robz DAB Radio' --text="$text" --column '' --column '' --column '' \
--hide-column=3 --print-column=ALL --ok-label='Play' \
FALSE 'BBC Radio 1' '6720' \
FALSE 'BBC Radio 1 Extra' '5888' \
FALSE 'BBC Radio 2' '6784' \
FALSE 'BBC Radio 3' '6848' \
FALSE 'BBC Radio 4' '6912' \
FALSE 'BBC Radio 4 Extra' '5824' \
FALSE 'BBC World Service' '6016' \
FALSE 'BBC Radio 5 Live' '5632' \
FALSE 'BBC Radio 5 Sport' '5696' \
FALSE 'BBC Radio 6 Music' '5760' \
FALSE 'BBC Manchester' '6152' \
FALSE 'BBC Lancashire' '6216'
)
}

while true; do
    (sleep .5 && wmctrl -r "robz DAB Radio" -e 1,0,0,200,400) &
    get_mplex
    text="<b>Playing: $(cut -d'|' -f1 <<< $prog)</b>"
    prog="$(cut -d'|' -f2 <<< $prog)"
    pkill -9 vlc
    if [ "$prog" = '' ]; then exit; fi
    (cvlc dvb-t:// $optn$prog > /dev/null 2>&1) &
done


Morse 2


#!/bin/bash
# Filename: morse2.sh
# Version.: 03102017
# Author..: robz
# Enter words hear morse.

trap 'kill -9 $pid 2>/dev/null; echo; exit' TERM EXIT

declare -A morse
morse[A]=".-"     morse[B]="-..."   morse[C]="-.-."   morse[D]="-.."
morse[E]="."      morse[F]="..-."   morse[G]="--."    morse[H]="...."
morse[I]=".."     morse[J]=".---"   morse[K]="-.-"    morse[L]=".-.."
morse[M]="--"     morse[N]="-."     morse[O]="---"    morse[P]=".--."
morse[Q]="--.-"   morse[R]=".-."    morse[S]="..."    morse[T]="-"
morse[U]="..-"    morse[V]="...-"   morse[W]=".--"    morse[X]="-..-"
morse[Y]="-.--"   morse[Z]="--.."   morse[1]=".----"  morse[2]="..---"
morse[3]="...--"  morse[4]="....-"  morse[5]="....."  morse[6]="-...."
morse[7]="--..."  morse[8]="---.."  morse[9]="----."  morse[0]="-----"
morse[.]=".-.-.-" morse[,]="--..--" morse[?]="..--.."

while true; do
    read -p "Input a word or sentence: " input
    echo
    while read -n1 character; do
        character="${character^^}"
        if [ "$character" ]; then
            echo -ne " $character\t"
            while read -n1 dotdash; do
                tput bold
                [ "$dotdash" = "." ] && duration="0.2" || duration="0.4"
                echo -n "$dotdash"
                (speaker-test -t sine -f 400 >/dev/null) & pid="$!";\
                sleep "$duration"; kill -9 "$pid"
                tput sgr0
            done < <(echo -n "${morse[$character]}")
            sleep 0.2; echo
        else sleep 0.4; echo
        fi 2> /dev/null
    done < <(echo -n "$input")
    echo
done

Morse


#!/bin/bash
# Filename: morse.sh
# Version.: 01102017
# Author..: robz
# Training aid to print out and recite morse code in a terminal.
# Get stuff "sudo apt install espeak"

tabs="\n"
code=(A .- B -... C -.-. D -.. E . F ..-. G --. H .... I .. J .--- K -.- \
L .-.. M -- N -. O --- P .--. Q --.- R .-. S ... T - U ..- V ...- W .-- X -..- \
Y -.-- Z --.. 1 .---- 2 ..--- 3 ...-- 4 ....- 5 ..... 6 -.... 7 --... 8 ---.. \
9 ----. 0 ----- stop .-.-.- comma --..-- query ..--..)

trap 'kill -9 $pid 2>/dev/null; exit' TERM EXIT

for character in {0..78..2}; do
    echo -ne "$tabs ${code[character]}\t"
    espeak -a 400 "${code[character]}"
    tput bold
    while read -n1 dotdash; do
        [ "$dotdash" = "." ] && duration="0.2" || duration="0.4"
        echo -n "$dotdash"
        (speaker-test -t sine -f 400 >/dev/null) & pid="$!";\
        sleep "$duration"; kill -9 "$pid"
    done < <(echo -n "${code[((character+1))]}")
    tput sgr0
    [ "$tabs" = "\n" ] && tabs="\t|\t" || tabs="\n"
    sleep 1
done 2> /dev/null
echo -e "\n\nEnd of morse code demo.\n"

exit

Raspberry Pi SSH


#!/bin/bash
# Filename: motd.sh
# Version : 23072017
# Author  : robz
# Raspberry Pi landing page SSH login script.
# Place this file in /etc/profile.d/ and set the executable bit.
# Interactive message of the day to display on secure shell login.
# It provides commands for control of "new-pvr.sh" PVR script.
# Add an alias to your .bashrc to call "motd.sh" info and menu.
# alias 1='/etc/profile.d/motd.sh'
# Then execute ". ~/.bashrc"

sudo killall -qg countLED.sh >/dev/null 2>&1

printf "\033c"
re="$(tput setaf 1)"; gr="$(tput setaf 2)"; ye="$(tput setaf 3)"
bl="$(tput setaf 4)"; mg="$(tput setaf 5)"; cy="$(tput setaf 6)"
gy="$(tput setaf 7)"; wh="$(tput setaf 9)"
myip="$(ifconfig eth0 | awk '/inet/{print $2}' | cut -d: -f2)"
boot="$(date -d "@"$(awk '/btime/{print $2}' /proc/stat) +"%d/%m/%y at %H:%M")"
last="$(last -i $(whoami) | awk 'NR==2 {print $1,$3,$4,$5,$6,$7}')"
uptm="$(awk '{print int($1/86400)" days, "int($1%86400/3600)" hours, "int($1%3600/60)" minutes"}' /proc/uptime)"
memo="$(free -m | awk 'NR==2 {print "Total: "$2"MB, Used: "$3"MB, Free: "$4"MB"}')"
free="$(df -h ~ | awk 'NR==2 {print "Total: "$2"B, Used: "$3"B, Free: "$4"B"}')"
stor="$(df -h /dev/sda1 | awk 'NR==2 {print "Total: "$2"B, Used: "$3"B, Free: "$4"B"}')"
temp="$(/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9")ÂșC"
sess="$(cat /home/pi/Downloads/log/motd.txt)"
tput bold
printf "$bl""%`tput cols`s" | tr ' ' '_'
echo "$gr
    .~~.   .~~.
   '. \ ' ' / .'  $re
    .~ .~~~..~.   $re     Raspberry Pi$wh Torrent Box$re
   : .~.'~'.~. :  $wh     a.k.a. pi@$myip$re
  ~ (   ) (   ) ~ $wh     on robz home network.$re
 ( : '~'.~.'~' : )$wh     Welcome back! login: $(whoami)$re
  ~ .~ (   ) ~. ~ $wh     $(date +"%A %d %b %Y %H:%M")$re
   (  : '~' :  )  $wh     $(echo Kernel $(uname -ro))$re
    '~ .~~~. ~'
        '~'
$ye Last Login....:$bl $last
$ye Last boot.....:$bl $boot
$ye Uptime........:$bl $uptm
$ye Memory........:$bl $memo
$ye Home space....:$bl $free
$ye USB storage...:$bl $stor
$ye Temperature...:$bl $temp
"
tput sgr0
echo "$wh$sess"
echo
echo -e " User PVR commands, the \"#\" or \"Enter\" for a shell prompt.\n\
 1) - Display this \"motd\" message. \
 2) - Nano edit add-magnet.txt.\n\
 3) - View today's session log.    \
 4) - Nano edit followed-shows.txt.\n\
 5) - List recently downloaded.    \
 6) - List the \"Watch\" directory.\n\
 7) - View rss-today.txt file.     \
 8) - Run \"TED Talks\" downloader."

tput bold
printf "$bl""%`tput cols`s" | tr ' ' '_'
read -n1 n
printf "\033c"
case $n in
    1) /etc/profile.d/motd.sh;;
    2) nano ~/Downloads/scripts/add-magnet.txt;;
    3) cat ~/Downloads/log/"$(date +%a-%-d%b)"*runlog.txt; read -n1;;
    4) nano ~/Downloads/scripts/followed-shows.txt;;
    5) echo -e "\nRecently Downloaded\n"
    tac ~/Downloads/log/rec.txt; read -n1;;
    6) echo -e "\nTrackers in \"Watch\" directory\n"
    ls Downloads/Watch; read -n1;;
    7) cat ~/Downloads/log/rss-today.txt; read -n1;;
    8) /home/pi/Downloads/scripts/ted-talks.sh; read -n1;;
   "") killall motd.sh;;
esac
/etc/profile.d/motd.sh

# Add this alias to your .bashrc to call "motd.sh" info and menu.
# alias 1='/etc/profile.d/motd.sh'
# Then execute ". ~/.bashrc"


Timer Mk3


#!/bin/bash
# Filename: progbar-timer.sh
# Version.: 19042017
# Author..: robz
# What another one!
# Improved from the "Egg Timer" script, a countdown timer with progress bar.
# This one has an indication of time remaining provided by Zenity's progress
# bar function. You'll need to choose a sound file below and maybe fiddle with
# the vector_tl function x&y coordinates.

vector_tl ()                                              # Dialog to top left.
{
x="541"; y="315"
until [ "$x" -lt "0" ]; do
    wmctrl -r "Egg Timer Mk3" -e 0,"$x","$y",210,129
    ((x-=30)); ((y-=18))
done
}

count=$(zenity --title "Egg Timer Mk3" --text "Decimals allowed Min/Hrs"\
    --entry-text "eg. 10s or 5m or 2h" --entry)           # Input dialogue.
if [ $? = 1 ]; then exit $?; fi

# Determine number of seconds to count down from depending on input suffix.
case "${count: -1}" in
    "S" | "s" ) count=$(echo ${count%?}/1 | bc) ;;
    "M" | "m" ) count=$(echo ${count%?}*60/1 | bc) ;;
    "H" | "h" ) count=$(echo ${count%?}*3600/1 | bc) ;;
    *         ) zenity --error --text "<span color=\"red\"><b>\
    \nUse the form of 10s or 5m or 2h\nDecimals allowed Min/Hrs.</b></span>"
    sh -c "$0"                                            # On error restart.
    exit ;;
esac

(sleep 1 && vector_tl) &

start=$count                                              # Set a start point.

until [ "$count" -eq "0" ]; do                            # countdown loop.
    ((count-=1))                                          # Decrement seconds.
    percent=$((100*count/start))                          # Calc percentage.
    echo "#Time remaining:$(echo "obase=60;$count" | bc)" # Convert to H:M:S.
    echo $percent                                         # Outut for progbar.
    sleep 1
done | zenity --title "Egg Timer Mk3" --progress --percentage=0 --text=""\
    --auto-close                                          # Progbar/time left.

if [ $? = 1 ]; then exit $?; fi
zenity --info --title "Egg Timer Mk3" --text "## TIMES UP ##" &
play $HOME/Scripts/glass_ping.wav                         # Ping sound finish!
vector_tl
exit