koldfront

Splitting an .ics file up #debian #radicale #calendar #perl

πŸ••οΈŽ - 2020-04-11

As I mentioned when I upgraded my server to Debian 10 (buster), the version of radicale included no longer supports calendar (.ics) files with more than one event. Instead each event is supposed to be in a file by itself, the file name being the UID of the event.

I have finally taken the time to write a little program that will take one of the .ics-files I used to use, and splits it out to a file per event.

Getting around to that took me, what, ΒΎ of a year? Oh well, here is is:

#!/usr/bin/perl

# split_ics - take an .ics file and a directory and write a file per event

# Copyright (C) 2020 by Adam SjΓΈgren <asjo@koldfront.dk> Under the GPLv2.

use strict;
use warnings;
use utf8;
use v5.12;

use Data::ICal;
use File::Slurp;

my $ics_file=$ARGV[0];
my $dir=$ARGV[1];

my $ics_data=File::Slurp::read_file($ics_file, { binmode=>':utf8' });
my $input=Data::ICal->new(data=>$ics_data);

foreach my $event (@{$input->entries}) {
    my $uid=$event->property('UID');
    my $filename=$dir . '/' . $uid->[0]->value;
    my $calendar=Data::ICal->new();
    $calendar->add_entry($event);
    open my $fh, '>:utf8', $filename || die $!;
    print $fh $calendar->as_string;
    close $fh;
}

The only tricky part was avoiding the Data::ICal-module splitting lines in the middle of multi-octet utf-8 characters.

A tip: you can run radicale --verify-storage to have any problems with the generated files reported. Do remember to run it as the radicale user, though.

Jeeves and Wooster to the rescue #wodehouse #tv #audio

πŸ•›οΈŽ - 2020-03-27

If the whole thing is kind of dragging you down, don't you know, men brighter than I habitually recommend a dosis of P.G. Wodehouse.

I have to say that I find his Jeeves stories the most fetching. The television series starring Hugh Laurie and Stephen Fry are positively excellent.

In case you are less visually inclined and prefer a great narrator to provide your ears with relief, I can wholeheartedly recommend the great Jonathan Cecil's performances. They are nothing less than brilliant.

What ho!

Big Thief, Store Vega (early show) β˜…β˜…β˜…β˜…β˜† #live #music

πŸ•€οΈŽ - 2020-03-11

Due to SARS-CoV-2 precautions, the concert at Store Vega was split in two - an early show and a late show.

I saw the early show - arrived fashionably around 30 seconds before the band went on stage - and it was good. Low key, sincere, concentrated and indie - good.

If Big Thief's tour passes by where you are: recommended.

Where you sometimes think that the heavy metal folks have their guitars so low it must be uncomfortable, Big Thief have them so high you almost think the same.

Increasing the number of nfsd threads on Linux #linux #nfs

πŸ•¦οΈŽ - 2020-02-26

If you have a Linux machine as an NFS server, and you reach some high number of clients, you may see warnings in dmesg along the lines of:

nfsd: too many open connections, consider increasing the number of threads

If you use the error message to search for solutions online, you'll find plenty of explanations saying that you should change the RPCNFSDCOUNT variable in, e.g. /etc/default/nfs-kernel-server on a Debian-based machine.

Sometimes the guides will tell you to restart the nfs-kernel-server-service, but alas, that won't take effect (at least not immediately(?)) Sometimes the suggestion is then to reboot the machine.

Besides being ugly, that might not be convenient, if - say - a whole lot of machines depend on the NFS mount (which is how we got here in the first place!)

I've now found the solution twice, and this time, I am writing it down!

To change the number of nfsd threads to e.g. 16, you run the command:

# rpc.nfsd 16

The change won't persist a reboot, so you'll still have to change the RPCNFSDCOUNT variable, but it will take effect immediately. The number you specify is the desired total number of nfsds.

You can check the number using ps faux | grep [n]fsd | wc -l or looking at the first number in grep ^th /proc/net/rpc/nfsd.

I πŸ–€ Free Software #ilovefs

πŸ•’οΈŽ - 2020-02-14

GNU Emacs Debian GNU/Linux Linux X.Org Postfix Perl Python PostgreSQL OpenSSH Firefox Apache ejabberd Dovecot git GnuPG XMonad GHC Gnus jabber.el rdiff-backup LaTeX Gimp lots of GNU the list goes on an on - thanks everybody!

United Kingdom leaving the European Union

πŸ•£οΈŽ - 2020-01-28

I guess there are only a couple of days left until the United Kingdom leaves the European Union.

I am not quite sure what will happen to buying things online in the UK from "over here" in "Europe", but I suppose there will be taxes and fees to pay galore.

Too bad - I really liked buying all kinds of interesting pens at Cultpens, a company with a wide range of products and good service!

Another company I will miss ordering from is The Keyboard Company - I have bought 4 or 5 keyboards from them, they carry a nice range of products and they are proactive (I once ordered a combination of keyboard and replacement keys that didn't quite make sense, and they promptly warned me).

There are many things about the EU I am not especially impressed by, but my overall feeling now is that it makes more sense to work to improve it, than to dismantle it.

Australian fires #bbc #statistics #climatecrisis

πŸ•–οΈŽ - 2020-01-12

The news is currently full stories about the extensive fires on the Australian continent. Lots of huge numbers are flung around, left and right. One of them is the number of animals that have died due to the fires, which has been reported at an estimated half a billion, a whole billion, and lately one and half billion animals.

I have heard that Australia is huge, but that number is also quite large, especially when combined with pictures of the odd, sorry looking burned koala. My first thought was "are they including some kinds of insects?!"

Luckily the latest episode of the BBC programme "More or Less", which looks at statistics, starts with a story about where the number comes from and some discussion of how accurate it might be.

Take a listen: More or Less: Australian Animal Deaths, Carbon Emissions, Election Mystery.

Lille langebro

Today

Bob Hope (117).

Sunday

Clint Eastwood (90).

World Smokefree Day (33).