Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten

Updated Pygments

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

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

pdfPres package created

2012-02-04 (111) by Ton Kersten

To present PDF slides on Linux I use pdfPres. But when I want to use this on OS X Lion, this doesn't work. So I created an OS X Lion package for pdfPres.

This is only tested on OS X Lion and it does require XQuartz.

Please, download the pdfPres package and test it.

MySQL database replication

2012-01-20 (110) by Ton Kersten, tagged as mysql

This week I was asked to setup a system with a single MySQL master server and a couple of slave servers. I have done that before, so there is no problem. The problem is that I do not do that on a daily basis, so I need to check the commands every time I set it up. So, as a note to myself I describe how to setup a single MySQL master with multiple slaves.

MySQL master with multiple slaves

Read more »

Twitter from the console

2011-12-05 (109) by Ton Kersten, tagged as twitter

Since a couple of days I'm also on Twitter.

I tried to avoid it for a while, but I wanted to follow some people, so it was about time I started to Twitter as well.

As you can imagine, no graphics for me. It turned out that wasn't as easy as I hoped. Some of the Twitter command line tools did not work or where that old that they even didn't compile.

Then I found TTYtter a Twitter client for the console.

And that's what I'm using now.

Strange question

2011-11-02 (108) by Ton Kersten, tagged as teaching

In the last couple of weeks I've been teaching a course for shell-script starters.

When I was explaining $@ and $* and the difference between these two a student asked me:

Does the @ have anything to do with the fact that we are talking about an indirect linked list of command parameters?

WTF?

Unfortunately I couldn't answer the question, because I don't have any idea what he's talking about.

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.

Updated to Linux 3.0

2011-08-14 (106) by Ton Kersten, tagged as linux

I have a eeePC 900 (the 9" version) running Arch Linux for some time now. I didn't update it for a while, so, today being a rainy Sunday, I decided it was time to do it.

So, I typed:

pacman -Syu

and waited for about half an hour.

And look what I got

Linux eeetje 3.0-ARCH

Everything is running nice and smooth, so I'm very happy.

Can't wait to get my hands on Linux 3.11 for Workgroups smiley

Update to OS X Lion

2011-07-24 (105) by Ton Kersten, tagged as mac os x

Last Friday I decided it was time to update my MacBook to OS X Lion. So I went to the app-store and donated my 23.99 euros to Apple.

The download was fast, very fast, if you consider how many people where downloading at that same moment.

After the download I first made a copy of the installer files, because I read that the installer throws these files away after installation. And, of course, I made a full backup with Time Machine.

Installation went smooth, but took a very long time. Initially the installer said it would take 33 minutes, but the total time ended up to be closer to two hours.

This is what the system says now: OS X Lion

Everything is working smoothly, but I did have to reinstall VMware Fusion. This had a little USB problem, that went away after the reinstall. Some programs needed to be updated (MacPorts and some others). And, if you are using anything like Photoshop, you need to install Java. Java is not part of the Lion install (due to licensing tricks made by Oracle) but you can still download it from Apple. Just search for 'Java Lion'.

Switching to tmux

2011-07-24 (104) by Ton Kersten, tagged as sysman

Some time ago I was fighting my .screenrc again. I wanted to change the status line, but it was hardly possible to read and understand what I typed hardly half a year ago. The screen config file is not exactly poetry.

While searching the web to find how to change the status line I ran into tmux and I thought: "Let's give it a try". And after the very simple compile I started configuring it. What a surprise I was in for. This config file could be read, understood and changed. Man, this is good.

One of the first things I changed was the default Prefix key Ctrl-B. I changed it to Alt-A, so I can still use all the control keys with Vim and in the terminal.

Read more »

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.