TurnKey Linux Virtual Appliance Library

load any external javascript file asynchronously

Sticking <script></script> tags referring an external resource in the middle of your HTML code will hang the loading of your page while your browser gets the missing script.

On the TurnKey website, this was a problem with the loading of the AddToAny sharing script, and the quantcast tag which I have since removed. There were also a couple of custom scripts that slowed down the site.

The solution is generic and simple. Use this code to load your Javascript asynchronously:

Unix buffering delays output to stdout, ruins your day

Let's say you have the following program:

cat>example.py<<'EOF'
#!/usr/bin/python
import time
while True:
    print 'hello world'
    time.sleep(1)
EOF

chmod +x ./example.py

If you run this program from a terminal, it will print hello world every second.

But redirect the output to a file and something different happens:

./example.py > output &
tail -f output

You won't see any output! (At least not for a long while)

Reflections on the correlation between intelligence and success

Having recently reread Malcolm Gladwell's excellent book: Outliers - the story of success, I've been thinking about the correlation between high IQ and success in life. I think I may have come up with a nice way to clarify Malcolm Gladwell's conclusions. Malcolm writes that to succeed in a given field you need to pass a certain threshold of intelligence, but that having more intelligence than the required threshold will not increase your chances of success.

comment spam countermeasures (mollom, honeypots, hashcash, bad behavior)

The spam situation has recently gotten a bit out of hand and automated defenses have been giving in.

I've taken a close look at the problem and implemented a gauntlet of spam countermeasures that I'm hoping will give us back the upper hand for a while longer, without compromising on the user experience.

Previously, we only used mollom to filter out comments by anonymous users. This was easy to get around for two reasons:

Good design is harder than it looks

A few months ago I worked a couple weeks on a new website design. Just to be clear website design isn't one of my specialties. Not be a long shot. I'm much more of an engineer at heart. That means I feel more comfortable coming up with solutions I can test objectively. Visual design doesn't fit the bill. It's more art than engineering. Open-ended. A seemingly infinite solution space. No clear fitness function that doesn't involve wishy washy, vague notions like taste and style.

Website monetization primer: how online advertising works

Money. A tricky subject to bring up. It's been proven that merely activating the concept will induce selfishness. But bear with me here. This is a public service announcement, not a get rich quick scheme.

If you have a website that gets a reasonable amount of traffic, you've probably considered adding advertising at one point or another. Maybe you're dreaming of quiting your day job to work full time on the site or maybe you just want to cover some basic costs.

Two simple ways a script can detect if it's online

I didn't want installation of one of TurnKey's components to freeze up too long if it was installed offline so I looked for a nice way to detect that without bringing in additional dependencies.

Two methods stood out...

  1. ping Google DNS servers: one second constant delay, regardless if you're online or off:

GPL2 vs GPL3

Some people don't like the GPL3 and prefer to use the GPL2 license. We use GPL3. Just in case I missed something I just finished comparing the GPL3 to the GPL2 in detail and confirmed that we like the GPL3 better.

The main differences:

Security update regenerates stale SSH ECDSA host key

Peter Lieven from KAMP.de discovered a problem with TurnKey 13.0 where the OpenSSH ECDSA key is not regenerated on firstboot like the RSA and DSA host keys.

We've issued a signed hotpatch to TurnKey Core 13.0 that regenerates the ECDSA SSH host key. TurnKey deployments that have not disabled automatic security updates (it's on by default) will have their ECDSA SSH host key regenerated automatically within the next 24 hours.

configuring libresolv to timeout DNS queries to unreachable nameservers more quickly when offline

When I go offline I pull my network cable. This causes DNS queries to take forever to resolve. Actually 40 seconds but it feels like forever.