Stavros' Stuff

On programming and other things.

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 korokithakis.net, but I want to send mail from stavros.io, without running a separate mail server. When incorrectly configured, Gmail messages with a stavros.io email appear on other Gmail inboxes (and other clients) as “whatever@stavros.io via stavros@korokithakis.net”, 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.

Enjoy!

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:

django-admin.py 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 stavros.io 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 korokithakis.net, 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…