KrnlPanic's Linux Notes and Tips

Working with linux since kernel version 2.0.30

Stopping bad bots using Apache Modsec

Some webcrawlers (i.e., Bots) are important to the well-being of your website. Some of these include GoogleBot, msnbot, Yahoo! Slurp, etc. There are also a lot of bots out there that do nothing to help you, and actually can harm … Read more »

Using reCAPTCHA in PHP to stop form spam

Are you tired of spambots submitting your “Contact Us” forms? Tired of spambots using your forms to “Tell a friend” with a spam link? Use Google’s reCAPTCHA service! It’s really easy to implement. Visit the google reCAPTCHA website to sign … Read more »

Auto Copyright using PHP date function

Do you own a website with a copyright tag that you’re tired of remembering to update every year? Here’s a very simple method of ensuring that your copyright is up-to-date, and you won’t have to worry about it ever again. … Read more »

MySQL rand() High CPU Usage

MySQL has been eating my server alive for the past several months, and I never could determine the exact cause. I’m running MySQL in a VPS environment with 1GB of RAM with two dedicated AMD (Opteron) CPU cores. From a … Read more »

Using ‘while’ in the bash shell

I like to use while loops to perform a command or group of commands indefinitely until I type ctrl-c to stop the loop. The while loop is useful when monitoring the output of the netstat command Alternatively, the above one-liner … Read more »

IANA IPv4 Address Space Registry

Posting this here because I like it. I use it to generate by firewall rules to block as much international traffic from my server as possible since it’s pretty clear that some Class A IP blocks don’t need to be … Read more »

How to Use IPTables

IPTABLES TUTORIAL / HOWTO I. Definitions and similarities to ipchains II. Chain types and options III. Command pharmacy no prescription line examples With the release of the 2.4 kernel, everyone who was used to using ipchains to configure their firewall … Read more »

Using a ‘for loop’ in linux bash shell

The for loop in a unix/linux shell is used to execute the same thing over and over again, or iteratively. Here are a few examples of simple for loop usage. The following loop goes through all files names *.jpg and … Read more »