|
Carefully, Correctly Wrong
|
|
|
| Textual Diff of OpenDocument Files |
[Apr. 12th, 2009|06:50 pm] |
Being a Good Geek as well as an activist, I keep most of my activism files in a Subversion version-control repository. This lets me keep my files backed up, store changes between them, and work nicely with multiple users (assuming anybody else ever wants to give me a hand).
I also keep my files in OpenDocument because it's an open, standard format which can be read by a variety of software on a variety of platforms, most popularly OpenOffice.org. Being an open, standard format, various tools have risen around it, and I thought it might be possible to easily determine the textual differences between two OpenDocument files. This could be tied in with my repository so I can see the actual differences as well as my commit log. However, I didn't find any such utility, so I wrote my own based around odt2txt, GNU diffutils and the subversion docs.
I chose in this script to strip out command-line options to get the file arguments; another way would have been to test each parameter to see whether it was an existing OpenDocument file, but that seemed a little nastier to me. It does mean that my script has to know what parameters svn might pass to diff, though.
( Show us the source )
So this script works just fine - I can call it with svn diff --force --diff-cmd=odtdiff.bash myfile.odt. The only problem is that I can't tell Subversion always to use this command to diff OpenDocument files, which seems like a big flaw in Subversion...
Incidentally, I tried a variant where I call odt2txt --raw and xmldiff but it really wasn't very human-readable. |
|
|
| Release Early, Release Often |
[Mar. 19th, 2008|11:36 pm] |
OpenOffice.org has a cute function to print your document as a booklet - printing duplex, doubled-up A5 pages in the right order. Unfortunately, KPDF doesn't do this. I spent a little time hacking up a script to convert a PDF file into a booklet, using pdftk to reorder the pages and pdfnup to double up the pages.
It doesn't actually work yet, because the algorithm for generating the page ordering is wrong, and it needs to stuff in blank pages in the right page. Still, it's kept me entertained for an evening, and I figured I might as well release the code so far - finishing it is an exercise for the reader, but don't tell me until I get bored and give up!
On a Debian GNU/Linux system, you'll want the pdftk, pdfjam and poppler-utils packages installed.
( Source Code )
Of course, now somebody will tell me of a tool which does this automatically... |
|
|
| Simple DVD Archiving Script |
[Apr. 9th, 2007|05:08 pm] |
I have a Debian GNU/Linux server in my sister's shop in Birmingham; it provides a Samba fileshare for the Windows desktops as well as an OpenVPN server for remote access from my sister's home laptop. Backups have been on an ad-hoc basis whenever we remember to get round to it, which is distinctly sub-optimal particularly in the face of the hard drive crash we suffered recently.
I have finally gotten round to writing a backup script for the shop - they have less than 4.4Gb of data, so can just dump onto a DVD-R every month or so. Pretty much all the existing backup options seemed overkill for this, and yet my script is not entirely trivial. I paste it here, licensed under the GNU GPL in case others find it useful or want to criticise my bash-fu:
( Source code, probably boring )
I've set this script to run every midnight, which gives me some confidence that a daily nagging via e-mail may eventually end up in fresh DVDs being put into the drive. |
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
| |
|
|