An example of provisioning and deployment with Ansible

Posted on 22 May 2013.

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

A comment on the causes of burnout

Posted on 30 Apr 2013.

While browsing the web, I came across a very insightful comment on burnout by Isaac Yonemoto. I'm surprised that, with all the writing that's going on about burnout and how to combat it, this isn't more common knowledge (it's certainly the first time I hear about it).

Because Disqus comments don't work well for me (and for my own memory), I decided to reproduce the comment here:

No. Burnout is caused when you repeatedly make large amounts of sacrifice and or effort into high-risk problems that fail. It's ...

Continue reading

Better password reset procedures

Posted on 29 Apr 2013.

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

Monitoring your system's temperatures with Python

Posted on 11 Jan 2013.

I have suddenly noticed that my computer's fans have been more noisy than when I first bought it, and now it's driving me crazy. I wondered if I could cut the fans' power without increasing the temperatures inside the case too much, or even leave the case open. To test it, I spent five minutes writing a small script to monitor temperatures in Python, using smartmontools and lm-sensors.

This is that script:

Continue reading

How to replace a Django model field with a property

Posted on 11 Dec 2012.

If you use Django for your web apps, you will probably have come across a situation where you need to run some custom code on assigning a value to a model field. You've probably hacked around this by overriding the save() method or some other arcane hackery, but this is not only unnecessary, but it's more complicated than it should be.

You can use a Python property to add a getter/setter to the field and run your custom code there. Even better, you don't even have to ...

Continue reading

Proxying two connections in Go

Posted on 12 Nov 2012.

I have recently taken an interest in the Go programming language (or golang, thanks, unsearchable name), and I thought that a fun weekend project would be to write a Postgres connection pooler that didn't require separate authentication, and just passed through to the database the credentials it got from the client.

Mid-way through the implementation, I realized that this wouldn't work due to the way Postgres does authentication, but I had written the pooling already. To do the proxying of sockets back and forth, I wrote two small snippets that might be interesting to someone.

The first snippet ...

Continue reading

Adding a "login as user" button to the Django admin interface

Posted on 10 Oct 2012.

Working on Instahero these past few days, doing mostly customer development, I've frequently needed to log in as a user and see what they see, so I could walk them through using Instahero, troubleshoot issues they were having, or better respond to feedback.

To achieve that, I had written a custom authentication backend that allowed me to log in as any user I needed. This worked well, but it was a bit cumbersome because I had to log out and log back in through a custom interface.

I thought a bit, and came up with ...

Continue reading

Developing an IRC frontend in Go

Posted on 12 Aug 2012.

I've recently been considering an idea for a new project, and I've slowly began to code it in my spare time, when I'm not developing Instahero. The basic idea is a bot that will hang out in companies' channels, giving them useful commands, logging, and lots of other functionality.

There are various open-source solutions which one can use to do the same thing, but I think there's also need for a hosted solution where you can just register, enter your room details and get a bot in it in one minute. As a developer, I know my life would be much easier if we had deployment commands, conversions, various searches, bug report notifications, etc available right in the channel where our team spends the day. I'm sure other developers feel that way too, so I started developing Instabot.

Continue reading

A bug of life and death

Posted on 30 Jul 2012.

My software development/consultancy company, Stochastic Technologies, has developed and owns various products. One of these products, Dead Man's Switch, is a service that emails you every few days to check up on you, and sends some e-mails you have pre-configured to your contacts if you don't respond within your selected timeframe.

We recently rewrote the entire thing (it wasn't too big, so the rewrite was quick), to make it more extensible, maintainable, current, &c. The previous version was rock-solid for years, but, somewhere along the line, it came ...

Continue reading

Developing a back-scratching robot

Posted on 9 Jul 2012.

As with all men and many cats, I derive particular pleasure from having my back scratched. When I say "particular pleasure", I mean that I am absolutely crazy for it. I just can't get enough of it. Unfortunately, it is very tiresome for the person doing the scratching, so I never could get anyone to last very long. Even my girlfriend's valiant efforts have been woefully inadequate.

When I realized that no person would indulge my odd fetish without costing me extraneous sums of money, I did what any reasonable man would. I decided to build my very ...

Continue reading