Stavros' Stuff

Angry rants of programming and other things.

Blogging from the filesystem

DOTA2 LogoIf you see this, run. Away.

I have recently been writing more and more (or, at least, trying to), mainly because I’ve been busying myself with a variety of interesting things and I figured that writing about them could help other people. I am fully expecting to fall back into a DOTA2 binge one of these days and completely cease all productive endeavors, but I’m enjoying it while it lasts.

One of the frustrating things about writing for this website, at least with my current setup, is the interface. I wrote this website in Python using Django because:

Continue reading…

Use two-factor authentication for Mozilla Persona on your own domain

Lately, I have been very happy to see Mozilla’s new proposed authentication system, Persona, gaining popularity. I have tried it in both my capacities as a user and a developer, and, I have to say, it leaves me eminently satisfied in both.

As a developer, it is fantastically easy to integrate. Given how much of a pain all the password change, account creation, password reset, login, etc views (with assorted HTML) were, the 3-minute integration of Persona was a godsend. Since I also don’t need to preoccupy myself with securely storing people’s passwords, Persona wins hands down.

As a user, Persona is very simple to log in. It asks you for your email address, asks you to create a new account (and verify it) if you haven’t been there before (or your password if you have), and you’re logged in. To make things better, it recently got Gmail integration, which means that, if you use Gmail, sites that support Persona effectively now have become “Log in with Gmail” sites, without Google knowing which sites you authenticate on. That’s just fantastic.

There is a bit of a blind spot for people who use their own domains for email addresses, though. If your domain isn’t a Persona identity provider (and most aren’t, by default), you have to log in through the built-in provider. While it does the job, that provider is far from full-featured, only allowing you to sign in with one address and a few aliases.

I wanted something more powerful, so I built a new tool to help manage Persona authentication for your domain. I call it Persowna, and it has a number of very useful features for advanced users or businesses:

Continue reading…

Expandable code blocks in simple CSS3

If you’ve been frequenting programming-themed blogs, you may have noticed expanding code blocks. They’re code blocks that expand when you hover over them, so that text will wrap at a further line and you can read it more easily.

Until today, my blog didn’t have those, and I felt very, very disadvantaged. Why must my code wrap while the other kids’ code is nice and straight? Was I less cool?


Continue reading…

How to properly configure Google Apps email

I, like many of you, use Google Apps for my email, mainly because it is very convenient and has excellent spam filtering capabilities. However, to ensure that messages show up properly and that they don’t end up in spam, there are some steps that need to be taken. In this post, I will give some helpful hints and samples for configuring your Google Apps’ Gmail service so that your messages aren’t classified as spam, and so that the dreaded “via” field doesn’t show up.

The “via” field is something that Gmail adds when you try to send email through it from alternate email addresses (some clients refer to it as on-behalf-of). For example, my main domain is, but I want to send mail from, without running a separate mail server. When incorrectly configured, Gmail messages with a email appear on other Gmail inboxes (and other clients) as “ via”, which is unsightly.

Without further ado, let’s look at what configuration changes we can make so our stuff shows up properly.

Sender Policy Framework

The Sender Policy Framework system uses DNS records to designate permitted sending domains. To designate that an SMTP server can send email on behalf of some domain name, you need to set a TXT record on your domain (the part of your address after the “@”). Here’s mine:

Continue reading…

On the pitfalls of A/B testing

You’ve (hopefully) heard many things about A/B testing. People rave about it, and with good reason: It provides you with a solid framework on which to evaluate how a change you’ve made has affected your metrics. Gut feeling isn’t always enough, and hard numbers help tremendously in decisions. However, most people (and software packages) make a grave mistake when A/B testing. This post will help you recognize and avoid it.

In case you’re unfamiliar with A/B testing, here’s a small run-down (it might get a bit technical, but shouldn’t be too bad):

Continue reading…

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…