Programming



Fighting root

Sunday, December 3rd, 2006

The sysadmin at my former employer had the bad habit of uploading files as root to directories we all used. It was a real PITA, so I hacked this script to fix the perms, without having to be root. No magic: the directory has to be writable.

Read the rest of this entry »

leeme.sh

Sunday, December 3rd, 2006

Desde hace años, tengo como costumbre describir todo lo que hago en ficheritos LEEME repartidos por todo el disco duro. Aquí está el script que uso para crearlos y editarlos. Puedes ver el código si pasas a la siguiente página…

Read the rest of this entry »

Good news for PHPlot

Wednesday, November 15th, 2006

To anyone currently using it, it is quite obvious that development on PHPlot was almost frozen. It’s almost been two years since my last CVS commit and during the last 21 months Afan only found time to do some. The only work was done by L.J. Bayuk, of whom I already talked here when he submitted me a great and very complete user manual. During all this time he has helped at the forums, sent bug reports and fixed them; but last 8th of November, Bayuk was added to the project developers assuming the maintainter role, and what an activity! 10 commits, 7 fixed bugs and release 5.0.rc3 ready in 5 days.

Looks like there’s good stuff coming!

Long category descriptions in wordpress

Saturday, October 21st, 2006

Here is the outline of what I did to get some (translated) text displayed at the beginning of every category page. This is mostly a reminder to myself in order to be able to redo it in the unlikely case I upgrade Wordpress and have to go through it once again.

Read the rest of this entry »

[Old stuff] Simple proxyes

Wednesday, October 18th, 2006

I f you need a quick-hack TCP proxy, netcat, a named fifo and one pipe might do the trick:

mknod fifo p
netcat -l -p [inbound_port] 0<fifo | netcat localhost [outbound_port] 1>fifo

Of course you’ll need netcat. But it’s also possible and far more fun, to program one oneself or look at/improve one already made. At my job this february, I chose the latter and found proxyc by Adrian Montero. While looking at it (to check what I was about to use), I worked a bit on the code fixing little things here and there, coding my own personal style and showing my usual lack of originality. The result, though a bit late, is available for download here just in case someone is interested.

A little scheme book

Saturday, October 14th, 2006

Sorry, no english text for the moment.

Views counter

Tuesday, October 10th, 2006

I just installed the view-count plugin by Mike O’Connell. As one would expect, it’s a very simple plugin. On the first run it ALTERs the posts table adding a BIGINT view_count column which is updated when users click on a post. To display the number of views, one has just to call the_view_count() at some place in the template. I’ll add it one day… ;)

Alas, the counter never gets updated… the filters installed by the plugin never get called, since expects filter single_template to be applied somewhere during template rendering, but that filter name doesn’t even exist in my ancient wordpress version. I just added

if(is_single() || is_page())
apply_filter('single_template', $content);

to wp-includes/template-functions-post.php, function the_content() and it works now. I hope that as it should ;)

Mail list statistics

Thursday, June 15th, 2006

An ancient script which I used to compute some stats on who posted how much in mailing lists. Get it here, browse the files and examples, or see the code… (sorry comments in spanish)

Bandwith limiting for Apache 2 (+ bw_mod 64bit RPM)

Thursday, February 23rd, 2006

Sorry, there is no english version of this text for the moment, please select “Spanish” on the right menu bar if you can read it, and still wish to.

Inserting content in DOM nodes with XHTML

Tuesday, January 17th, 2006

Sorry, there is no english version of this text for the moment, please select “Spanish” on the right menu bar if you can read it, and still wish to.

Read the rest of this entry »