Search Results: "piotr"

24 June 2006

Piotr Roszatycki: Sorting the CDs

I'm spending the Saturday at home sorting the CDs collection. A lot of stuff is going to trash can, especially some warez like illegal Windows copies. I don't need them as far as I can use Debian, Knoppix or Kubuntu. At least there is a Windows 2003 Server trial which can be legally used for 180 days. I need the backup for some CDs on harddisk. I tried to use the K3b. Unfortunatelly, the K3b doesn't allow to choose the ISO image file name. I had to write some tool. It uses the standard command from mkisofs package. By the way, I've noticed that bs parameter in dd command has a big impact for copying speed. So I'm calling the dd twice time. First, with a large buffer size and another time for end of file. The code for isocat script:
BUFSIZE=$((128*1024))
bsize= LC_ALL=C isoinfo -d   sed '/^Logical block size is:/!d; s/.*: //' 
vsize= LC_ALL=C isoinfo -d   sed '/^Volume size is:/!d; s/.*: //' 
size=$(($bsize*$vsize))
if which pv >/dev/null 2>&1 && tty -s; then
    cat="pv -s $size"
else
    cat=cat
fi
( dd $ 1:+if=$1  bs=$BUFSIZE count=$(($size / $BUFSIZE)); \
  dd $ 1:+if=$1  bs=$bsize
    count=$(($size / $vsize - $size / $BUFSIZE * $BUFSIZE / $vsize))
    skip=$(($size / $BUFSIZE * $BUFSIZE / $vsize))
)   eval $cat $ 2:+> $2 

23 June 2006

Piotr Roszatycki: I'm at planet.debian.org!

Yes! Yes! Yes! My first blog note at planet.debian.org :) It was not so easy, because the jogger.pl service does not feed separate categories. I had to use some trick. Each note for Planet Debian is marked with hidden feed:Debian tag. So I used Perl. Yes, there is a module for handling the RSS files. The code (comments was stripped):
use IO::Handle;
use XML::RSS;
my ($version, $pattern, $title) = @ARGV;
die "Usage: $0 version pattern [title]\n" unless $pattern;
my $stdin = IO::Handle->new;
$stdin->fdopen(fileno(STDIN),"r") or die;
my $rss = new XML::RSS;
$rss-> output  = $version unless $version eq 'default';
$rss->parse($stdin);
$rss-> items  = [grep($_-> description  =~ /$pattern/,
    @ $rss-> items )];
$rss-> channel -> title  = $title if $title;
print $rss->as_string;
Perl is great, as always.

Next.

Previous.