Setting up Pelican Blog

Mon 15 August 2016 by David Hontecillas

I imagine that this is always the very first post when you set up a blog that is not hosted in any major platform like Wordpress or Blogspot.

I was looking for something simple, where I could use markdown to easily write posts. Since I have already toyed with Pelican, it covers my needs and I know Carlos Carrasco is already happy using it, i did not take too much time to evaluate alternatives like Nikola or Hugo Blog.

For hosting I use AWS S3: cheap and easy to deploy. (Using google you will find several posts about how to do it, like this one that also explains how to use the AWS CDN for your Pelican blog )

I took the tuxlite_tbs theme and modified a couple of css colors for a minimal personalization.

iPython notebooks

I sometimes test stuff with Jupyter notebooks, so I thought it would be nice to integrate them into the blog. I've followed the setup described in blog: How to setup a Data Science Blog but, since i'm not focusing on data science (most of my posts won't use Jupyter notebooks) I preferred to use the second approach of using liquid_tags plugin to embed the notebooks.

Jupyter notebook test

{% notebook setting_up_ipython_blog.ipynb %}

Some python code test

from datetime import datetime
import json
import logging
_l = logging.getLogger('mfcommon.controllers')


class CompetitionEventInformation(object):
    def __init__(self):

    # def _canFinishPlanification(self, valid_state_transitions, result):
    #     if 'disabled_valid_state_transitions' not in self.result:
    #         result['disabled_valid_state_transitions'] = {}
    #     return result

    def transitionsInformation(self):
        valid_state_transitions = self.comp_ops.validStateTransitions()
        self.cese = CompetitionEventStatesExplanations()
        res = {}
        for x in valid_state_transitions:
            r = self.cese.stateInformation(x)
            res[x] = r
        return res

    def championshipInformation(self, championship):
        c = ChampionshipClashScheduler(championship=championship)
        is_scheduled = c.isScheduled()
        info = {'scheduled' : is_scheduled}
        if is_scheduled:
        return info

def print_a_and_b(a, b):
    print("{} -> {}".format(a, b))

And a little bit of C++

#include "bsdconnection.h"

#include <string>
#include <cstring>
#include <cerrno>

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>

using namespace std;

bool BSDConnection::sendBuffer( unsigned long size,
                                char *buffer )
    if( size == 0 ){
        return false;
    unsigned long offset = 0;
    bool err = false;
    while( !err && offset != size ){
        long res = send( socket_, buffer + offset,
                         static_cast<ssize_t>( size - offset ), 0);
        if( res >= 0 ){
            offset += res;
        }else if( errno != EAGAIN ){
            err = true;
    return !err;

And a little test image to finnish the first post:

I feel like I could take on the world