A small python script

Recently I changed from using Secrets on my Android phone to using KeePassDroid for storing my passwords. The point of this change was that KeePass is also available for Linux (called KeePassX) and I can now sync my passwords between my desktop and my phone using Dropbox.

However I had to migrate my passwords from Secrets to KeePassX. Luckily Secrets can export to CSV and KeePassX can import XML. So Python to the rescue.

Here is the small Python program I made in case anyone on the Internet should be interested (does anyone know of a nice code syntax highlighter plugin for wordpress?):

import csv
from xml.dom.minidom import Document

doc = Document()
db = doc.createElement("database")
doc.appendChild(db)

group = doc.createElement("group")
db.appendChild(group)

gtitle = doc.createElement("title")
gtitle.appendChild(doc.createTextNode("Imported from Secrets"))
group.appendChild(gtitle)

row_reader = csv.reader(open("secrets.csv", "rb"))
row_reader.next() # skip the header
for row in row_reader:
 e = doc.createElement("entry")
 group.appendChild(e)

 # "Description","Id","PIN","Email","Notes"
 # to
 # <title></title>
 # <username></username>
 # <password></password>
 # <comment></comment>

 etitle = doc.createElement("title")
 e.appendChild(etitle)
 etitle.appendChild(doc.createTextNode(row[0]))

 euser = doc.createElement("username")
 e.appendChild(euser)
 euser.appendChild(doc.createTextNode(row[1]))

 epass = doc.createElement("password")
 e.appendChild(epass)
 epass.appendChild(doc.createTextNode(row[2]))

 ecomment = doc.createElement("comment")
 e.appendChild(ecomment)
 ecomment.appendChild(doc.createTextNode(row[4]))

xml_out = open("converted.xml", "w")
s = doc.toxml()
xml_out.write(s)
xml_out.close()

Note to self: The alternatives system and Java

Using the Fedora alternatives system to make Sun’s (Oracle’s) Java the system default after installation.

sudo alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_20/bin/java 2
sudo alternatives --config java

Previews September

Buffy Vampire Slayer #38 Last Gleaming Pt 3 (of 5) Jo Chen Cvr (p. 32 – SRP: $2.99)     Dark Horse
DC Universe Legacies #7 (of 10) (p. 91 – SRP: $3.99)     DC Universe
Welcome To Tranquility One Foot Grave #5 (of 6) (p. 109 – SRP: $3.99)     Wildstorm
X-Files 30 Days Of Night #5 (of 6) (MR) (p. 115 – SRP: $3.99)     Wildstorm
Angel #39 (p. 147 – SRP: $3.99)     Idw Publishing
X-Factor #211 (p. 83 – SRP: $2.99)     Marvel Comics
Tick New Series #7 (p. 291 – SRP: $4.95)     New England Comics

Me in a tree

I was going through some pictures from the vacation and found one of myself in a tree.

That is all.

Plus-plus bricks

The son announced last week that he no longer wanted to go to kindergarten and that he was ready for school. The reason behind this was that he had found out the school had plus-plus bricks.

As we didn’t really feel he was in fact ready for school we instead decided to buy 1200 plus-plus bricks.

The first thing the son built was a turtle (he did eventually add some more color):

I built a robot and the daughter built a smaller robot:

Previews August

Buffy Vampire Slayer #37 Last Gleaming Pt 2 (of 5) Jeanty Cvr (p. 43 – SRP: $2.99)     Dark Horse
DC Universe Legacies #6 (of 10) (p. 89 – SRP: $3.99)     DC Universe
Welcome To Tranquility One Foot Grave #4 (of 6) (p. 111 – SRP: $3.99)     Wildstorm
X-Files 30 Days Of Night #4 (of 6) (MR) (p. 119 – SRP: $3.99)     Wildstorm
Angel #38 (p. 149 – SRP: $3.99)     Idw Publishing
Meta 4 #5 (of 5) (MR) (C: 1-0-0) (p. 188 – SRP: $3.50)     Image Comics
X-Factor #210 (p. 73 – SRP: $2.99)     Marvel Comics
Kick-ass 2 #2 Balls To The Wall (MR) (p. 78 – SRP: $2.99)     Marvel Comics
Rasl #9 (MR) (p. 252 – SRP: $3.50)     Cartoon Books

Musings about new hardware

CPU Fan by eddie.welker. Creative Commons Attribution-NonCommercial 2.0 Generic.

For quite a while I have been thinking about a new fileserver and wondering why a basic NAS server had to be so expensive and still only have room for one or two disks. So here is my attempt a putting together a nice, quiet machine that could act as a fileserver and possibly also webserver and TV recording server (with a hardware accelerated TV tuner of course).

Intel Desktop Board D510MO: 575,00 DKK

2GB RAM: 369,00 DKK

AeroCool ExtremEngine 3T: 543,00 DKK

LC Power Super Silent LC6420 V1.3: 290,00 DKK

This all adds up to a price of 1777,00 DKK. This is about twice as much as the cheapest NAS solutions but they are limited to 2 disks while this solution has a lot more room for expansion.

Some of these parts may be found cheaper and some of them may not even be compatible with each other. But if I were to build a new machine something like this would be my starting point.

Then throw in 3 or 4 Samsung SpinPoint 1.5TB disks (at 574,00 DKK per disk) and you have a neat little server.

One thing I haven’t been able to find is a nice and simple way to boot from an SD card. I would love to be able to keep the actual hard disks as pure data disk – and being able to perform system upgrades (and rollbacks) by simply swapping in a new SD card would be really sweet.

Intel Desktop Board D510MO

The onset of insanity

I am starting to feel like these are the ramblings of Colonel Kurtz from Apocalypse Now! or Jack from the Shining. All camping and no relaxation makes me a dull boy…

At least the weather is nice today – a bit windy, but the sun is shining. And even though I think everything suck right now the wife and kids are having the best vacation ever.

The best news of the day was that we are going home a day earlier than planned as the in-laws are coming to pick up their mobile home today.

Tonight I sleep in my own bed in a house with solid walls and roof.

Going home for a while

Today we had guests coming once again and as the weather looked really bleak we decided to go home for the afternoon and meet with the guests there – we didn’t fancy the idea of having to be 8 people crammed together in a smallish mobile home.

Home, sweet home… It felt good to have actual walls and windows again – at least for a short time.

When we got back to the camping area we had dinner and then went out for ice cream. The kids were both so tired they couldn’t finish their ice creams so we rather quickly ended up back at the mobile home and put them to bed. Why is it that kids stop being tired the second their heads hit the pillow?

Yet another cold evening.

Avec water slides

The water park was small but overall very nice. The water was pretty shallow everywhere and there was a good water slide. However they played a mean game of “hustle the tourists”. At the camping area we bought cheap tickets for the water park but when we got there we found out we had to buy inflatable arm bands for the kids as that was a “safety requirement” – and the price was about 5 times as much as they would have in the town 2 minutes away…

While we were in the water park the weather improved dramatically.

We rented a “family bike” with room for 4 people, loaded the kids up with candy and went driving around the camping area for an hour. This was followed by a light dinner and a foam party. I wonder what the ingredients are for the foam?

The night once again brought rain.

Lots and lots of foam!