Tomboy to Zim notes conversion

Updated: 2008-03-25

The script provided here is useful if you for some reason would like to convert your Tomboy notes to a set of notes for the similar Zim application. Both are desktop wiki style note taking applications. While Tomboy uses the Mono framework, Zim uses Perl and is in general considered to be leaner on resources than Tomboy.

This small python script converts notes written by the Tomboy application to notes for the Zim application. It does most of the work of conversion but some Tomboy formatting does not exists in Zim and is hence stripped of the notes (different text sizes, fixed width). Nested bullet lists in Tomboy is converted to a flat bullet list in Zim. Besides this the script does a descent conversion job, I think.

Usage:

Download the script
. Make it executable with

$ chmod a+x tzim.py

Run

$ <dir-path to tzim.py>/tzim.py

You will be asked for the path to the Tomboy notes directory. Press return for the default location (~/.tomboy). Then you will be asked where to put the zim notes. Default is current directory. After the conversion, open zim and add a new repository (i.e. the conversion directory). Walk through the notes and check that they are ok.

This is a simple script without ambition to be perfect. The original tomboy notes are not affected by the conversion so the data should be safe under all circumstances. Feedback on enhancements would be appreciated as well as tomboy notes that did not convert. Email <bengt at blafs removethis com>. The software is distributed under the GPL.

Link to Zim - a desktop wiki and outliner.
# Rev:      1.2.1                                                                               #
# Date:     2008-03-25                                                                          #
# Changes:  Corrected typo in dialog. Translates tomboy's monospace to zim verbatim             # 
# Rev:      1.2                                                                                 #
# Date:     2008-03-24                                                                          #
# Changes:  Much revised code. Should be more robust against Tomboy note format now. Also added #
#           support for the new "Notebooks" concept (i.e. two-level name-spaces)                #
# Rev:      1.1                                                                                 #
# Date:     2008-03-08                                                                          #
# Changes:  Fixed an issue when Create date on tomboy note does not exist. Now displays both    #
#           "Last changed" and "Create date" (if these exists) and conversion date. Fixed       #
#           various issues with that could hang the script. Added a few character subs.         #
# Filename: tzim.py                                                                             #
# Rev:      1.0                                                                                 #
# Date:     2007-07-28                                                                          #
# Changes:  First version                                                                       #

MyPasswordSafe to KeePass DB conversion

This script takes as input a .txt file that has been exported from MyPasswordSafe and formats it into a CSV file that KeePass (http://keepass.info/) can import. While MyPasswordSafe is a simple and stable password store it does not seem to be maintained anymore (see http://www.semanticgap.com/myps/), and it is not cross-platform. I opted for KeePassX instead (http://keepassx.sourceforge.net/) which has variants for all major OS's. But migrating password stores is usually a pain in the a**. Here is how to do it for this case.

Using MyPasswordSafe (ver 0.6.7 tested) save your password database using the "Plain UNENCRYPTED Text (*.txt)" export format, to a .txt file, for example "pass.txt". Then run this script with "pass.txt" as input (when asked for, not as parameter):

$ chmod a+x my2key.py
$ ./my2key.py
Exported .txt file from MyPasswordSafe: pass.txt
CSV data written to "pass.csv"

The script produces a "pass.csv" file in your current directory. This "pass.csv" can be imported into keypass using the import CSV option. Note that KeePassX can't import CSV files so you have to go via KeePass for Windoze... :( I actually installed KeePass (ver 1.0.7) under wine and imported the CSV file and saved it in the default *.kdb format. This file could then be opened in KeePassX :D )

This sounds complicated, but compared to re-write all password records it is a breeze...


ISO week function

Every now and then i would like to know what week number it is now. I can get it from a a calendar application such as Evolution or from the calendar applet in the panel, but it would be nice to get it from the shell also, in an easy way. Thus produced this simple little script. Cut and paste it to a file with name "isow", "chmod +x isow" and dump it to /usr/local/bin, and you have a useful utility.
#!/bin/sh
#
# ISO week function
# Uses `date' function to present various ISO date formats
# 2005-11-12
# Bengt J. Olsson
#
if [ "$1" = "-d" ] ; then
  date --iso-8601
elif [ "$1" = "-dt" ] ; then
  datum=`date --iso-8601` ; datum="$datum `date +"%T"`"; echo $datum
elif [ -z "$1" ] ; then
  date +"%V"
elif [ ${#1} -gt 5 ] ; then
  date --date=$1 +"%V"
else
  echo "Usage: isow [-d|-dt|-h]"
  echo "                   prints ISO week number"
  echo "             -d    prints ISO date"
  echo "             -dt   prints ISO date + local time"
  echo "             -h    prints this help message"
  echo "       isow YYYYMMDD|YYYY-MM-DD prints ISO week number of given date"
fi