Feb 2

Google més fan de mi que jo mateix

De vegades mirant les estadístiques de la web trobes coses curioses. Ara revisant el tràfic del mes de gener he vist que google ha vistat el meu blog més que jo mateix!

Per una banda dius: “perfecte! Estic ben indexat”, però per altra banda… potser hauria d’entrar més sovint per postejar?

Aquí us deixo la línia de les estadístiques:

IP – Pages – Hits – BW – Last Visit

209.85.238.9 – 152 – 152 – 250.18 KB – 17 Jan 2008 – 16:41

80.224.33.234 – 151 – 402 – 3.03 MB – 31 Jan 2008 – 14:23

Jan 22

Pipe Magic! Migrate from one MySQL server to another

New job, new problems, new hacks! The next hack tries to take all the juice from linux’s pipes.

The task which I had to do was a database migration, from one mysql server to another one. The first problem were different versions, so hot copy wasn’t an option (actually few times is an option, unless it’s not in production ;) ). The next big issue, were the size of the data, its big, really big (from my point of view) some DB reach 800M, for me is big enough to be a big problem :P

Mysqldump + mysql but this is good for 2 DB? I wanted to be selective in which DB to migrate, plus data should travel encrypted and transfer should delay as minimum as possible.

The script I got is this one (showing main loop, what’s interesting):

for db in `cat sm2-hf-dbs-kk.txt`
do
echo "Creant database a ${remote_sql}..."
ssh $remote_sql "echo \"create database if not exists ${db}\" | mysql -u ${db_user_rw} -p${db_pass_rw}"
echo "Fet"
echo "Donant permisos sobre la BD a rw..."
ssh $remote_sql "echo \"grant select, insert, update, lock tables, create, drop, alter on *.* to '${db_user_rw}'@'localhost';flush privileges\" | mysql -u ${remote_admin} -p${remote_admin_pass}"
echo "Fet"
echo "Fent dump gzipat i enviant a ${remote_sql}"
mysqldump --single-transaction -u ${db_user_r} -p${db_pass_r} ${db} | gzip | ssh $remote_sql "gunzip - | mysql -u ${db_user_rw} -p${db_pass_rw} ${db}"
echo "Fet"
done

The new server was empty, so we first ssh to it and from there we create a database. The next step was to give perms over the new db… I see now it can be done in one single line.

After this comes the magic. The script makes a dump of the db, it passes through gzip, this way we dramatically improve speed over the net. This pipe stream is passed through ssh to the other server unzip the info and put into the new mysql server. Pipe Magic rules!

I prefer  ssh the machine rather than setting a tunnel because the tunnel should set before the script, this way we don’t care. The other point is that the ssh should have a valid pair of keys to access it.

That’s all folks! Hope this enlightens someone…

Jan 4

Politó Rap Cuní “ProuProuProu”

Crec que era merescut que tinguessím el politó del rap del cuní per al mòbil, la veritat es que no el vaig buscar si no que me l’he tret jo del “videoclip” del youtube xD Polònia: El rap del Cuní, prou!, o és beatbox?

Una breu explicació del procés; vaig baixar el flv què és el video en flash amb el firefox i l’extensió “DownloadHelper”. Quan tenim el flv al disc usem la comanda

# ffmpeg -i fitxer.flv

que ens dona el següent resultat:

...
Input #0, flv, from 'Pol_nia__El_rap_del_Cun___prou___o__s_beatbox_.flv':
Duration: 00:01:04.9, start: 0.000000, bitrate: 56 kb/s
Stream #0.0: Video: flv, yuv420p, 320x240, 25.00 fps(r)
Stream #0.1: Audio: mp3, 22050 Hz, mono, 56 kb/s

Com veiem hi ha 2 streams, el de audio i el de video. Bé doncs, en teoria amb la comanda següent:

# ffmpeg -i fitxer.flv fitxer_audio.mp3

Podem obtenir el audio del fitxer i de fet així és, es pot reproduir, però no en el meu cas, que el meu mòbil no el pot reproduir… s’ha de recodificar ja que el fitxer que treu està en mpeg layer 2, o sigui mp2…

# file fitxer_audio.mp3
fitxer_audio.mp3: MPEG ADTS, layer II, v2, 64 kBits, 22.05 kHz, Monaural

Al ser mp2 ja no li mola al mòbil, així doncs l’hem de recuperar d’alguna altra manera. I aquí arriba mplayer, sisi amb el reproductor, ja us he dit que era potent.

Tal com indica el ffmpeg tenim l’audio codificat en mp3 així doncs amb el mplayer podem fer un dumpaudio que extreu la pista d’audio de un fitxer de vídeo.

# mplayer -dumpaudio fitxervideo.flv -dumpfile fitxeraudio.mp3

I això és tot! Ja tenim un fitxer mp3 extret de un vídeo del youtube!

De moment jo us deixo aquí un parell de fitxers que ja he extret:

- Rap del Cuní “ProuProuProu”

- “No Pas! Jo Votaré No Pas!” de Lluís Llac del Polònia és clar. Video Jo votaré no pas

Que us vagi de gust! :D

Jan 1

Bon Any 2008!

Aquesta entrada d’any sembla que ha fet pocs estralls això vol dir que aquest 2008 segur que serà millor que el 2007 que deixem, si més no això  és el que espero per tots vosaltres!

Bon Any!

Dec 26

Hi ha fills de puta per tot arreu…

La veritat és que acabo de flipar molt en veure el següent sticky als forums d’Ubuntu.  ATTENTION ALL USERS: Malicious Commands el títol ho diu tot… Hi ha gent prou filla de puta per com per indicar que comandes del tipus ‘dd if=/dev/random of=/dev/sda’ poden arreglar alguna cosa.

No acabo d’entendre quina es la gràcia que troben en fer això. La veritat és que ja mels imagino, uns putus lamers sense feina, criatures que acaben de descobrir el rm -rf i que volen, potser, sentir-se ‘mega-juankers’ perquè han aconseguit que un probre user borri la seva partició arrel o casqui el disc…

Cap al final de l’article  fins i tot es troba codi en hexdecimal que es tradueix a un ‘rm -rf ~ ‘ no hi trobo el sentit…

Hi ha altres entrades que si poden arribar a tenir algun tipus de lògica, o utilitat pel fill de puta. Es troben línies amb un wget d’un fitxer i la seva posterior execució, un exploit, un trojà, un massmailer… d’aquests scripts n’he recollit uns quants i ja tinc pensant fer-ne un petit anàlisi.

A veure si fem correr la veu… no hem vull ni imaginar quants nous users deuen haver passat per aquestes commandes malicioses…

Dec 26

Oficialment un twitter

Bé, ja he probat això del twitter. De moment es una tonteria com una altra però bé si aconsegueixes tenir uns quants followers doncs pot estar bé per fer el memo.

Pròxima parada. Twitter2minipost <-> minipost2Twitter

Dec 25

Credits

As you may have seen there have been lots of changes on the appereance fo this blog. Well I just wanted to make post to thanks to people that make this change happen:

  • Smilies are borrowed from VikiWorks they are png that look quite good xD ;) If you follow the instructions to change from gif to png take note that the file that is have to modify is wp-includes/functions.php
  • I’ll integrate some type of minipost to quick blog from my twitter thanks to RudeWorks to show me the way to go.

I’ll keep on changing!

Dec 25

Yeah… I got troubles in a wordpress upgrade

I must confess, I got into troubles while upgrading the installation of this wordpress.

Seems impossible how a such easy and user-friendly piece of code as wp is can go wrong and mess a little, just a little. Here it comes my little pain in the ass…

In this this story I’m much responsible as wp upgrade thing. When I created this hosting account and created a new mysql user for my blog I gave it limited grants to only select, insert, update and delete. When I got the upgrade of course it tells me that it has to upgrade my database, sure why not, help yourself wp! And here they are! lots of error of access denied while trying to alter or create tables in the database…

1st Round: Result, blog showing sql errors…

I quickly give my user the proper perms to let it make anything, then go to upgrade one more time and… what? Database is up-to-date… Uhm… You did it wrong wp…

A little ‘vim’ here and there and a solution was found. It seems that the upgrade.php script in wp don’t detects well access denied errors type and it updates the db_version option, that is located at wp_option table of your wp database. So I had to manually “downgrade” its value to let upgrade script rerun again.

Now everything is ok and posting.

Dec 24

Nostalgia… dies de uni

Doncs avui he recordat vells temps de la Uni tot anant a fer una mini reunió pel curru nou i bé he recordat les meves llaaaaaargues hores escoltant al Lozano a la classe d’ALCC.

El pitjor de tot és que aquestes assignatures espeeeeesses a matar les feien a la tarda, en fi d’aquelles moments de paranoia estudiant ALCC en va sortir el següent text “Epi i Blas descobreixen ALCC”

Escrit amb Vim, en html per consola. De tot menys estudiar xD

Dec 19

Nova Etapa. Nous Vents. Nous cambis

Bé com molts ja sabeu deixo la meva feina actual per començar l’aventura en una empresa nova. La veritat es que estic molt animat i amb ganes de fer aquest canvi.

Tot apunta que podré viure una mica més tranquil del que vivia ara, així que s’ha d’aprofitar per tirar endavant alguns canvis que tinc pendents.

El primer de tots…. donar una mica més de “vidilla” al blog, a més de fer un rentat de cara, que el theme per defecte… bé és funcional pero no es cap maravella. A més tinc bastant material nou que aniré comentant per aquí.

També posaré en marxa alguns projectes que tinc a mig fer… ja els niré presentant jeje

A més tot apunta a que l’IGLU vol reviure, havíam si podem tirar-lo endavant!

A tot això, ja que hi som estic dubtant entre dos themes Minus19 0.9 i Juicy 2.0 quin us agrada més? Deixeu comentaris :P