Archive for June, 2011
For a while I sued pwsafe to keep passwords. I even went so far as to hack up scripts to make it easier to user.
However it didn’t play very well with some clipboard managers, in particular kupfer – a better version of gnome-do. So I decided it was time to move on so I moved over to keepassx. However their was the problem of copying all my passwords over.
I ended up hacking up a script to create a keepass xml file for this, here is the script
from genshi.template import MarkupTemplate
def __init__(self, **d):
self.__dict__ = d
TEMPLATE = ”’\
lines = [l for l in sys.stdin.readlines() if not l.startswith('#')][1:]
dialect = csv.Sniffer().sniff(”.join(lines))
entries = 
for (_id, _group, title, username, password, notes) in csv.reader(lines, dialect=dialect):
entry = Bunch(username=username, title=title,
now = datetime.datetime.now()
output = MarkupTemplate(TEMPLATE).generate(entries=entries, now=now).render()
Hopefully this script is short enough that you can read it and understand what it does before running, because if I were you I wouldn’t run random scripts on a password database without understand what they were doing *very* well.
R has more maths libraries than python and they easy to use. This is good because it means you don’t need to code things yourself badly.
I’m learning some R at the moment and really liking it. This may be because I’m not trying to do anything large. I’d previously written this off thinking that I could do everything I needed in scipy, this was a somewhat large error….
From what I can tell R is a do what I mean language for data analysis and statistics, whose entire reason for being is to make it easy to do things single line commands in an interpreter.
People say that the following things go wrong in high level do what I mean languages:
* Impossible to understand code (a la perl), hundreds of ways of doing things
* It becomes difficult to work out what exactly is going on. (People can understand brain dead control commands, but perhaps not magic ones)
* Composition becomes very difficult, lots of pieces that work well – but they don’t work well together.
* Your error is probably someone else’s intent, so it becomes hard to debug.
I’m waiting to see these effects, but it’s rather difficult to distinguish, “this is hard” from “I don’t know the correct idiom for this” or “I don’t know how to do this”.
The following code will record your weight to a cgi script on a server that you have.
Weight 15 10 %WEIGHT my.url.com
11610 3 Weight %WEIGHT
Modify this to point at your server, which has the following cgi script
#!/usr/bin/python import cgi import os import sys import datetime print 'Content-Type: text/plain\n\n', method = os.environ['REQUEST_METHOD'] if method == 'GET': print file('data').read() elif method == 'POST': f = file('data', 'a') try: f.write(datetime.datetime.now().isoformat()) f.write(' ') f.write(sys.stdin.read()) f.write('\n') finally: f.close() else: raise Exception('Bad method')
Needs a server
Privacy through obscurity
Easy data syncing.
You can create a link to this task on your phone-top.