My book, BeagleBone for Secret Agents, is now available

My book, BeagleBone for Secret Agents, is now available. The title is slightly misleading as you need not be a secret agent to enjoy this book. 😉 There are five self-contained projects involving electronics, cryptography, and various software packages but I wanted to write a book that was more than just a collection of projects. In BBfSa, I tried to motivate the social and individual importance of using software like Tor, GPG, and OTR. While the projects are cool, IMHO, I’m hoping that readers will appreciate the need for and difficulty of developing privacy enhancing technologies.

I picked projects that were explicitly more detailed than one could describe in a blog post. Most of them combine hardware and software and I would describe the projects as challenging, but attainable. If you decide to buy it hopefully you not only enjoy it, but learn something as well.

The book is available as a DRM free eBook and as a bound collection of printed dead-trees. I’ve stopped reading with eBooks readers, but there are just over 100 references, most with URLs, and I can appreciate the convenience of using one. You can visit my BBfSa page to see its availability or buy it direct from Packt Publishing.

Thanks to the many people at Packt who helped with the direction, editing, and layout. I was lucky to have very talented reviewers. Lastly, thank you Nate for writing an incredibly insightful forward and to SparkFun, without whom the projects in this book would not have been possible.

Cross-compiling Python 3.3.1 for Beaglebone (arm-angstrom)

I think I became a little too crazy over cross compiling.  For reasons now unknown to me, I decided that I wanted Python 3 on my Beaglebone.  Having just learned how to cross-compile, I was perhaps a bit ambitious.  In the end, I believe I cross-compiled successfully, but I have issues actually running Python 3 on the BB (perhaps due to PYTHONPATH issues?).  Anyway, I’m a bit overloaded with other projects at the moment so I don’t think I can see this through.  But I figured I’d write a post showing at least how to compile. Continue reading “Cross-compiling Python 3.3.1 for Beaglebone (arm-angstrom)”

Feeding Pythons

In these last few weeks, I’ve been working in a slew of programming languages. My OS course involves hacking around in the Linux kernel, so that’s in C. The projects in my AI course have been in Lisp, Java and the next one is in Prolog. At work, I mainly dabble in C++, but I’ve been helping with some continuous integration scripts in Perl and Python.

Out of all these languages, I think Lisp has permanently changed the way I think about programming. Unfortunately, it didn’t really click until after I submitted my project… After working a bit in Lisp and then going back to other imperative languages I found myself thinking of a Lisp-like solution and then realizing, “oh, this is was a lot easier in Lisp!” For example, trying to pass functions as parameters is very easy in Lisp since functions are first-class objects, but to do this in C one has defined a function pointer, which has very specific type definitions and some messy syntax, etc…

So, that led me to find this Google Tech Talk by Peter Seibel on “Practical Common Lisp.” This lecture further cleared up some of the concepts about Lisp (again, after I submitted my project, which I’m still waiting for the grade…) and that lead me to buy Peter’s book: Coders at Work, which is an amazing collection of interviews from great programmers. Anybody who is interested in

Cover of "Coders at Work"
Cover of Coders at Work

programming would find this book intriguing. After I finish it, I’ll put up a post specifically on that book.

Then I set out to make a small project in Lisp and ended up using Python 🙂 I wanted to integrate my Google Reader feeds with Emacs gnus and I found libgreader which pretty much handled all of the details with the still-unofficial Google Reader API. Inspired by reader2maildir, which does the same thing in Ruby, I set out to essentially port this to Python.

And I was able to download my feeds and read them in gnus, but since a lot of the feeds using embedded HTML or simply links to the main article (i.e. they don’t contain a summary) and would require me opening a web browser anyway, I figured the gnus approach wasn’t the best, for me.

But I learned a few things about programming in Python along the way. First of all, one has to be a little more specific while searching Google. Working with RSS Feeds, I realized it’s not adequate to search “python feed” due to the homograph “python.” Unappetizing images aside, I really like the interactive python interpreter. I didn’t really understand the point of using the interpreter directly and I thought it was useful only for toy programs, but it really helps in prototyping. Like Lisp’s REPL (read-veal-print-loop), interactive programming feels like precognitive debugging; it allows one to step through a debugger while the program is being written.

And while Python is not Lisp, it does have some functional style artifacts (much to the chagrin of its designer from what I understand). Python has a filter(function, sequence) function that:

returns a sequence consisting of those items from the sequence for which function(item) is true.

Combine this with a lambda expression, and I was able to write something like this:

filter(lambda x: x.unread != 0, reader.getSubscriptionList())

In this example, this line returns a list of feeds from Google Reader that contain unread items. So, I thought that was pretty cool 🙂 So while I would like to do some more stuff in Lisp, I was impressed on just how easy it was to get python running. That and with some Emacs-python integration, the development environment was very nice to work in.