Stavros' Stuff

On programming and other things.

Netflix for the rest of us

OMG Netflix in Greece!

If you’re nothing like me, you watch a lot of shows and movies, which means you must have heard of the wonder that is Netflix. Tens of movies and shows, all ready to stream in high definition at a moment’s notice for a very cheap monthly fee, what’s not to love? Well, apart from the MPAA not letting them have a larger selection, and the MPAA not letting them work outside the US, not much!

There’s a bunch of services like Netflix that don’t work outside the US, which is an affront to my human rights and sense of entitlement, so I took it upon myself to make watching Netflix and listening to Pandora just a bit easier. To this end, I created a

Continue reading…

Calling single-argument methods in Django templates

No longer are your methods confined to bare calls!

One of my pet peeves when it comes to Django is that you can’t call methods that require arguments in templates. While this is fine most of the time, it does mean that you need to have one property or method per call you want to make, which sometimes gets very cumbersome.

I needed a way to define various dynamic permissions that are calculated at runtime (for irrelevant reasons, Django’s permissions framework wasn’t a good fit), and writing properties like can_register, can_add_tags, can_subscribe got tedious. These tended to be defined all over the place, rather than in one central spot, and it was hard to add more checks without cluttering the classes.

I would much prefer to have a single method (let’s call it can()) that accepted a string with the permission I wanted to check, and return True or False, depending. This is easy to do in the views, but templates would never be able to call it with an argument.

However, since Django can do dictionary-style attribute lookups, I could add a dictionary interface over the method, and allow

Continue reading…

Get a text when there's motion in your house

Who needs friends when you have an Arduino?

Like every person, I have a burning desire to know who’s in my house when I’m not. A few months ago, I decided that I had had enough of the uncertainty of my extradomicilial activities, and that I needed to do something about it. I realized that I had two options. The first option would be to hire someone to be in my house 24/7, but that would get a bit embarrassing when I wanted to watch reruns of Desperate Housewives. The other option would be a motion sensor that texts me when it detects motion.

Luckily, this proved really easy to do with an Arduino. All I needed to get was

Continue reading…

How to safely store your bitcoins

Keep your money close and your bitcoins closer

Let me tell you a story about how this fool and his money were soon parted. About a year ago, I added Bitcoin payments to Dead Man’s Switch, because it seems that people who want to send messages after their death are also the sort of people who don’t like using actual money.

One or two people decided to use that payment method, probably mostly because it was the only thing they could buy with their newly-mined bitcoins, and I was the proud owner of a whole bitcoin, worth about $20 at the time. However, storing it was a bit of a problem, as I would either have to trust a third party with it or use the official client, and store the entire multi-gigabyte blockchain on my computer.

You can probably see where this is going. I didn’t want to store a bunch of gigabytes for $20, so I left my coins on

Continue reading…

I found the Holy Grail of backups

Finally, encrypted, fast offsite backups

UPDATE: As of June 2017 March 2019, this is still current, and the way I still do my backups. So far, it’s been working fantastically well, and I still recommend this.

If you’ve been reading my ramblings for a while, you will remember that I have been looking for a good way to back up my files, without much luck. My requirements are:

  • Encrypted (on the original machine).
  • Fast/bandwidth-efficient (deduplication is a plus).
  • Open-source.
  • Cheap.

My files are mostly code and photos, which aren’t really critical (the critical files are stored in repositories and multiple computers), but losing all my photos wouldn’t be too great. That’s why any backup solution I wanted had to be cheap enough to justify the cost.

Every single piece of software I have ever tried fails in at least one of the above. I currently use SpiderOak, which is everything except open-source, so that fails too.

However, my quest is finally over. I have discovered the Holy Grail of backups, and its name is

Continue reading…

Arduino-powered irrigation system

Control your field's irrigation system with your mobile

A few weeks ago, I was showing my dad my latest project, the Arduino RF remote control, and he lamented the fact that I still hadn’t made an irrigation system remote control for him. We have a few acres of fields that need irrigation, which is done with a system of pipes from a central water pump. At that point, however, the fact that he needed a remote control for the pump was as news to me as it is to you, so I asked him what he needed exactly.

He told me he needed a system that would allow him to call or text a phone number and turn the pump on and off remotely, as well as something that would text him if there was a problem that

Continue reading…

Mozilla Persona accounts with disposable email addresses

Mozilla Persona, now with extra disposable email address

If you follow the news, you’ve hopefully heard of Mozilla Persona, the wonderful new way of centralizing logins on the web. In a nutshell, Mozilla Persona works the same way as the “log in with Facebook” you see on many sites, except that, instead of Facebook, you use your email account to log in. The great thing is that sites never have your password, and you only need to have one password for every site on the web (Persona uses your email address as your username).

One downside of the default implementation is that you have one account per email on the default bridge (this isn’t strictly true, but adding more accounts is cumbersome and not meant to be done for every site). This is a problem for me, as I use the excellent 33mail service to create disposable email addresses for every site I visit.

Fortunately, there is a way to use disposable email addresses as usernames on Persona. Here’s how:

Continue reading…

Remotely controlling IR/RF devices with an Arduino

Control your household devices: Arduino edition

If you’ve been following this site, you’ll know that I’ve been going through lots of alternatives in trying to achieve the Holy Grail of home automation, which is to get my garage door to open remotely with a Raspberry Pi. To this day, I haven’t managed to do that, but I did get some great guides going.

For example, I managed to turn the Raspberry Pi into an infrared remote and control my TV and AC unit with it, and, after that, the next step was to control RF wall sockets, which was also great.

After all this, I connected my house lights to RF sockets so I can control them from the Pi, but having a Pi running all the time is a bit of a hassle. It requires an SD card, a USB hub for the wifi, it freezes sometimes, etc, so I wanted a solution that was less of a complete PC. The obvious choice was

Continue reading…

Developing with pull requests

Pull requests are fantastic

As you may know, my favorite way of beginning a blog post is with “as you may know, my favorite way of beginning a blog post is with ’as you may know’”. As you may also know, for the past year or so I’ve been working with Silent Circle, where I’m part the team that develops the website and backend.

The team is composed of roughly seven people now (developers and designers), and, as it has grown, we have been trying things to find a good workflow that allows us to be productive while staying on top of the changes made to the code by coworkers.

This post is about our needs and the development/release workflow we have arrived at to address them.

Continue reading…