Blog Archives

MySQL Latin1 to UTF8 conversion

Many people think it’s as simple as doing a mysqldump->sed->mysql command (or clicking Change->Collation in PhpMyAdmin) but that only changes the encoding for NEW data, while leaving the old data intact and possibly coming out dirty. Luckily there is a

Posted in bash, Database, linux, servers Tagged with: , , , , , , , , , ,

Rename spaces to underscores

How to rename files with spaces to use the underscore character instead .. or any other web friendly character. I’ve just been handed a zip full of files, and want to host them, but they’ve all got nice pretty spaces

Posted in bash Tagged with: , , , , ,

Vim as Man page viewer

Linux man pages are gold, and much quicker than googling, but I hate having to learn yet another interface for what is just a text flatfile that’s a bit to big to fit on a single 80 x 24 character

Posted in bash, linux, vim Tagged with: , , , , , ,

Tracking your /etc with git version control software – and make apt-get do it automagically

Linux computers (mostly) use /etc to store config files. From server software like Apache, PHP, ProFTPd and OpenVPN through to X11 and Mutt, they all keep their config files in /etc. User config files are mostly kept in /home/$username/ so

Posted in bash, linux Tagged with: , , , , , ,

Recursive unzipping many zip and rar files in many folders.

So I have a directory with ~100 folders, each containing atleast 1 zip/rar file that needs extraction. No point in keeping the zip/rar file afterwards either so remove it. find . -name "*.zip" -exec unzip {} \; -exec /bin/rm {}

Posted in bash, compression, linux Tagged with: , , , , , , ,

Running PNGCrush on a recursive directories

One easy way of reducing website load time is by optimizing your images, which is what PNGCrush does. PNG graphics are often more bloated than they need to be so using PNGCRUSH should be obvious. Basic usage flags don’t allow for recursive

Posted in bash, compression, linux Tagged with: , , ,

.bashrc doesn’t get loaded when logging in through TTY

Symptom: ~/.bashrc doesn’t load when logging in through TTY, but it will through xterm/guake/etc.. Solution: TTY loads ~/.bash_profile by default, so append to/create ~/.bash_profile the line $HOME/.bashrc and it will load. Under some installs, it may be ~/.profile rather than

Posted in bash, linux Tagged with: ,