October, 2006


30
Oct 06

Plastic

We are the middle children of history, raised by television to believe that someday we'll be millionares, and movie stars, and rock stars, but we won't. And we're just learning this factFight Club

And Chuck Palahniuk wrote Fight Club before the advent of reality TV.

Eye on the T.V. 'cause tragedy thrills me.
Whatever flavor it happens to be like
"Killed by the husband"
"Drowned by the ocean"
"Shot by his own son"
"She used the poison in his tea
and kissed him goodbye"
That's my kinda story
It's no fun until someone dies

Don't look at me like I am a monster.
Thrown out your one face
But with the other
Stare like a junkie into the T.V.
Stare like a zombie
While the mother holds her child
Watches him die
Pleads to the sky crying:
"Why, oh why?"

Cause I need to watch things die… from a distance
Vicariously I live while the whole world dies
You all need it too – don't lie

Why can't we just admit it?
Why can't we just admit?

We won't give pause until the blood is flowing
Neither the brave nor bold, or writers of stories told
We won't give pause until the blood is flowing

I need to watch things die.. from a good safe distance
Vicariously I live while the whole world dies
You all feel the same so

Why can't we just admit it?

Blood like rain come down
Drown on grave and ground

Part vampire
Part warrior
Carnivore and voyeur
Stare at the transmitter
Sing to the death rattle

Lie (4x)

(Background news headline)

Credulous, divest your desire to believe in
Angels in the hearts of men
Pull your head on out
Your head believes it give a listen
Shouldn't have to say it all again
The universe is hostile
So impersonal
Devour to survive, so it is
So it's always been

We all feed on tragedy
It's like blood to a vampire

Vicariously, I live while the whole world dies
Much better you than IVicarious (Tool, 1,000 Days)


27
Oct 06

Whois .es

# whois ******.esThis TLD has no whois server, but you can access the whois database athttps://www.nic.es/

¿Por qué?

¿Para evitar que la gente use los correos para spamear? ¡Venga ya!

Además, si al menos en la página hubiese un enlace o formulario claro indicando donde hacer un whois… pero no, hay que adivinar que es el formulario para ver si un dominio está libre, darle al enlace y rellenar un puto captcha.


26
Oct 06

Perspectiva

La bomba más grande jamás detonada fue La Bomba del Zar, una bomba nuclear de 50 megatones detonada por los rusos en medio de la guerra fría. No fue construida como una bomba 'usable' ya que su enorme tamaño la hacía impráctica. Originalmente iba a ser una bomba de 100 megatones, pero se reemplazó una étapa de uranio de la bomba por plomo. El plomo reduce la cantidad de fisión nuclear, y por lo tanto genera mucha menos contaminación.

Explosiones

Little Boy (Hiroshima)
13-16 kilotones
Trinity Test (la primera bomba nuclear)
20 kilotones
Fat Man (Nagasaki)
21 kilotones
Castle Bravo (la mayor bomba nuclear de los EEUU)
15 megatones
Bomba del Zar (mayor bomba nuclear de la historia)
50 megatones

Desastres Naturales

Explosión del Krakatoa
200 megatones
Terremoto del Océano Índico de 2004
250 megatones
Monte Saint Helens
350 megatones
Meteorito que creó el crater Chixclub
100.000 gigatones (1 gigaton = 1.000 megatones)

Si es que no somos nadie, ni siquiera para matarnos.


23
Oct 06

Cowsay!

convo

Script en PHP para usar Cowsay desde el navegador: 10 minutos
Cambiar la fuente del MSN a Courier New: 30 segundos
Hacer el gilipollas con mi hermana por MSN, priceless :-)


22
Oct 06

Cita IV

You want to know about voting. I’m here to tell you about voting. Imagine you’re locked in a huge underground nightclub filled with sinners, whores, freaks and unnameable things that rape pit bulls for fun. And you ain’t allowed out until you all vote on what you’re going to do tonight. You like to put your feet up and watch “Republican Party Reservation”. They like to have sex with normal people using knives, guns and brand-new sexual organs that you did not know existed. So you vote for television, and everyone else, as far as the eye can see, votes to fuck you with switchblades. That’s voting. You’re welcome.Transmetropolitan


17
Oct 06

The joy-to-stuff ratio

The time a person has to enjoy life versus the time a person spends accumulating material goods.Wordspy

As the quote explains, the joy-to-stuff ratio is basically the relationship between the amount of time you spend earning money and the amount of time you have to “enjoy” that money. There’s no point in working 7 days a week doing extra jobs during the weekend to have no time to enjoy yourself.

This is probably the term that has had the biggest influence in my life for the past year or so. I remember reading about it on Kottke and thinking it was brilliant, I suggest you check out the related terms, there are some very clever words there.

I’ve moved five times since I came to the UK. One for the original trip, a second time I moved from one room at Nunnery Court residence to another one in a different block, this summer I moved a third time to a house for two months, the fourth I moved for a week or so to a friends house and the final move was to where I’ve been living for the past month. I’ve moved three times in the space of three months this summer.

When I first moved to the UK, all I brought fit in a suitcase and one of those bags with wheels, the kind airline pilots, stewards and businessmen carry. During the two years at Nunnery Court I collected a lot of crap, two desktop computers, three CRTs, books, papers, lots of papers and a lot of other random computer equipment (including a small UPS). I knew from the first summer, moving from one room to another, that moving all that stuff was going to be a huge pain in the ass, so I plucked up the courage and did a savage purge. It was hard, I’m a natural hoarder and love to collect junk, I’m sure these 200 silver kitkat wrappings will come in handy at some point!, and I threw away tons of stuff, papers, clothes (I know, I know, I should have donated those, but at the moment I didn’t have the time), and even two CRTs and an old router. All in all it amounted to about four or five big bin bags (excluding the CRTs), considering I’d been living in a small residence room that’s quite a lot of junk. It was such a relief to through all the stuff away, it actually felt good, probably because I’d managed to get over my knee-jerk reaction of collecting stuff.

I then proceeded to move to a house, but since I knew I’d only be there for two months I didn’t unpack, I left everything in boxes and bags, and just used my suitcase and laptop. And then when I moved to my friends floor for a week I obviously didn’t unpack, and then when I moved to my new house, initially it was only temporary stay, I didn’t bother unpacking either. And this finally brings me to my point, I’ve been living off a suitcase and a laptop for the past three months and I haven’t needed anything else. I’ve made heavy use of my bike, books, laptop, clothes and that’s it, as a matter of fact that’s all I’ve unpacked since moving in to my new house (my clothes are still in the suitcase, but that’s just me being lazy).

And then coincidence happens last weekend and I talk to some dude about some totally unrelated topic and he mentions he’s reading a book on simple living. I’m not saying I’m going to go totally hardcore and go live in a farm, but I think one paragraph nails it:

Some people who practice voluntary simplicity act consciously to reduce their need for purchased services or goods and, by extension, their need to sell their time for money. Some will spend the extra free time this generates helping their family or others in a voluntary way. Others may spend the extra free time to improve their own quality of life, with less regard for the well being of others.http://en.wikipedia.org/wiki/Simple_living

It’s not so much about having only a few things as much as it is about not having shit you don’t need.

Do I really need

  • an SUV to take my kids to school?
  • a 42 inch plasma screen?
  • more shoes?
  • a new mobile?
  • a new bike?
  • new stuff?
  • more stuff?

The joy-to-stuff ratio concept is not about going absolutely minimalistic or anywhere near it either, what the hell, we all like to have toys and gadgets to play around with. The joy-to-stuff ratio concept is about not making a lifestyle out of it.

I seriously don’t understand these people who just have to have new stuff, and they obviously need to let you know they have a better [insert physical possesion here] than you.

Why work a job you hate to buy shit you don’t need? Why get yourself in so much debt trying to out-do the neighbors and friends? What is the air speed of an unladen swallow?

As you may or may not have noticed I have no clue where I’m going with this, I’m just rambling on and on, so I’ll finish it off.

Stuff is overrated but necessary, think before you buy. Is it really necessary? Is the cool factor worth the money?


7
Oct 06

HOWTO: Backups remotos con rsync

Después de unos meses de infructosos intentos conseguí esta semana hacer backups remotos con rsync, dado que me costó tanto he decidido compartir la experiencia y espero que le ahorre a alguien unos cuantos meses y disgustos. Ahí va!

El escenario es el siguiente: tenemos un dos servidores, Alice y Bob, y queremos que Alice guarde backups de Bob. Pero Alice y Bob estan en distintas redes y lo único que los conecta es Internet, con lo cual cosas como Samba quedan descartadas. Originalmente lo que se me ocurrió fue escribir un pequeño script en Perl que hiciera archivos tar.bz2 incrementales todos los días, cada domingo un tar.bz2 total y que Bob los enviara por ftp a Alice. Pero esto es una chapuza, fijense el nivel de vaguería, con tal de no tener que aprenderme los comandos de rsync preferí escribir un script en Perl… las cosas que uno hace. Así que me puse las pilas y esto es lo que salió: usando llaves conseguimos que Alice pueda acceder por SSH a Bob y usando rsync sacamos un snapshot el primero domingo de cada mes, luego snapshots incrementales contra el del dia anterior y cada domingo hacemos un snapshot incremental contra el snapshot original del primer domingo. Si, ya se que suena rebuscado y complicado, pero ya verán como es una buena idea.

Configurar acceso con llaves por SSH

Esto fué altamente frustrante, pero es una tontería. Primero generamos una llave publica y privada en Alice

# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
c3:de:3c:46:d2:dd:87:34:ec:63:ed:09:c5:55:07:c9 root@alice

Dejamos todo por defecto y usamos una passphrase vacía, esto es importante porque sino nos la pedirá cada vez que intentemos usar la llave y así no se puede automatizar (que yo sepa). Abrimos /root/.ssh/id_rsa.pub, copiamos la cadena y la pegamos en /root/.ssh/authorized_keys en Bob. Ahora en Bob configuramos sshd, en Gentoo el archivo de configuración se encuentra en /etc/ssh/sshd_config. (Atención: no confundir con ssh_config, este último es para el cliente, sshd_config es para el servidor). Estas son las directrizes a tener en cuenta:

PermitRootLogin no
AuthorizedKeysFile     .ssh/authorized_keys

Y dejando el resto comentado funciona, pero como todo el mundo tiene SSH configurado distinto es cuestión de ir probando y ver que funciona, sin embargo hay dos cosas a tener en cuenta.

PermitRootLogin no te permite acceder directamente a la cuenta root, pero al usar llaves esto no le afecta. Es decir, sin usar llaves no podremos conectarnos como root, sino que tendremos que acceder con una cuenta normal y luego elevar privilegios con su, pero usando llaves podemos acceder como root directamente. Sin embargo no podemos tener root en DenyUsers porque eso sí que no funciona.

La directriz de Protocol es confusa, este HOWTO usa el protocolo 1 ya que guardamos la llave en authorized_keys, si la guardamos en authorized_keys2 debería usar cualquier protocol, pero esto no lo he probado y no se como va.

Reiniciamos el servidor SSH en Bob e intentamos acceder manualmente desde Alice a Bob para ver si funciona

# ssh root@bob
Last login: Fri Oct  6 17:06:25 2006 from **************.*****.co.uk
[root@bob root]#

Usando rsync

Ahora que Alice puede acceder a Bob sin contraseñas pasamos a la parte de hacer los backups.

# rsync -v -u -a --delete --rsh=ssh --stats bob://misc /backup
receiving file list ... done
misc/
misc/prueba.txt

Number of files: 2
Number of files transferred: 1
Total file size: 6 bytes
Total transferred file size: 6 bytes
Literal data: 6 bytes
Matched data: 0 bytes
File list size: 57
Total bytes sent: 32
Total bytes received: 119

sent 32 bytes  received 119 bytes  60.40 bytes/sec
total size is 6  speedup is 0.04
  • -v = verbose
  • -u = update
  • -a = archive
  • –delete = borra en Alice los archivos que hayan sido borrados en Bob, veremos más adelante que esto no es necesario
  • –rsh=ssh = especifica que queremos usar ssh para conectarnos
  • –stats = nos muestra las estadísticas tan simpáticas

Especificamos la fuente y luego el destino, lo que hace el ejemplo es hacer una copia de /misc en Bob y la pone en /backup en Alice. Sin embargo esto compara /backup con /misc y luego copia los archivos que hayan cambiado, esto no nos sirve para hacer backups incrementales. rsync tiene un parametro llamado --compare-dest que nos permite decirle a rsync que copie a /backup los archivos que hayan cambiado en /misc pero comparando con otra carpeta en Alice. Esto es altamente confuso, asi que pongo un ejemplo:

Usando la estructura que expliqué al principo tenemos un árbol tal que:

backups
  monthly-06-08-06
  weekly-13-08-06
  weekly-20-08-06
  weekly-27-08-06
  monthly-03-09-06
  weekly-10-09-06
  weekly-17-09-06
  weekly-24-09-06
  monthly-01-10-06
  weekly-08-10-06
  weekly-15-10-06
  weekly-22-10-06
  weekly-29-10-06

El método es el siguiente, cada primer domingo de mes hacemos un snapshot (los monthly-DD-MM-YY), luego cada domingo de ese mes hacemos otro snapshot incremental (weekly-DD-MM-YY) comparando con el monthly y luego cada día hacemos un snapshot incremental comparando con el del último domingo, estos últimos los he omitido porque sino esto se pone confuso, pero el método es igual que el de la semana.

Cada primer domingo de mes hacemos

rsync -vua --delete --rsh=ssh --stats bob://desde /backups/monthly-01-10-06

y luego cada siguiente domingo hacemos

# rsync -vua --delete --rsh=ssh --stats \
> --compare-dest=/backups/monthly-01-10-06 \
> bob://desde /backups/weekly-08-10-06

Antes dije que la opción de --delete no sirve, como estamos haciendo un backup incremental /backup/weekly-08-10-06 estará vacio antes de empezar, con lo cual no hay nada para borrar.

Digamos que el disco duro de Bob decide que ya esta cansado de girar y decide expirar, lo re-emplazamos por uno nuevo y restauramos todos los archivos de la siguiente manera:

Primero copiamos el último snapshot mensual, luego copiamos encima el último snapshot semanal y luego copiamos todos los snapshots diarios desde ese último domingo. La razon de hacer snapshots semanales es para evitar que si el disco duro muere a fin de mes tengamos que copiar casi 30 snapshots diarios. De esta manera solo tenemos que copiar seis snapshots diarios, un semanal y un mensual como máximo.

Y bueno, ahí lo tenemos, lo único que falta es escribir algún script en bash o PHP para que lo automatice. La idea es guardar los últimos tres meses, con lo cual hay que ir borrando los meses antiguos.

Recomiendo leerse man rsync, rsync tiene muchas opciones interesantes.

Espero que esto le sirva a alguien, si hay sugerencias o correcciones hagan uso de los comentarios :-P


1
Oct 06

Cooooooooooodigo (II)

Cansado de pasarme los días creando pequeños archivos de prueba con <?=crypt('contraseña');?> cada vez que tengo que crear la cuenta inicial de administrador en sitios nuevos escribí una pequeña clase y utilidad que me facilite la vida.

Convert es una clase muy sencilla que genera firmas MD5 simples y con semilla, SHA-1 e incluso ROT-13 (ya que estamos, se me ocurrió que sería interesante). Tambien incluí algunas tonterias como convertir cada carácter a binario, hexadecimal y entidades HTML.