Stavros' Stuff

On programming and other things.

New theme!

After the new domain name, this blog now has a new theme as well! It should hopefully be much, much better (i.e. actually not horribly broken) on mobile, plus the contrast is better and the text is much cleaner now.

It’s not completely done yet (I still want to add post archives to it), but it has the same features as the old one.


Continue reading…

Automated, large-scale deployments with Ansible's pull-mode

If you’re a regular reader of my blog, you will know two things about me:

  1. I like Ansible.
  2. I frequently begin posts with “if you’re a regular reader of my blog”.

I recently discovered that Ansible got a “pull mode”, which is a super-simple way for Ansible to pull a repository and run commands from a file you specify. Unfortunately, documentation is pretty sparse, but that’s only a disadvantage until you realize that pull mode is really, really simple.

What “pull mode” is.

“Pull mode” is a single, very simple script. You can invoke it with ansible-pull, and all it does is what is described in its man page:

Continue reading…

Django template projects

If you haven’t heard yet, let me break the good news to you: Django 1.6 is getting template apps/projects. This means that, when starting a new project, you don’t have to copy your old directories and change stuff around any more, you can just put them into reusable directories (or even repositories) and Django will be able to use them very simply: startproject --template=/djtemplates/default myapp

I’ve been needing a feature like that for ages, and now I’m giddy with excitement, so, without further ado,

Continue reading…

Writing my first Android app: Control your Raspberry Pi from your phone

If you’re a regular reader of my blog, you will have noticed that I recently went on a Raspberry-Pi-fueled, hardware hacking binge, first using it as an infrared remote control and then applying the same principles to make it into a RF remote control, thus mostly controlling my entire house in this fashion.

This is the IR setup in action:

Continue reading…

New domain name!

The sharp-eyed among you will notice that this site just got a new domain name. I got for three reasons:

  • It was available (plus now it’s a gTLD, so that’s great).
  • The .io TLD is more geeky.
  • It’s shorter and much easier to pronounce than, which made giving out my email address really hard.

Hopefully now it will be much easier for you to remember (and tell your fr

Continue reading…

How to remotely control RF devices with the Raspberry Pi

The RF transmitter/receiver pair

After my wildly successful post How to turn your Raspberry Pi into an infrared remote control, which was mainly a list of various resources and instructions on how to record and replay infrared signals with the Raspberry Pi, I am writing the second instalment, on controlling RF devices with it.

I’ve long wanted to control my garage door from the internet (because apparently I love making useless enhancements to things that run on electricity), but I couldn’t figure out the codes it sends. Even though I could, in theory, use the Raspberry Pi as a poor man’s RF transmitter (hint: don’t do this because of the noise, and it doesn’t work anyway because of kernel timings), I didn’t know what to transmit with it, and I couldn’t find the protocols anywhere online.

To help in this herculean task, I bought an RF transmitter/receiver pair (pictured on the right) from eBay for around 1 euro (with shipping), which can decode received signals (and send them again).

Continue reading…

How to turn your Raspberry Pi into an infrared remote control

A few months ago, I bought a Raspberry Pi, and it’s been the best recent purchase I made, by far. Not so much because I have that many things to do with it, but because it features a few GPIO pins, which you can control with software and make output ones and zeroes (basically high and low voltage).

This has opened a whole new world to me, as, before this, software and hardware were completely sep

Continue reading…

An example of provisioning and deployment with Ansible

It has recently come to my attention that many people don’t use virtual machines for development, instead polluting their system with various dependencies and making life harder for themselves. Unfortunately, even the people who do use VMs for development often perform provisioning and updates by hand, thus ending up with slightly different configurations for development, testing and production, which often leads to uncaught bugs on production.

In this post, I will not only attempt to detail some best practices I’ve learned, but I will also list provisioning and deployment configurations that will make this a one-command process.

The easiest way to do repeatable deployments is to create scripts which will handle everything for you. By the end of this post, you will be able to get from a new installation to a complete Django/postgres/gunicorn/redis stack running (and accepting users) with one command.

Continue reading…

Better password reset procedures

In the past few months, we’ve seen a series of high-profile account breaches that gave control of users’ accounts to malicious thieves. I’m sure many will remember the Matt Honan hack, where an attacker was able to gain access to the journalist’s accounts and wipe his devices by fooling Apple support into resetting his password for them.

More recently, Skype proved to be vulnerable to the same attack, which is really bad news for password resets in general, because there’s really no good way for someone to guard against this. If you haven’t specified an email address (or if you forgot the password for your email address), how can a provider authenticate you? They will have to use security questions, or information about your account, or other ways of doing it.

Security questions are usually very low entropy, much lower than the actual password, and thus they should probably be discouraged. Unfortunately, many services (including banks) use them.

Continue reading…