June 2015 Archives

terminal whispering and pudb

| No Comments
I just watched a talk on doing cool things with terminals in python. That talk mentioned pudb, an interactive debugger for python. That looks even more useful than just pdb (which is already very useful). I'm looking forward to trying it. Maybe soon I'll change my habits and replace "import pdb; pdb.set_trace()" with "import pudb; pudb.set_trace()".

Especially as http://stackoverflow.com/questions/22412416/how-to-debug-unittests-with-pudb-debugger suggests that's only way to debug your unittests with pudb.

Another thing from that talk that looks interesting is ptpython (written using PPT). 

KeePass2 selections

| No Comments
I use KeepassX to store passwords for personal passwords, and for work. On recent OS X installs KeePassX dropped support for the version 1 file format. But on my linux desktops there is no new KeePassX that supports the version 2 file format.

Fortunately someone packaged KeePass2 for Debian, a .NET app that runs under Mono. Unfortunately there is a problem with copying the password from KeePass2 into applications. http://ubuntuforums.org/showthread.php?t=1891919 is another user having the problem. http://www.sparrowtail.com/linux-and-its-schizophrenic-clipboards is where someone worked out what was going on, an explained it. http://www.nongnu.org/autocutsel/ is some software that provides the solution.

It seems in an X-Window system there is an old and deprecated cutbuffer, where applications can store text. Then there is a modern scheme called 'selections'. Supposedly applications these days use a 'PRIMARY' or a 'CLIPBOARD' selection, and perhaps the mono app uses the cutbuffer. the autocutsel tracks the cutbuffer and a selection (defaulting to CLIPBOARD) and copies text between them.

But that explanation from sparrowtail.com is from 2010, and autocutsel doesn't sort this out for me. The autocutsel package includes a "cutsel" tool that shows you what is in the cutbuffer and the selections. My testing shows that if I highlight something in a gnome terminal, it does show up in the PRIMARY selection. If I do a Shift+Ctrl+C copy it does show up in the CLIPBOARD selection. In KeePass2 if I do a copy it also shows up in the CLIPBOARD selection, (until a timer, and then KeePass2 removes the selection, and 'cutsel' reports Nobody owns the selection.

And while the copied password is in the CLIPBOARD selection (owned by KeePass2) I can past it in GVIM. But I still can't paste it into a terminal. 

After reading https://en.wikipedia.org/wiki/X_Window_selection, I suspect an active selection process is occurring, and for some reason KeePass2 is refusing the paste when the other application is a terminal. Continuing to read that suggested I might be able to run xclipboard (to take over the selection). But I'm told another clipboard is already running when I launch it. https://lildude.co.uk/howto-use-xclipboard-with-gnome/ suggests gnome includes it's own clipboard manager now. So I installed glipper, which describes itself as a "Clipboard manager for GNOME". Given that gnome is already a clipboard manager, I'm assuming this will expose some GUI controls so I can interact with the clipboard.

And it kind of does. It keeps a copy of your clipboard. I still can't paste to gnome terminal when KeePass2 has control of the selection, but I can click on the glipper icon in the notification area to select the password from the history list, and then I can paste it. 

So now I've got sensitive passwords being kept in a history, but I can paste them where I need to. This seems to have been a very unhealthy dose of yak shaving.

html slides presentation software

| No Comments
I've submitted a talk proposal for http://2015.pycon-au.org/, and yesterday I was notified it was accepted. Hurray! I figured I will need to write some slides. After a bit of googling I decided I wanted to try out https://code.google.com/p/io-2012-slides/. Downloading it was easy, but the README says to edit the CSS they use something called SCSS, with a ruby compiler, and that I should run:
sudo gem update --system
sudo gem install compass
Now, I don't really understand ruby or gems, so I tried this without using sudo. And it didn't work. That's probably my fault.
But instead of doing that, I did amkvirtualenv landslide, then did pip install landslide. And now I'm going to use https://github.com/adamzap/landslide instead.