Luapress v3(.2)

Mon 14 December 2015

Recently static website generators have been gaining lots of attention. Inspired by this I have been working on a new major Luapress version, targetting some of the annoyances I find when building this blog with it. A couple of weeks ago I released v3 and two additional minor versions; this post runs through some of the more exciting features and changes:

Environments

With v2, you could pass in a URL to build against, and manually switch from the default build output directory using --build. v3 removes this option in favour of environments defined in config.lua. For example, this site's config:

config = {
    -- Default URL (pointing to default build/ output dir)
    url = 'localhost/Pointless Ramblings/build',
    ...
    envs = {
        -- Build against this URL, outputting to production/
        production = {
            url = 'http://pointlessramblings.com',
            build_dir = 'production'
        }
    }
}
Read more →

selected.js

Sun 25 October 2015

selected.js is a dependency free <select> replacement. It supports both single and multiple select boxes, has a tiny JS & DOM footprint and is incredibly easy to style.

Setting this up is as simple as:

<link type="text/css" rel="stylesheet" href="selected.min.css" />
<link type="text/css" rel="stylesheet" href="selected-light.min.css" />

<select multiple class="selected selected-light">
    <option>Option one</option>
    <option>Option two</option>
    ...
</select>

<script type="text/javascript" src="selected.min.js"></script>
<script type="text/javascript">selected.init();</script>
Read more →

Querying 50k Gameservers in 100 lines of Python

Wed 29 July 2015

A long while back I built a built a web app which provided search and aggregated stats for Valve gameservers. At any time there are ~50k of these registered with the "master server", but only 20-40% of these are accessible publically. The original collector was written in PHP and would take about 20 minutes to discover and collect stats from the gameservers. I have rebuilt the collector in Python and it's able to collect all ~50k servers in under a minute, given a suitable (>=100mbit) connection.

In this post I'll outline how we can build such a collector. To do so we'll make use of two wonderful Python packages: gevent allows us to fire off requests in parallel which is essential to achieve the speeds desired and python-valve talks the Valve master and game server protocols. The two parts of the collecting process are a) read server addresses from the master server and b) read information directly from each server.

Read more →