Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten
Fork me on GitHub
Posts tagged as blog

We-Blog with clouds

2013-04-06 (133) by Ton Kersten, tagged as blog

Today I received an email from Chris Hackenschmidt with a patch for a category cloud for my We-Blog program.

Of course I have implemented that and you can see it in action on the right.

So, a new version of We-Blog is out, currently still 0.9, with a big Thank You to Chris.

Download it and enjoy.

New version of We-Blog

2012-07-10 (122) by Ton Kersten, tagged as blog, code

Today I released version 0.8 of We-Blog.

I created a Google project and a Google discussion group.

Version 0.8 is now the stable branch and 0.9 the development branch.

What's new?

Well, to be really honest, not that much. I fixed some minor bugs and did a lot of code cleanup. Although the original code of Jaromir was very nice, there was some room for improvement. I removed a lot of double functions and variables and put them all together in a We.pm Perl module. Saves a lot of work with an update.

What the *F*

2012-06-29 (118) by Ton Kersten, tagged as blog, spam

I'm registered as a Computable expert and as required I do have a profile page on their website.

And now I get this (partially in Dutch):

Beste Ton Kersten,

Via je profielpagina op Computable.nl stuurt gift d evals je onderstaand bericht.

Met vriendelijke groet, Redactie Computable

Contact me with this email giftevals@yahoo.com

Hello am Gift i am 23 years old single. After seen your profile i became interested in you,so i decide to write you for us to build a good relationship if you don't mind,you can email me but (giftevals@yahoo.com)

They are sending me spam!!!!

Maybe it's about time I do a mail server hardening consultancy job smiley

Updated Pygments

2012-05-16 (112) by Ton Kersten, tagged as blog, puppet, pygments, sysadm

I'm using Pygments for quite some time now and I just noticed there was a new version available (1.5). I installed that and I was wondering if there would be a lexer included for Puppet. Well, it wasn't, but a short Google action directed me to the Pygments lexer for the Puppet DSL.

Of course my old CentOS 5 system with Python 2.6 doesn't want to install this, so I hacked the Puppet lexer into Pygments.

Here's an example of the result:

class generic::ssh {
    $ssh_service       = hiera("ssh_service")
    $ssh_packages      = hiera("ssh_packages")
    $ssh_debug         = hiera("ssh_debug",         "undef")
    $permit_root_login = hiera("permit_root_login", "no")
    $ssh_users         = hiera_array("ssh_users",   "undef")
    $ssh_groups        = hiera_array("ssh_groups",  "undef")

    package { $ssh_packages:
        ensure => present,
        before => File["/etc/ssh/sshd_config"],
    }

    file { "/etc/ssh/sshd_config":
        ensure  => present,
        content => template("generic/sshd_config.erb"),
        notify  => Service["${ssh_service}"],
    }

    service { $ssh_service:
        ensure     => running,
        enable     => true,
        hasrestart => true,
        hasstatus  => true,
    }
}

and an example of the Hiera Yaml file:

---

# SSH Settings
permit_root_login    : 'no'
ssh_service          :
                       - 'sshd'
ssh_users            :
                       - 'root'
                       - 'tonk'
ssh_groups           :
                       - 'wheel'
ssh_packages         :
                       - 'openssh'
                       - 'openssh-clients'
                       - 'openssh-server'

Nice smiley

Working on We-Blog

2011-10-07 (107) by Ton Kersten, tagged as blog

At the moment I'm working on We-Blog. I added an 'alt' tag to pages. The defined text will be shown on 'mouse-over' when you hover over the page link.

This is part of We-Blog 0.8. This release is not stable yet, but the current code is already on GitHub.

Blaze blogger emoticons

2011-07-15 (103) by Ton Kersten, tagged as blog

In my original Markdown setup I had some smilies, or emoticons, defined that could be used in the posts. As Python Markdown lacks that I decided to hack it into BlazeBlogger. The only reason being that I can hack Perl and I can't hack Python.

In the .blaze/config I now have an option called smilies that points to the top of the directory containing all smiley images. If this option is not defined the smiley conversion is skipped.

The option looks like this:

smilies=/images/smilies

and the code hacked into blaze-make.pl is:

sub convert_smilies {
    #
    # Change the smiley ascii's to picts
    #
    my $text  = shift;
    my $smurl = $conf->{blog}->{smilies} || return $text;
    $smurl = '<img class="smiley" alt="smiley" src="' . $smurl;

    my %smilies = (
        ':-\)',  'regular_smile.gif',   ':-\D',  'teeth_smile.gif',
        ':-\O',  'omg_smile.gif',       ':-\P',  'tongue_smile.gif',
        ';-\)',  'wink_smile.gif',      ':-\(',  'sad_smile.gif',
        ':-\S',  'confused_smile.gif',  ':-\|',  'what_smile.gif',
        ':\'\(', 'cry_smile.gif',       ':-\$',  'red_smile.gif',
        '\(H\)', 'shades_smile.gif',    ':-\@',  'angry_smile.gif',
        '\(A\)', 'angel_smile.gif',     '\(6\)', 'devil_smile.gif',
        ':-\#',  '47_47.gif',           '8o\|',  '48_48.gif',
        '8-\|',  '49_49.gif',           '\^o\)', '50_50.gif',
        ':-\*',  '51_51.gif',           '\+o\(', '52_52.gif',
        ':\^\)', '71_71.gif',           '\*-\)', '72_72.gif',
        '\<:o\)','74_74.gif',           '8-\)',  '75_75.gif',
        '\|-\)', '77_77.gif',           '\(C\)', 'coffee.gif',
        '\(Y\)', 'thumbs_up.gif',       '\(N\)', 'thumbs_down.gif',
        '\(B\)', 'beer_mug.gif',        '\(D\)', 'martini.gif',
        '\(X\)', 'girl.gif',            '\(Z\)', 'guy.gif',
        '\(\{\)','guy_hug.gif',         '\(\}\)','girl_hug.gif',
        '\:-\[', 'bat.gif',             '\(^\)', 'cake.gif',
        '\(L\)', 'heart.gif',           '\(U\)', 'broken_heart.gif',
        '\(K\)', 'kiss.gif',            '\(G\)', 'present.gif',
        '\(F\)', 'rose.gif',            '\(W\)', 'wilted_rose.gif',
        '\(P\)', 'camera.gif',          '\(\~\)','film.gif',
        '\(\@\)','cat.gif',             '\(\&\)','dog.gif',
        '\(T\)', 'phone.gif',           '\(I\)', 'lightbulb.gif',
        '\(8\)', 'note.gif',            '\(S\)', 'moon.gif',
        '\(\*\)','star.gif',            '\(E\)', 'envelope.gif',
        '\(O\)', 'clock.gif',           '\(sn\)','53_53.gif',
    );

    my $tag;
    foreach $tag (keys %smilies)
    {
        $text =~ s!$tag!$smurl/$smilies{$tag}\" />!g;
    }

    return $text;
}

and add it to the functions generate_posts and read_entry.

This list is already rather long, and I do think it's not a very good idea to make it longer. It will seriously impact the performance.

Ditched MarkDown.pl

2011-07-15 (102) by Ton Kersten, tagged as blog

After using John Grubers original Markdown for a couple of years now, I finally ditched it. I kept wanting things that where not in the Perl version and after a while I lost the fun to code them myself. So I started looking around and I found some alternatives, like rdiscount, libupskirt and a lot more. But I also wanted syntax highlighting, without JavaScript if possible.

Digging around I found Markdown in Python in combination with Pygments. I just tweaked a little Python script to run markdown from the command line and configured blaze to use it.

This is the blaze config line

processor=md -x codehilite -x footnotes -x tables %in% > %out%

and the little python script.

#!/usr/bin/env python26

import logging
from markdown import COMMAND_LINE_LOGGING_LEVEL
from markdown import commandline

logger = logging.getLogger('MARKDOWN')
logger.setLevel(COMMAND_LINE_LOGGING_LEVEL)
logger.addHandler(logging.StreamHandler())

if __name__ == '__main__':
    commandline.run()

To bad I don't code more Python, people say it's fun. Maybe something for the holidays.

At this moment this seems to be a keeper.

My patched version of MarkDown is still in the download section. Feel free to take a copy home!

Switching to a static blog

2011-06-22 (98) by Ton Kersten, tagged as blog

I have been running WordPress for some time now, and I rather liked it. The only thing I didn't like was the fact that I had to use PHP and a lot of strange software that was almost impossible to keep up to date.

Before I started using WordPress I used NanoBlogger and I liked that because it generates static websites. And I am a big fan of that. But: NanoBlogger is very, very slow and I didn't like that, as you can imagine.

But I want my static pages back and I want to use my patched version of MarkDown and I want to create my posts with vim.

I also want to be able to change the blog system the way I want it to work and with Nanoblogger that is really out of the question. The source code of NB is (mildly said) a mess. If you change a little thing everything else breaks.

As you can see, I have a lot of wishes and no answers..... Until I ran into BlazeBlogger, which is lightning fast and generates static html. And the very nice thing is that the source code is in Perl and everyone with little knowledge of Perl can read and adapt it. And that is what I did, I changed some things to make it more the way I like it. And, as OpenSource should be, I mailed the changes to Jaromir.

So, what you see now is generated with BlazeBlogger and some extra stuff.

Comments are enabled as well, through Disqus.

Update download page

2011-03-10 (92) by Ton Kersten, tagged as blog

I've added some more downloads to the download page and now I'm running into tiny troubles. When I change a script or configfile, this is placed in this blogs download directory. But the blogs database isn't updated, so the file size, date/time and revision numbers are not the same on the download page as they are on disk. Of course it's possible to update all this by hand, every time something changes, but being lazy I created a little script that does this all for me.

This is it:

#!/bin/bash

DIRS="git.vi header makebackup mysqlbackup"

# Top of the development tree
cd ~/develop

# Process all the download directories
for dir in ${DIRS}
do
    cd ${dir}

    # First install everything
    # The Make file also installs in the blogs download dir
    echo "Processing ${dir}"
    make install
    git push

    # Process all files
    for f in *
    do
        # Get the revision number, date and size
        rev="$(grep '^# $Revision::' $f | awk '{print $3 }'smiley"
        dt="$(stat -c '%y' $f | cut -d '.' -f1)"
        sz="$(stat -c '%s' $f)"

        # Create a MySQL update string
        cat <<- @EOF
            #
            # Update the revision
            #
            update wp_download_monitor_files
            set dlversion='${rev}'
            where filename='/var/www/blog/downloads/${dir}/${f}';

            #
            # Update the file date
            #
            update wp_download_monitor_files
            set postDate='${dt}'
            where filename='/var/www/blog/downloads/${dir}/${f}';

            #
            # Update the file size
            #
            update
                wp_download_monitor_file_meta  m,
                wp_download_monitor_files      f
                set m.meta_value = '${sz}'
                where (
                    m.download_id = f.id
                )
                    and (
                    m.meta_name = 'filesize'
                )
                and (
                    f.filename = '/var/www/blog/downloads/${dir}/${f}'
                );
        @EOF
    done
    cd ..
done | mysql -u root -p blogdb

Switching to WordPress

2011-02-26 (87) by Ton Kersten, tagged as blog

I've been using nanoblogger for a long time now, but it has some grave disadvantages. First of all it looks like development has stopped. And when I add a new blog entry it takes ages for it to come online.

So I'm in the process of switching to WordPress. As you can see I have a lot of old entries converted (not all yet, but that's just a matter of hard grinding work).

Let me know if you like it.