Why do witches burn?

Because they’re made of wood, like bridges, and so float on water, like churches, very small rocks, gravy, and a duck.

Archive for the 'My useful scripts' Category

Backup organizer

Le Jeudi, mai 6th, 2010

Backuping data is real easy (with linux). I use three different ways:

For a data base BDD : mysqldump [cnx infos] |gzip > backupbdd.sql.gz
For not too numerous files, which data is important, like configuration ones: tar czvf yoyobackup.tar.gz dafiles/
For files I want to access easily and/or numerous : rsync -av me/ othercomputer:me/

In the two first cases, [...]

Read the rest of this entry »

Photoshop Text Extractor

Le Mercredi, mars 17th, 2010

While making Geek’s World, I often change the text at the last moment. As a result, the content of the .psd file was more accurate than the text in the database.
Plus, I also used to translate from English to French directly in photoshop.
And as I want to display the text on my webpage (google indexation) [...]

Read the rest of this entry »

Convert HTML into BBcode

Le Mercredi, avril 8th, 2009

BBcode is the syntax used in phpBB forums and some other websites with edit forms, due to it’s simple and intuitive syntax, opposed to that stupid wiki code no one ever gets.
If, like me, you ever wanted to post the content of an html page, this Perl script is for you.
It takes a HTML file [...]

Read the rest of this entry »

Displaying a progress bar

Le Dimanche, mars 1st, 2009

Ok, it’s not really a bar. Draw something, being careful of the width of your command-line terminal, is tricky. But, you’ll get the display of the percentage of progress of the script and the time that is probably remaining.
Example. You have a script doing 20,000 times about the same thing. You want to know how [...]

Read the rest of this entry »

Be careful, this is the translation of two French articles and it’s long.
Today we will be writing time in a way that is comfortable for a human reader.
Who want to read, “Only 0h 00mn 18s left” at the end of a count that began an hour ago?
Before, strftime() was enough. Now, time to do better.
When [...]

Read the rest of this entry »

Translation SQL table and translation system

Le Mardi, février 10th, 2009

This is a short, non-interesting article about a translation system. Nothing new or original here.
I put here because my next article will use it and it’ll be a very long one.
I a few month, I’m gonna talk a lot about translation. I’ve made many things about it, especially for automatic translations.
Here, it’s about having a [...]

Read the rest of this entry »

List all 404 errors from a Apache server

Le Lundi, janvier 26th, 2009

This is not the only solution to know if your website got dead links.
For example, Awstats will tell you them too, but only from on site at the time.
Also, online dead link finders are you friends, like W3C Link Checker.
My solution works directly on the server, and also find the errors that com from a [...]

Read the rest of this entry »

Url rewriting is your friend

Le Vendredi, novembre 28th, 2008

Url rewriting, is to have a link to a webpage that a human can read, and a search engine can interpret as keywords.
Many blogs use this, they use the title of the post in the url.
Example :
Good: http://toto.com/articles/eat-creme-brulee.html
Bad: http://toto.com/2007/article.php?id=684
You english reader may not care about this, but the main problem characters with accents : [...]

Read the rest of this entry »

Even in PHP 5, this old security params is activated by default, and I hate it. It’s Magic Quote.
When this flag is On, then vars in cookies, from a form or a url, are automatically “escaped”.
It means that backslashes are added before some special characters. Primary: the simple quote.
Example : my script toto.php contains this [...]

Read the rest of this entry »

The 1468456th PHP class that overloads mysql

Le Vendredi, août 15th, 2008

My first code is totally uninteresting for real developers, but I will use this class often in my next scripts, so you need to know a little about this class.
Plus, it’s certainly a rip-off of PHP 5 mysql class, but well, I still use 4.
It still can do a few good things.

Good display of errors.
Use [...]

Read the rest of this entry »