Posts Tagged ‘script’

LaTeX Handouts Builder (Python version)

22 August 2013 1 comment

This tool can be used to build “course handout books” using multiple LaTeX beamer slides sets.

I have been using a Bash script with almost the same functionality for a long time. Some background information on this old script can be found in this blog post.

Book structure:

  • Title page, introduction, table of contents
  • One chapter per slide set (three printer-friendly versions: no slides transitions &  less colors)

Example .zip output

How it works:

  • Just run one program: “python”
  • The program starts building all the LaTeX beamer slides.
  • The output is converted to the printer-friendly formats.
  • All documents are merged in the master handouts book.
  • Create a ZIP archive with all the documents

Code and examples available at GitHub.


Build script: course handouts from latex-beamer slides

4 December 2011 1 comment

As a lecturer, a part of my job consists of giving presentations using some kind of presentation software.

In the past, I uploaded a pdf file for each presentation to the  educational learing platform we use at our university. Typically 12+ files for one semester. Because some students prefer to print out the handouts, I provided a printer friendly version (8 slides per page), instantly doubling the number of files.

During the semester, I tend to adjust/tweak/update these files from time to time, making it dreadfull for me to update the files, and making it difficult for the student to ensure they have downloaded the last version of each file.

When I switched from to Latex beamer to prepare my presentations, I also decided to resolve this annoyance and add some extra features to my handouts.

This resulted in a build script.

What is it does:

  1. Build two pdf version for each lecture: presentation version and handout version (printer friendly colors, no slide transitions)
  2. Build a 8 slides per page (8pp) version starting from the handout version
  3. Create a nice handout document by joining all the 8pp files + include title page, introduction, table of contents
  4. Create a .zip archive file with all these documents

The end result is an updated .zip archive, with the last version of all the slides.  About once a week, I do a full build and upload this one file to our learning platform.

Sample commandline output:

$ ./build
Now processing: 0-hfdst0
Latex build succesfull
PDF 8pp build succesfull
Now processing: 7-hfdst7
Latex build succesfull
PDF 8pp build succesfull
Now processing: 8-hfdst8
Latex build succesfull
PDF 8pp build succesfull
Now joining all documents
Latex build succesfull
Build took 6 seconds.

Sample files:

(remove ‘.doc’ from the file extension, wordpress does not allow .zip/.sh)

Backup script: encrypted, offsite, incremental backup (rsync, rdiff-backup, encfs)

17 January 2011 2 comments

In this post I will explain a small (~100 lines) backup script I use to make offsite automated backups of several computers.

Overview of the scripts’ actions

  1. Mount a local folder using encfs (the backup files are written in this folder)
  2. Do an incremental backup with the local encfs folder from step one as the destination. Using rdiff-backup with a remote location as the target sometimes resulted in failed/broken backups on systems that frequently go offline. (laptops)
  3. Send the encrypted files to an off-site server (any server with ssh access will do, I use the quite cheap servers.
  4. Send all logged events and an overview of the incremental backups over email

Read more…

Backup using rdiff-backup: a bash select menu

23 February 2009 Leave a comment

This is a bash backup script, that uses rdiff-backup to perform “semi-automatic” backups. (I need to press two keys, to start a backup)

So, what does it do?

First there are some global options (mainly for debugging)
The exclude and include variables are links to the include/exclude files. (in this file you specify which folders to backup)
The “backup” variable: this is where rdiff-backup gets started.

Then a select menu is drawn (as described in a previous post.
The first option checks if my external HDD is mounted, if it is, it does the backup.
The second options checks if I am at home (based on IP), if I am it does the backup to a local file server.
The third option does the same, but on my work network. (it uses public IPs, so it is removed)
The fourth option (“l”), lists the different versions on my local backup.
The “p” option pulls some other backups that are automatically generated on a server to my laptop.

options="-v 5 --print-statistics "
exclude="--exclude-globbing-filelist $HOME/.scripts/tools/backup-lists/exclude"
include="--include-globbing-filelist $HOME/.scripts/tools/backup-lists/include"
backup="rdiff-backup $options $exclude/$target $include/$target --exclude '**' / $backuppath"
while :
echo "****************************************"
echo "* Backup using rdiff-backup *"
echo "****************************************"
echo "* [1] Backup to external hdd *"
echo "* [2] Backup to server @home *"
echo "* [3] Backup to work-server *"
echo "* [l] List increments ext hdd *"
echo "* [p] Pull backups work-server *"
echo "* [0] Exit/Stop *"
echo "****************************************"
echo -n "Enter your menu choice [1-5]: "
read yourch
case $yourch in
1) target="ext-hdd"
mount | grep /media/disk-1 > /dev/null
if [ $? -eq 0 ]
echo loop1
echo "Backup to external hdd finished, Press Enter to continue. . ."
echo "Error no external harddisk connected!"
echo "Press Enter to continue. . ."
exit 0;;
2) backuppath="server.local::/zfs-raidz/backup/autobackuplaptop/"
ifconfig | grep 192.168.123 > /dev/null
if [ $? -eq 0 ]
echo "Backup to ubuntuserver finished, Press Enter to continue. . ."
echo "You are not at home, ubuntuserver not reachable"
echo "Backup to ubuntuserver failed, Press Enter to continue. . ."
exit 0;;
3) backuppath="work...."
l) rdiff-backup -l --list-increment-sizes /media/disk-1/autobackuplaptop
echo "Press Enter to continue. . ."
exit 0;;
p) scp -rp -P 55555 me@ $HOME/data/backup
echo "Press Enter to continue. . ."
exit 0;;
0) exit 0;;
*) echo "Oopps!!! Please select 1,2,3,4, or 5";
echo "Press Enter to continue. . ." ; read ;;