Obnam Manual v1.4

A small upgrade to the manual, giving it 60 pages, and slightly easier to understand, I hope.

Obnam Manual v1.4

The Obnam Manual, version 1.4 of 2014, is a PDF document designed to be read and used online and not printed out. It weighs in at 131 kbs but is still very useful. It is a "work-in-progress" so you will see it changing as time goes on. It explains very simply, with sample configurations, how to use “Obnam” for your backups.

Updated on 29-07-14.

 


Tagged , , | Leave a comment

beeb v-6.0

Another release of “beeb” with its PDF “User manual”, which now gives you the ability to trim your download history, and a much simplified menu system.

The user manual is a complete rewrite to make it simpler and easier to understand. And also details all of the changes from the previous version.

beeb-v6.0

The source code for beeb-v6.0, and the PDF manual, all ready to go. 


The Beeb Manual

The Beeb Manual, version 6.0, is a PDF document designed to be read and used online and not printed out. It weighs in at 55kbs but is still very useful. This is a complete rewrite to make it simpler and easier to understand. 


Tagged , , , , , | Leave a comment

Introducing the “Obnam Manual 2014 – v1.1″ UPDATE – v1.3

This is to introduce to you the newly created “Obnam Manual” which is a work-in-progress and not complete, but it is still very useful. It explains very simply, with sample configurations, how to use “Obnam” for your backups.

Any comments or suggestions will be passed along to the obnam developers. Thanks.

Tagged , , | Leave a comment

‘beeb’-v5.2

Another release of “beeb” which now includes a PDF “User manual”, the ability to programme your timeout period, and really up-to-date information about the legal usage of “get-iplayer” and “beeb”.

The user manual shows exactly what the commands do and how to answer them, and proceeds in a logical manner from start to finish.

The ‘Beeb Manual v5.2′ has been removed, as it has been superseded by v6.0.

Likewise the source code for ‘beeb-v5.2′.

Tagged , , , , , | Leave a comment

Life on the bleeding edge 2 – get_iplayer.

Features

  • Downloads MP4 streams from BBC iPlayer site with better quality than Flash player streams
  • Downloads Flash AAC/MP3 and WMA streams for radio programmes
  • Allow multiple programmes to be downloaded using a single command
  • Indexing of all available iPlayer programs
  • Caching of Index (default 4h)
  • Regex search on programme name
  • Regex search on programme description and episode title
  • PVR capability (may be used from crontab)
  • Full HTTP Proxy support
  • Runs on Linux (Debian, Ubuntu, openSUSE and many others), OS X (10.5+) and Windows (XP/Vista/7/8)
  • Requires perl 5.8.8+ with LWP module

There are several ways of getting get_iplayer, and the current version is
2.86 and the current version is 2.83-1 in Debian “Jessie” -

Method 1

–8<—————cut here—————start-————>8—
wget https://raw.github.com/dinkypumpkin/get_iplayer/latest/get_iplayer
–8<—————cut here—————end—————>8—
After downloading the script make it executable:

chmod 755 ./get_iplayer

and then place it in an executable path like $HOME/bin or /usr/local/bin.

The first time you run the script it will create a settings directory
(~/.get_iplayer) and download plugins. It will then access the BBC website and
create an index of all TV programmes currently on iPlayer.

Method 2

But this is my preferred way

#!/bin/bash
set -e
#: Title                : getbuild
#: Date             : 23 April 2014
#: Version          : 1.0
#: Description      : To make it easier to get get_iplayer, and then keep it up to date
#; Requirements     : atomicparsley rtmpdump id3v2 libid3-3.8.3c2a git
#; Possible requirements  : flvstreamer libwww-perl libxml-simple-perl perl libmp3-info-perl mplayer ffmpeg libav-tools
# Copyright (C) 2014  Sharon Kimble 
log=~/logs/getbuild.txt-$(date +%Y%m%d-%R).txt
exec > >(tee -a $log) 2>&1
echo "$(date +%Y-%m-%d\ %H:%M:%S)" >> $log

### First run
cd $HOME/git
git clone https://github.com/dinkypumpkin/get_iplayer
cd $HOME/git/get_iplayer
sudo cp get_iplayer /usr/local/bin
cd ~

### Second and subsequent runs
#if [ -d "$HOME/build/get_iplayer/" ]
#then
#    echo;
#else
#   mkdir "$HOME/build/get_iplayer/"; cd ~ ; echo;
#fi
#cp /usr/local/bin/get_iplayer $HOME/build/get_iplayer/get_iplayer-$(date +%Y%m%d-%R)
#cd $HOME/git/get_iplayer
#git pull
#sudo cp get_iplayer /usr/local/bin
#cd ~

To use it, make it executable and then just place it in an executable path,
like $HOME/bin or /usr/local/bin.

The first time it runs it will download the current git repo, and then copy
“get_iplayer” to /usr/local/bin after prompting you for your password. Then
you can just use it exactly the same as the packaged version from your repo.

Tagged , , , | Leave a comment

Ranking of percentage of free space on your drives

I recently came across a rather splendid command that shows your drives and their percentage of free space. And it is –

df -hP |column -t |tee >( head -n1 > /dev/stderr ) |grep % |sort -k5nr

and in my case it shows this -

Filesystem  Size  Used  Avail  Use%  Mounted                 on
/dev/sdd1   2.7T  2.0T  579G   78%   /media/boudiccas/back1
/dev/sda1   287G  147G  126G   54%   /
/dev/sde1   2.7T  1.2T  1.5T   46%   /media/boudiccas/back3
/dev/sdc1   917G  298G  573G   35%   /media/boudiccas/back4
/dev/sdb1   1.8T  322G  1.4T   19%   /media/boudiccas/back2
tmpfs       354M  40M   315M   12%   /run
tmpfs       2.1G  80K   2.1G   1%    /run/shm
Filesystem  Size  Used  Avail  Use%  Mounted                 on
none        4.0K  0     4.0K   0%    /sys/fs/cgroup
tmpfs       5.0M  0     5.0M   0%    /run/lock
udev        10M   0     10M    0%    /dev

As you can see it ranks your drives by their usage, which is rather nice.

Tagged | 1 Comment

QupZilla problems.

Screenshot-260514-12:43:38
A screenshot showing the problems that I’m having using Qupzilla with fluxbox/compton/plank. What you see there is a “ghost-image”, qupzilla is *not* running, yet it still shows its icon in plank at the bottom, and its window outlines on the workspace. Its a mystery!

Leave a comment

wallpaper-for-gnome3

Jonathan Haddock has reworked my wallpaper script to use with gnome3, and here is his version. His original version can be found here

#!/bin/bash
set -e
#: Title            : wallpaper-for-gnome3
#: Date             : March 2014
#: Author           : Jonathan Haddock and Sharon Kimble (original version for another Desktop Environment)
#: Version          : 1.0
#: Description      : changes your wallpaper, and can be run from an alias
####################################################
#: Options          : 
# change - length of time (minutes) before the wallpaper changes again
# wallpapers - path to Wallpapers directory containing JPG files
#; Requirements     : shuf, gsettings (gnome 3)
#: License          : GNU GPL 3.0 or later
####################################################
# Options
change=10
wallpapers=/home/jonathan/Wallpapers
###################################################
while true; do
  BGFILE=`find $wallpapers -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |	shuf -n1 -z`
	gsettings set org.gnome.desktop.background picture-uri file://$BGFILE
	gsettings set org.gnome.desktop.background picture-options stretched #stretched, scaled, zoom, centered, none, spanned, wallpaper
   sleep "$change"m
done
Tagged , | Leave a comment

‘beeb’-v4.0

Another release of ‘beeb’ which takes it to even greater heights! :) And just as an experiment I’m “self-hosting” the ‘tar.gz’ file so that it can be downloaded from here.

Documentation first -
This is the documentation for ‘beeb’ [version 4.0] the all-singing, all-dancing, upgrade to ‘get-iplayer’!

The BBC has some superb radio and TV programmes, some of which can be downloaded using ‘get-iplayer’, and then can be played with your choice of viewer. This script will -

  • Check to see if you have ‘get-iplayer/get_iplayer installed. If not it will prompt you to install it.
  • Creates the directory where the ‘beeb-tv.txt & beeb-radio.txt’ files are stored.
  • Downloads the current radio programme feed,
  • Allows you to put the programme numbers in to download, and tell you how much more you can download in this session,
  • Downloads the programmes and saves as *.mp3,
  • Asks you to put any further programme numbers in to download, and tells you how much more you can download in this session,
  • Asks you if you want to create a playing list of the radio programmes that can then be used by MPD.
  • Then downloads the current TV programme feed,
  • Allows you to put the programme numbers in to download, and tell you how much more you can download in this session,
  • Asks you to put any further programme numbers in to download, and tell you how much more you can download in this session,
  • Downloads the programmes,
  • Asks you if you would like to delete any of the ‘beeb’ downloads which are older than 30 days. If you answer “y” to this, it is DESTRUCTIVE and you will LOSE some programmes.
  • The script will quit and unload itself if left unattended and not downloading anything for thirty minutes. You might have gone to bed leaving it downloading some programmes, but when you go back to it in the morning, all connections to it are broken.

But before any of this can happen you need to configure it all, and this is done using ‘.beebrc’ which should be saved to your “/home/$USER” directory. In ‘.beebrc’ you can see the paths to my various directories, which will give you an idea of what should go where in your setup. So if you open ‘.beebrc’ in your favourite text editor, then change these lines -

tvsite=”where the downloaded tv programmes are to be stored”
music=”where your main music library is stored”
radiosite=”where the downloaded radio programmes are to be stored”
beebradio=”the playlist of your downloaded radio programmes”

Then to run ‘beeb’ from the terminal, you need to place it somewhere in your executable pathway, maybe home/$USER/bin‘ or ‘/usr/local/bin’ and then just put ‘beeb’ in your terminal and follow the questions that it gives you.

Required.

get-iplayer.
The prime requirement of this script is the programme ‘get-iplayer’ which is in most linux distributions. Without it, the script will not function!

Hints.

  • There is no need to press ENTER to proceed, just answer “y, n,q or r”. The only time you need to press ENTER is when you are inputting programme numbers.
  • The “r” command will restart the script from the beginning, just in case you need it.
  • The programme listings for both radio and tv will be found at “home/$USER.beeb/”
  • Don’t let ~/.get-iplayer/downloadhistory get too big as it will cause
    problems in your downloading, like being very slow, or causing the programme to drop the connection.
  • If the programme appears to hang, it may be trying to reconnect, or have just crashed, in which case, you will have to run ‘beeb’ again with the same input as you used before.
  • If you do need to break out of ‘beeb’, for whatever reason, you can either
    answer ‘q’ when you’re prompted for it, or just press ‘CONTROL C’ to crash out.
  • To access ~/.beeb to read ‘beeb-radio.txt’ or ‘beeb-tv.txt’ just enter ‘cd $HOME/beeb’ which auto-opens it at the prompt. Then you can use ‘$EDITOR beeb-radio.txt’ or ‘$EDITOR beeb-tv.txt’ to display either of the files. $EDITOR is your choice of text editor.
  • You will find that the script silently creates a file called ‘touch.m4a’ which is needed when creating the MPD playlist. This file has zero content and poses no threat to you or your computer, and should be left in place. If you do delete it, then the script will crash whilst creating the MPD playlist, so please leave it in place as it is needed.

The legalities.

Please note, I am not a lawyer, and this section is created using internet sources.

‘get-iplayer’ is only supposed to be used in the UK, if you do manage to use it outside the UK, then good luck to you but you will be unable to get any support for it. And to use it in the UK you should also have a UK TV licence too. Any files downloaded with ‘get-iplayer’, or this script, should only be kept for 30 days before being deleted.

Any problems, or further instruction required, please let me know at ‘boudiccas@talktalk.net’.

Sharon Kimble.
April 2014.
_
Changelog.

4.0 (14-04-2014)

  • Now gives the ability to restart the script from wherever you are.
  • Now gives the ability to delete content older than 30 days.
  • Script quits if left unattended and not downloading for 30 minutes.

3.1 (16-02-2014)

  • Faulty packaging, did not contain all necessary files, therefore repackaged.

3.0 (16-02-2014)

  • Now downloads all the radio programmes as *.mp3

2.8 (11-02-2014)

  • Moved mpd feed update question to just after radio programmes download, where its placement seems more logical.

2.7 (06-02-2014)

  • Updated documentation to reflect the current legal situation, as I understand it.

2.5 (28-01-2014)

  • Checks to see if get-iplayer/getiplayer is installed. Then runs with
    whichever is found.

2.0 (26-01-2014)

  • Changed configuration to create ~/.beeb and store feeds in it.

1.5 – and earlier

  • Changed ‘beeb.conf’ to ‘.beebrc’

And now the source code itself.

#!/bin/bash
set -e
#: Title            : beeb
#: Date             : 14 April 2014
#: Version          : 4.0
#: Description      : To work with get-iplayer and use small scripts to download BBC programmes.
#; Requirements     : get-iplayer
#: Uses '.beebrc' saved at $HOME/.beebrc

# Copyright (C) 2014  Sharon Kimble 
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
####################################################
trap "kill -- -$BASHPID" EXIT
function ask {
    while true; do

        if [ "${2:-}" = "Y" ]; then
            prompt="Y/n"
            default=Y
        elif [ "${2:-}" = "N" ]; then
            prompt="y/N"
            default=N
        else
            prompt="y/n"
            default=
        fi

        # Ask the question
        read -p "$1 [$prompt] " REPLY

        # Default?
        if [ -z "$REPLY" ]; then
            REPLY=$default
        fi

        # Check if the reply is valid
        case "$REPLY" in
            Y*|y*) return 0 ;;
            N*|n*) return 1 ;;
        esac

    done
}
function ask2 {
    n=$1                    # the limit on the input length (&lt;1000)
    if [ -z "$2" ] ; then   # the name of variable to hold the input
        echo "Usage $0: <number> <name>";
       return 2;
    fi
    result="" # temporary variable to hold the partial input
    while $(true); do
        printf '[%03d] > %s' "$n" "$result"
        stty cbreak
        REPLY=$(dd if=/dev/tty bs=1 count=1 2> /dev/null)
        stty -cbreak

        test "$REPLY" == "$(printf '\n')" && {
             printf "\n"
             eval "$2=\"$result\""
             return 0
        }
        test "$REPLY" == "$(printf '\177')" && {
             # On my terminal 0x7F is the erase character
             result=${result:0:-1}
             (( n = $n + 1 ))
             printf "\r\033[K"
             continue
         }

    result="${result}$REPLY"
        (( n = $n - 1 ))
        if [ $n -eq 0 ] ; then
           printf "\n"
           eval "$2=\"$result\""
           return 1
        fi
        printf "\r\033[K" # to clear the line
    done
}

txtbld=$(tput bold)
bldgrn=${txtbld}$(tput setaf 5) 
tvfeed="$HOME/.beeb/beeb-tv.txt"
radiofeed="$HOME/.beeb/beeb-radio.txt"
beeb="/usr/local/bin/beeb"
source ~/.beebrc

if [[ -x "/usr/bin/get-iplayer" ]]
then player="/usr/bin/get-iplayer"
elif [[ -x "/usr/bin/get_iplayer" ]]
then player="/usr/bin/get_iplayer"
elif [[ -x "/usr/local/bin/get_iplayer" ]]
then player="/usr/local/bin/get_iplayer"
else echo "$0: Error: 'get-iplayer' or 'get_iplayer' is not installed. Please install it." &gt;&amp;2
     exit 1
fi

if [ -d "$radiosite/touch.m4a" ]
then
    echo;
else
    touch "$radiosite"/touch.m4a; echo;
fi

if [ -d "$HOME/.beeb" ]
then
    echo ;
else
    echo "$(tput setaf 1) $(tput setab 7) Error: Directory $HOME/.beeb does not exist $(tput sgr0)"
        read -n1 -p ""$bldgrn" Do you want to create the '$HOME/.beeb' directory? [y/n/q] $(tput sgr0)" ynq
    case "$ynq" in
        [Yy]* ) mkdir $HOME/.beeb; touch "$tvfeed"; touch "$radiofeed"; echo;;
        [Nn]* ) echo; exit;;
        [Qq]* ) echo; exit;;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
fi

 {
    read -t 1800 -n1 -p ""$bldgrn" Do you want to update the radio feed? [y/n/q/r] $(tput sgr0)" ynqr
    case "$ynqr" in
        [Yy]* ) rm "$radiofeed"; eval "$player" --type radio >>"$radiofeed";;
        [Nn]* ) echo;;
        [Qq]* ) echo; exit;;
        [Rr]* ) exec "$beeb";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
 };
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to download some radio programmes? [y/n/q/r] $(tput sgr0)" ynqr ;
    case "$ynqr" in
        [Yy]) echo
              echo ""$bldgrn" Please input the radio programme numbers to download [max 200 characters] $(tput sgr0)"
              ask2 200 'radiobox'
              echo "$radiobox"
              echo
              cd "$radiosite"
              eval "$player" --g "$radiobox" --aactomp3; echo;;
        [Nn]) echo;;
        [Qq]) echo; exit;;
        [Rr]) exec "$beeb";;
        * ) echo ""$bldgrn" Thank you $(tput sgr0)";;
    esac
  };
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to download some more radio programmes? [y/n/q/r] $(tput sgr0)" ynqr ;
    case "$ynqr" in
        [Yy]) echo
              echo ""$bldgrn" Please input the radio programme numbers to download [max 200 characters] $(tput sgr0)"
              ask2 200 'radiobox'
              echo "$radiobox"
              echo
              cd "$radiosite"
              eval "$player" --g "$radiobox" --aactomp3; echo;;
        [Nn]) echo;;
        [Qq]) echo; exit;;
        [Rr]) exec "$beeb";;
        * ) echo ""$bldgrn" Thank you $(tput sgr0)";;
    esac
  };
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to update the mpd feed? [y/n/q/r] $(tput sgr0)" ynqr
    case "$ynqr" in
        [Yy]* ) cd "$music"
                rm "$beebradio"
                ls -1 "$radiosite"*.{mp3,m4a} >"$beebradio"
                echo;;
        [Nn]* ) echo;;
        [Qq]* ) echo; exit;;
        [Rr]* ) exec "$beeb";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
};
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to update the tv feed? [y/n/q/r] $(tput sgr0)" ynqr
    case "$ynqr" in
        [Yy]* ) rm "$tvfeed"; eval "$player" --type tv >>"$tvfeed";;
        [Nn]* ) echo;;
        [Qq]* ) echo; exit;;
        [Rr]* ) exec "$beeb";;
        * ) echo ""$bldgrn" Please answer yes or no. $(tput sgr0)";;
    esac
 };
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to download some tv programmes? [y/n/q/r] $(tput sgr0)" ynqr ;
    case "$ynqr" in
        [Yy]) echo
              echo ""$bldgrn" Please input the tv programme numbers to download [max 200 characters] $(tput sgr0)"
              ask2 200 'tvbox'
              echo "$tvbox"
              echo
              cd "$tvsite"
              eval "$player" -g "$tvbox"
              echo;;
        [Nn]) echo;;
        [Qq]) echo; exit;;
        [Rr]) exec "$beeb";;
        * ) echo ""$bldgrn" Thank you $(tput sgr0)";;
    esac
 };
echo;
{
    read -t 1800 -n1 -p ""$bldgrn" Do you want to download some more tv programmes? [y/n/q/r] $(tput sgr0)" ynqr ;
    case "$ynqr" in
        [Yy]) echo
              echo ""$bldgrn" Please input the tv programme numbers to download [max 200 characters] $(tput sgr0)"
              ask2 200 'tvbox'
              echo "$tvbox"
              echo
              cd "$tvsite"
              eval "$player" -g "$tvbox"
              echo;;
        [Nn]) echo;;
        [Qq]) echo; exit;;
        [Rr]) exec "$beeb";;
        * ) echo ""$bldgrn" Thank you $(tput sgr0)";;
    esac
 };
echo;
{
    read -t 1800 -n1 -p "$(tput setaf 1) $(tput setab 7) Do you want to delete programmes older than 30 days? [y/n/q/r]  $(tput sgr0)" ynqr ;
    case "$ynqr" in
        [Yy]) find "$radiosite" -mtime +30 -type f -delete;
              find "$tvsite" -mtime +30 -type f -delete; echo; exit;;
        [Nn]) echo; exit;;
        [Qq]) echo; exit;;
        [Rr]) exec "$beeb";;
        * ) echo ""$bldgrn" Thank you $(tput sgr0)";;
    esac
 };
Tagged , , , , | Leave a comment

‘ebuild- v2′

After having quite a few problems when I did my bi-daily, i.e. every other day, build of emacs, I’ve reworked my script which makes it easier to use.

#!/bin/bash
set -e
# set -x
#: Title            : ebuild
#: Date             : 12 April 2014
#: Version          : 2.0
#: Description      : To download and build the development build of emacs. 
#: Requirements     : xorg-dev, libgif-dev, libtiff-dev, ncurses-dev
# Copyright (C) 2014  Sharon Kimble 
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
####################################################
log=~/logs/emacsbuild2.txt
exec > >(tee -a $log) 2>&1
echo "$(date +%Y-%m-%d\ %H:%M:%S)" >> $log

### First download
#cd ~/git
#bzr branch bzr://bzr.sv.gnu.org/emacs/trunk
#cd ~/git/trunk
#./autogen.sh
#./configure
#export emacs_prefix="/usr/local"
#make
#sudo make install
#cd ~ 

### 2nd and subsequent downloads
cd ~
if [ -d "$HOME/.emacs.d/build/" ]
then
    echo;
else
    mkdir "$HOME/.emacs.d/build/"; cd ~ ; echo;
fi
cp /usr/local/bin/emacs-24.4.50 $HOME/.emacs.d/build/emacs-24.4.50-$(date +%Y%m%d-%R)
cp /usr/local/bin/emacsclient $HOME/.emacs.d/build/emacsclient-$(date +%Y%m%d-%R)
cp /usr/local/bin/emacs $HOME/.emacs.d/build/emacs-$(date +%Y%m%d-%R)
cd ~/git/trunk
#bzr branch bzr://bzr.sv.gnu.org/emacs/trunk
bzr pull
./autogen.sh
./configure
export emacs_prefix="/usr/local"
make
sudo make install
cd ~

For the first time you use it uncomment the first section, and comment out the second section, and then run the script.

For the second, and subsequent times, comment out the first section and uncomment out the second stage, and then run the script. You will find that it copies several files from /usr/local/bin to $HOME/.emacs.d/build/ and saves them with today’s date and time. This is to stop them being over-written in case your current build fails, you still have a good working file ready for use.

One thing that you have to bear in mind is that connecting to savannah for the first time and initialising your repo of emacs trunk build is that it may take some time! From start to finish when I did it was 40 minutes, time for you to make a cup of tea even! :)

Tagged , , , | Leave a comment