Pues harta ya de cada vez que llueve tener que ir a la página de meteocat.com a mirar simplemente lo que me interesa, hago que una maquina lo haga para mi y me genere un gif animado para ponerlo en el desklet del escritorio.
Para hacerlo funcionar simplemente necesitamos php5-gd:
# apt-get install php5-gd
el código
# Generador d'imatge animada del radar metereològic meteocat.com
# Desenvolupat per Blackhold
# 2011-11-16
# I get the json file
$file= file_get_contents("http://www.meteo.cat/servmet/radar/images/cappicor_catalunya_10dBZ/images.json");
# And process the data
#var_dump(json_decode($file));
$parsed=json_decode($file);
$array=$parsed->{'items'};
//echo $array[0]->{'src'};
$length=count($array);
for ($i=0;$i<$length;$i++){
$png = imagecreatefrompng("http://www.meteo.cat/servmet/radar/".$array[$i]->{'src'});
imagegif($png, "./meteo.".$i.".gif");
imagedestroy($png);
}
exec("/usr/bin/convert -delay 60 -loop 0 ./meteo.*.gif ./meteo.gif");
exec("rm ./meteo.*.gif");
Y para que se vaya actualizando de vez en cuando lo añadimos al cron que lo vaya verificando cada 6 minutos, periodo con el que se actualiza el json de meteocat.
# vi /etc/crontab
# generador meteocat
*/6 * * * * root php /var/www/meteocat.php
Aquí os dejo con un ejemplo (no abusar! el código es muy simple, lo puedes poner en local o en un servidor tocho -compartid los links!-).
# apt-get install bwm-ng
cambiamos lo que queremos monitorizar con n, además podemos cambiar el tiempo de refresco con + o -, maximos, medianas, rate, etc.
Red:
bwm-ng v0.6 (probing every 0.500s), press 'h' for help
input: /proc/net/dev type: rate
/ iface Rx Tx Total
==============================================================================
lo: 0.00 KB/s 0.00 KB/s 0.00 KB/s
eth0: 270.40 KB/s 14.73 KB/s 285.13 KB/s
------------------------------------------------------------------------------
total: 270.40 KB/s 14.73 KB/s 285.13 KB/s
Read more on “bwm-ng: monitorizar la red, los discos y las particiones en consola” »
# apt-get install bmon
interface: eth0 at xava bmon 2.0.1
# Interface RX Rate RX # TX Rate TX #
──────────────────────────────────────────────────────────────────────────────────
xava (source: local)
0 lo 0.00B 0 0.00B 0
1 eth0 459.77KiB 329 16.21KiB 235
──────────────────────────────────────────────────────────────────────────────────
RX KiB
499.72 .*..**..*..**..*.**..**.**..*.***.**.***.*..................
416.44 ******.**.***.**.***.**.**.**.***.**.***.*..................
333.15 *************.*********.****************.*..................
249.86 ******************************************..................
166.57 ******************************************..................
83.29 ******************************************.................. [-0.01%]
1 5 10 15 20 25 30 35 40 45 50 55 60 s
TX KiB
23.68 ................................*......*....................
19.73 .*...*..*...*..*.***..*..*..**.***.*..**.*..................
15.79 ***.******.**.******.**.************.***.*..................
11.84 ********************.*********************..................
7.89 ******************************************..................
3.95 ******************************************.................. [-0.01%]
1 5 10 15 20 25 30 35 40 45 50 55 60 s
────────────────────────────────────────┬─────────────────────────────────────────
RX TX │ RX TX
Bytes: 87.1 GiB 77.5 GiB│ Packets: 132136923 84849855
Errors 0 0 │ Dropped 0 0
FIFO Err 0 0 │ Frame Err 0 0
Compressed 0 0 │ Multicast 0 0
^ prev interface, v next interface, <- prev node, -> next node, ? help
# apt-get install beep
$ vi marcha_imperial.sh
#!/bin/bash
beep -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 250 -f 622.26 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 369.99 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 739.98 -D 100 --new -l 25 -f 698.46 -D 100 --new -l 25 -f 659.26 -D 100 --new -l 25 -f 622.26 -D 100 --new -l 50 -f 659.26 -D 400 --new -l 25 -f 415.3 -D 200 --new -l 350 -f 554.36 -D 100 --new -l 250 -f 523.25 -D 100 --new -l 25 -f 493.88 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 25 -f 440 -D 100 --new -l 50 -f 466.16 -D 400 --new -l 25 -f 311.13 -D 200 --new -l 350 -f 369.99 -D 100 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 466.16 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 700 -f 587.32 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 739.98 -D 100 --new -l 25 -f 698.46 -D 100 --new -l 25 -f 659.26 -D 100 --new -l 25 -f 622.26 -D 100 --new -l 50 -f 659.26 -D 400 --new -l 25 -f 415.3 -D 200 --new -l 350 -f 554.36 -D 100 --new -l 250 -f 523.25 -D 100 --new -l 25 -f 493.88 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 25 -f 440 -D 100 --new -l 50 -f 466.16 -D 400 --new -l 25 -f 311.13 -D 200 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 300 -f 392.00 -D 150 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 700 -f 392
$ chmod +x marcha_imperial.sh
$ ./marcha_imperial.sh
Un poco de humor sobre temas realmente escabrosos sobre la evolución del castellano y la problemática del fetichismo del español hacia el castellano mismo y otras lenguas como el catalán, el gallego o el euskera entre otros.
VIDEO
Juan Carlos Moreno Cabrera: “Lingüística y Nacionalismo”
¡Hablad con vuestra lengua local!