Colourful console text

A test using a github gist. You might have to refresh the page to see it:

The code just outputs some red text in a console. And that’s it. The code, hosted directly on this side is here:

#include <iostream>
#include <string>
#include <windows.h>

int main(int argc, char const *argv[])
{
    HANDLE hConsole = ::GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo;
    ::GetConsoleScreenBufferInfo(hConsole, &consoleScreenBufferInfo);
    ::SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
    DWORD bytesWritten = 0;
    std::string msg("Hello there!\n");
    ::WriteConsole(hConsole, msg.data(), static_cast<DWORD>(msg.size()), &bytesWritten, 0);
    ::SetConsoleTextAttribute(hConsole, consoleScreenBufferInfo.wAttributes );

    return 0;
}

Static Web Site Generators

Recently, I’ve noticed that there are a few static web site generators becoming popular again. CityDesk by Fog Creek used to do this, but now there is Jekyll, Hyde, and Octopress to name but a few.

Over the years, web sites have evolved from static ones, where the only attack surface was the web server they ran on, to dynamic sites where PHP, and ASP.NET, amongst others, were subject to security issues.

With the increase in browser-side power, and the widespread use of AJAX, it now means that once again, websites can be generated statically, but comments can still be added via services such as disqus whilst having static HTML pages.