11:34 29/08/2008

clifoo 4: Splitting files withe perl

One of our databases started spewing an enormous log file and non technical person were asked to look through it. Because the size of the file diddn't allow them to open it of their workstation, I was asked to split the files in chunks of 100MB.

Because I didn't find the pattern for one elementary log, I went for the brutal strict solution:

Split into 100MB files, whether the split is to be made at the end of a log entry or not.

I came up with the following perl script, and I does the job.

#!/usr/bin/perl
 
use strict;
use warnings;
 
die "usage : $0 <logfile> <chunk size in MB>" unless ( $ARGV[0] && $ARGV[1] );
 
my $chunks = (-s $ARGV[0]) / 1024 / 1024 / $ARGV[1];
 
my $chunk = 1;
 
 
while ( $chunk <= $chunks ) {
  my $dest = "$ARGV[0]-$chunk";
  my $skip = $ARGV[1] * $chunk;
 
  my @dd = ("dd", "if=$ARGV[0]", "of=$dest", "bs=1M", "count=$ARGV[1]", "skip=$skip");
 
  print @dd, "\n";
 
  system(@dd) == 0
    or die "system @dd failed: $?";
 
  $chunk++;
}

05:03 26/08/2008

links for 2008-08-26 [delicious]

Bcfg2 - Trac
I wonder how this compares to cfengine and puppet, which both seem to be better establiched for configuration management .... need to find out because I like the xml config files of Bcfg2
REGex TESTER v1.5.3 - test/validate regular expressions, online tester
I shall not forget to use this tool in desperate 'regex-debugging' times
05:03 19/08/2008

links for 2008-08-19 [delicious]

K2 : comment la montagne tueuse a englouti onze hommes | Rue89
terrible ... terrible destin de ces alpinistes certainement pas assez experimentes pour attaquer le K2. Je suis d'accord avec le fait que sur une montagne comme le K2, vous ne pouvez vous appuyer que sur un petit groupe «d’amis de confiance».
05:03 14/08/2008

links for 2008-08-14 [delicious]

Free Space Manchester
A good idea: providing young people in Hulme with free (in both senses of the word!) access to GNU/Linux computers. Free Space Manchester is a new project, which has used LTSP [3] to give new life to a cluster of old PCs, in an on going initiative to provide disadvantaged young people with computing and internet access. The group's future aims include setting up an audio and video editing suite using free software.
14:48 30/07/2008

clifoo 3: display the 10 largest files or folders in current folder

in

snoopy log$ du -sm * | sort -nr | head

23:25 29/07/2008

Bilan des vacances d'été 2008

in

Durée: 12 jours
Transport: voiture.
Bris/Casse:
- Téléphone portable le premier jours.
- Appareil Photo 4 jours plus tard.
Moments mémorables:
- chanter des chansons bretonnes avec Christophe.
- faire au pas de course les 3 derniers kilomètres d'une marche de plus de 7 heures.
- le mariage d'Alexia & Mike.
- grimper sans matos un roch' au large du Sillon de Talbert avec Daniel.
- se remémorrer l'Ecosse avec Bertrand et Agnès.
bobos:
- Une grosse écorchure au genou en glissant sur une pierre, bousillant mon appareil photo par la même occasion.
- Quelques coupures à la main droite en essayant un scramble sur granite rose.
restos:
L'ardoise à Binic.
Crèperie Moulin le Richel à Pontrieux.

En gros, ce fut d'excellentes vacances et je veux remercier tous nos amis qui ont eu la gentillesse de nous héberger pendant quelques nuits.

Tom

05:03 02/07/2008

links for 2008-07-02 [del.icio.us]

Main Page - Network Naming Schemes
useful for ... eh ... naming schemes
Syndicate content