Archive for Julio, 2008

README´s originales

Parece que el que armo el README/LEAME del paquete gnome-cups-manager tuvo un raye de escritor y se le dio por armar una historia sobre impresoras:

——————

Once upon a time there was a printer who lived in the woods. He was a lonely printer, because nobody knew how to configure him. He hoped and hoped for someone to play with.

One day, the wind passed by the printer’s cottage. “Whoosh,” said the wind. The printer became excited. Maybe the wind would be his friend!

“Will you be my friend?” the printer asked.

“Whoosh,” said the wind.

“What does that mean?” asked the printer.

“Whoosh,” said the wind, and with that it was gone.

The printer was confused. He spent the rest of the day thinking and jamming paper (for that is what little printers do when they are confused).

The next day a storm came. The rain came pouring down, darkening the morning sky and destroying the printer’s garden. The little printer was upset. “Why are you being so mean to me?” he asked.

“Pitter Patter, Pitter Patter,” said the rain.

“Will you be my friend?” the printer asked shyly.

“Pitter Patter, Pitter Patter,” said the rain, and then it left and the sun came out.

The printer was sad. He spent the rest of the day inside, sobbing and blinking lights cryptically (for that is what little printers do when they are sad).

Then one day, a little girl stumbled into the printer’s clearing in the woods. The printer looked at this curious sight. He didn’t know what to think.

The little girl looked up at him. “Will you be my friend?” she asked.

“Yes,” said the printer.

“What is your name?” asked the little girl.

“HP 4100TN”, replied the printer.

“My name is gnome-cups-manager” said the little girl.

The printer was happy. He spent the rest of the day playing games and printing documents, for that is what little printers do when they are happy.

———

Fuente: http://www.fsckin.com/2008/07/27/the-most-interesting-readme-file-ever/

Limpiar “messy characters” (o como quitar esos caracteres que agrega Windows)

Una vez mas, vengo a dejar una pizca de sabiduria que voy adquiriendo de casualidad o peleandome con los ordenadores.

Se sabe que al abrir un archivo en Windows, sobre todo codigo fuente de scripts o programas, ese archivo deja de ser el que era antes. Windows reemplaza los espacios por otros caracteres, no profundize mucho en el tema, pero el codigo fuente de tus scripts, magicamente, deja de funcionar.

Por eso vengo a compartir el siguiente script Perl para solventar este problema. Crean un archivo llamado “fixer.pl” y le copian el siguiente codigo:

#!/usr/bin/perl

die "Usage: $0 < files >\n" unless @ARGV;

for $file (@ARGV)
{
open IN, $file or die "$0: Cannot open $file for input!\n";

my @lines = <IN>;

close IN;
open OUT, "> $file" or die "$0: Cannot open $file for output!\n";

s/\r$// for @lines;
print OUT for @lines;
}

Luego, le dan permisos de ejecución:

chmod +x fixer.pl

Y lo usan asi:

./fixer.pl sourcecode.php

EDIT: Me pasan un tip mas rapido para hacer este trabajo, usando el siguiente comando:

sed ’s/\\r//g’ archivo

Si faltaban fanaticos de algo…

…definitivamente eran de Debian

dsc000541

Visto en Avenida de Mayo, Buenos Aires, Argentina.