Cyanogenmod (Android) on touchpad
I recently got an android phone (I'm using it to write this blog post, over an ssh tunnel no less) and the joy of all these great apps tempted me to try to install Cyanogenmod's Android port on the touchpad on the weekend. The process was very smooth, and it is working quite well. I got a couple of sleeps of death, but disabling the screen lock seems to have clearwd it up.
Vive les logiciels libres!
HP Touchpad running Ubuntu Linux!
We managed to get our hands on an HP touchpad in the fire sale, and I've been playing with getting Linux running on it. Here are a couple of videos of where it's at so far. About the only thing not working at this point is screen rotation, which I personally don't have the skills to implement. Hopefully the webos-internals crew will get it figured out soon.
A couple of key tools making it workable on the tablet are easyswipe for gestures and onboard for the onscreen keyboard. I had to build my own onboard keymap for the device. The desktop environment is LXDE, to keep things light and snappy.
For instructions on how to do this, check out this thread at precentral. The first post will get you into a basic Ubuntu environment, then my instructions on how to get to a nice desktop are down on page five of the thread.
sshuttle – really, really simple ssh-based VPN
I discovered sshuttle today, which is a really simple VPN over SSH, which works on Linux, BSD and MacOS clients. It requires no set-up on the server, just an unprivileged ssh account and python. Once you've downloaded it, which is as simple as using apt-get (in a Debian-based OS) or a git command, all you need to do to tunnel all your traffic over SSH to a remote server is:
sshuttle --dns -vvr username@sshserver 0/0
And voila, instant security. I will definitely be using this when I'm on public wifi in the future.
Resizing the Current Terminal from the Command Line
In switching my email off of the cloud, I'm going back to my old favourite mail client, Mutt. I've found the site My First Mutt helpful in (re-)discovering Mutt's capabilities.
One thing, though, that I was frustrating me is that the default terminal size is too small for mutt with the sidebar patch (the mutt-patched package in the Ubuntu repositories). Since I don't particularly want to keep a terminal with mutt open all the time, I want to be able to quickly open it and have it usable. I have F2 set up to directly open a terminal, and mutt aliased as "m," so it takes me 3 keystrokes (F2-m-Enter) to launch my email. I don't want to have to futz with the mouse to resize the window every time. Enter wmctrl, a CLI utility for controlling windows. The following command embiggens my Mutt window to just the right size:
wmctrl -e 0,-1,-1,810,560 -r :ACTIVE:
The numbers are the new position & geometry; 0 is gravity, which signifies an approximate location on the screen (0 is default), the -1,-1 is for new x and y coordinates, -1 indicates do not change. The final two are the X-Y sizes, and -r :ACTIVE: tells wmctrl to modify the active window, which should always be the terminal where this is run (wmctrl also allows things like selecting a window by its title). My whole mutt alias winds up being:
wmctrl -e 0,-1,-1,810,560 -r :ACTIVE:; sleep .2 ; pushd; cd $HOME/Maildir; mutt; popd
the sleep gives a brief pause so mutt doesn't start before the window finishes resizing, and the pushd and popd change the directory to my Maildir and back again (if you don't know pushd and popd, check them out, they're quite handy!)
Unity indicator applet: maildir check
UPDATE: My code was found by another mutt user and modified, his changes are here, and I've changed it a bit more here. It now integrates with the unity messaging menu and shows notifications like it should!
As I mentioned in my last post, I've been transitioning to a local Maildir for my email. One downside to this is that the mail indicator included with Ubuntu's Unity desktop requires you to run Evolution to get mail updates. Now I know it also works with certain other MUAs (ie, Firebird), but I like Mutt, so I just wanted a simple indicator in Python to check my Maildir. So I did some googling and found some examples of indicator applets in Python, and coded up as simple applet. Voilà:

So all it does is poll my Maildir, and turn the icon red when I have messages; pretty simple. As you can see I currently have two little mail icons in my indicator; that's because I'm not integrating at all with the Ubuntu messages indicator. If I get a coding itch I'll investigate doing that. Other things I'd like to add are configurability for mailboxes as well as MUA of choice (the Config menu item is just a stub right now) and popup notifications for new messages. If I get those things done I might actually feel inclined to submit the code to someone, somewhere. For the moment, I'll leave the code here in case anyone wants example code of a really simple indicator applet. Feel free to do whatever you want with this code.
#!/usr/bin/env python
import sys, os, gtk, appindicator
CHECK_FREQUENCY = 60 # seconds
MAILDIRS = [ "/home/brad/Maildir/" ]
DEBUG_LEVEL = 0
class mailIndicator:
def __init__(self):
self.ind = appindicator.Indicator ("debian-doc-menu",
"indicator-messages",
appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_status (appindicator.STATUS_ACTIVE)
self.ind.set_attention_icon ("new-messages-red")
self.buildMenus()
self.ind.set_menu(self.menu)
def buildMenus(self):
self.menu = gtk.Menu()
self.mutt_item = gtk.MenuItem("Launch Mutt")
self.mutt_item.connect("activate", self.launch_mutt)
self.mutt_item.show()
self.menu.append(self.mutt_item)
self.maildir_item = gtk.MenuItem("Configure Maildir(s)")
self.maildir_item.connect("activate", self.maildir_clicked)
self.maildir_item.show()
self.menu.append(self.maildir_item)
self.quit_item = gtk.MenuItem("Quit")
self.quit_item.connect("activate", self.quit_clicked)
self.quit_item.show()
self.menu.append(self.quit_item)
def run(self):
self.check_mailbox()
gtk.timeout_add(CHECK_FREQUENCY * 1000, self.check_mailbox)
gtk.main()
def maildir_clicked(self, widget,data=None):
# stub
m = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, "STUB")
m.run()
m.destroy()
def quit_clicked(self, widget,data=None):
sys.exit(0)
def launch_mutt(self, widget,data=None):
os.system("gnome-terminal -e mutt &")
def check_mailbox(self):
DEBUG("Checking Maildirs")
newmail = False
for maildir in MAILDIRS:
newmail = (newmail or (len( os.listdir(maildir + "new") ) > 0))
if newmail == True:
self.ind.set_status (appindicator.STATUS_ATTENTION)
DEBUG("new mail detected.", 2)
else:
self.ind.set_status (appindicator.STATUS_ACTIVE)
DEBUG( "no new mail detected.", 2)
return True
def DEBUG(message, level = 1):
if DEBUG_LEVEL >= level:
print message
if __name__ == "__main__":
indicator = mailIndicator()
indicator.run()
Encryped mailbox on mailserver
I've been playing with a bunch of security/crypto software lately and am considering migrating my mail server off of Google Apps to my own server. In considering potential setups, I thought it would be nice to be able to have my mail server encrypt all incoming mail before storing it. That way, if ever the server is compromised, there is no way that an attacker could read my email. The flow I wanted was to have Postfix deliver to Procmail, which would encrypt the message with GPG to me, then store it in the server-side maildir. The encryption is done asymmetrically, so only my public key is stored on the server -- the messages cannot be decrypted until I have downloaded them onto my machine.
Before implementing all this, I decided to Google whether anyone else had done it before, and I found this wiki page that laid it all out like child's play. I guess I'm not quite as original as I had thought. That's ok, though -- it was simple, it works, and it's effective.