URL-Safe Timestamps Using Base64

Passing around timestamps in URLs is a common task. We usually want our URLs to be as short as possible. I’ve found Base64 to result in the shortest URL-safe representation: just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using a hex representation.

The following Python functions allow you to build and read these 6-char URL-safe timestamps:
Continue reading URL-Safe Timestamps Using Base64

Hash Puppy 0.2

This is an update to my simple, easy-to-use checksum calculator. It supports md4, md5, and sha1 hash functions. I wrote the project as a way to experiment with and learn Qt.

Changes since the previous version (Hash Puppy 0.1) include the ability to abort a checksum calculation and improved GUI responsiveness. There were also other minor tweaks to make Hash Puppy easier to use.
Continue reading Hash Puppy 0.2

Improved FTP Backup for WordPress

This script backs up both the database and files of a WordPress blog to a remote FTP server (while keeping a local copy). It’s an update of my WordPress Backup to FTP script. The main changes are auto-detecting database settings and better support for caching plugins (specifically WP-Cache). The new version makes it easier to back up multiple WordPress blogs to the same FTP server.
Continue reading Improved FTP Backup for WordPress

“CC Yourself” and Spam

Every good web programmer will note that the following contact form markup is probably flawed:

<form>
...
    <input type="hidden" name="to" value="support@example.com" />
...
</form>

as it is likely that if the value of the “to” field changes, the message will be sent to the modified address. The problem with this kind of functionality is that it allows a malicious user to send emails from your mail server. More specifically, it can allow spammers to use your benign server to send their spam (and as a side effect, you might be flagged as a spammer yourself).

As this case is pretty obvious, one doesn’t see many real-life uses of it anymore (but careless programmers used it more often in the past until they learned better). However, one can achieve similar goals (spam-wise) by utilizing a common feature in contact forms: the “CC yourself” checkbox.

Continue reading “CC Yourself” and Spam

Disable Touchpad Tapping in Kubuntu

In Ubuntu (GNOME), there is an easy graphical way to disable tapping on the touchpad. However, KDE lacks such a thing. But lacking a graphical configuration tool doesn’t mean this should be difficult. All you need is the gsynaptics package. The package provides a small utility called synclient. Now you can disable tapping by doing

 synclient TapButton1=0

To disable tapping permanently, you should use the following to run the command at the start of every KDE session.

echo "synclient TapButton1=0" > ~/.kde/env/disable-tapping.sh

NVIDIA driver fails to initialize after X restart

This is mainly a note to myself. Sometimes when the X server is restarted, it complains that the nvidia driver couldn’t be initialized and that no screens were found. This may be a result of a version mismatch between X11’s and the kernel’s nvidia module. The solution is to

modprobe -r nvidia

before restarting the X server.

Blocking IP Range using UFW

Uncomplicated Firewall (ufw) is one of the greatest frontends to iptables I’ve encountered. It is very simple to use, and I just wish it were also available for Gentoo. Up until recently, everything went smoothly for me and ufw, but we hit some rough waters when I tried to block an IP range.

To block an IP or IP range in ufw, you should do

sudo ufw deny from 188.162.67.197/21

Continue reading Blocking IP Range using UFW