Scrape Entire YouTube Channel

A client needed all their YouTube videos transferred due to a mixup losing access to an account. The utility youtube-dl makes this very simple:

youtube-dl -citw ytuser:[USERNAME]

Change cPanel cpanellogd processing frequency

By default cPanel processes logs every 24 hours and bandwidth usage every 12 hours. If you have a server node full of cPanel VPSs this can cause very high load as all the VPSs process logs at the same time. One of our clients was having this problem. Strangely, cPanel does not have any documentation about configuring cpanellogd from the command line. All their docs say to just do it from the GUI, which would take way too long on a server node full of cPanel VPSs. After some investigation and a helpful tip from Joe S., a Level III tech at Hostdime, I discovered the necessary parameters and config file. I fixed it with this little script to change the cpanellogd processing frequency to something different for each VPS:

for ct in `vzlist -H -o ctid`; do 
        echo "doing $ct..."
        cp /vz/root/$ct/var/cpanel/cpanel.config /vz/root/$ct/var/cpanel/cpanel.config.orig
        sed -i "s/bwcycle=12/bwcycle=1$i/g" /vz/root/$ct/var/cpanel/cpanel.config
        sed -i "s/cycle_hours=24/cycle_hours=2$i/g" /vz/root/$ct/var/cpanel/cpanel.config
        vzctl exec $ct /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings

Prevent Post Authors from Moderating Comments in WordPress

When developing a complicated, role-based WordPress site for a client, I discovered an issue with the author role. By default authors do not have the moderate comment capability and we did not want them to for the site. However, they are quantitatively able to moderate comments on their own posts WordPress. This has brought lots of complaints to the WordPress bug tracker, however admins have said they will not fix for some reason. I discovered a fix courtesy of kevinB:

Index: capabilities.php
--- capabilities.php (revision 18607)
+++ capabilities.php (working copy)
@@ -1092,6 +1092,7 @@
                 $post_type_object = get_post_type_object( $post->post_type );
                 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
+                $caps []= 'moderate_comments';
         case 'unfiltered_upload':
                 if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) )  )

How to create your own website for cheap or even free

We have reached the point where websites are highly desirable. It can save startup costs and allow anyone to do business around the world without opening a costly brick and mortar storefront or office. As no one uses the yellow pages anymore, an online presence is essential for business. Websites are also a very easy way to disseminate information. However, I realize that not everyone has a budget for a website. Either due to a cash shortfall, just starting a business venture out, wanting to keep costs low, or maybe the site is just for fun. Either way, we are lucky there is now a plethora of free open source software and free services out there to assist with making a cheap website.

Just so I don’t give anyone false hopes I want to be clear that you cannot expect the same results or look as a professionally-designed website. These typically start at a few hundred for the basic site and go up depending on requirements. If custom work is required it can easily get in the thousand dollar range. Your cheap site won’t look as fancy or professional but it will still have basic enough functionality to serve as an online platform of some sort. Websites also require a hosting package, which allows your website to be publicly accessible to the world, and a domain name (i.e. These added costs are at least $150-$200 a year for a bare bones hosting and domain package.

To get started, signup for a free blog with You don’t have to use it as a blog, you can just add pages and use it like a website. You don’t need to mess with any code as WordPress has a built-in WYSIWYG editor that functions much like Microsoft Word. Their free plan allows for 1GB of space, which amounts to about 1500 high resolution photos. You can only use the templates they provide under the Appearance > Themes tab.

The next step up from that would be to purchase your own domain name so your site will appear as This can be done through the service or from a domain registrar like Namecheap for $10-$25/year. Many use Godaddy but I highly recommend against them as they have a poor customer service record, a history of security breaches, and their website is difficult to navigate with all their nagging attempts to upsell.

If you do not like the free templates offers, you can choose a design you find online ( is a good resource) and sign up for your own web hosting account in order to use it. Unless you know HTML and CSS markup/style languages it will typically run $200 to customize the design to your specific site. Add on another $15/month for a web hosting package that allows you to do anything you like with your site without restrictions. Contact me for a hosting package coupon or comment below with any questions. + Domain Your own hosting plan
Cost/month Free $2 $17 & up
Space 1 GB – 1500 high res pics 1 GB – 1500 high res pics 5 GB – 7500 high res pics
Design Limited to free templates Limited to free templates Only limit is your imagination

How to transfer your domain away from GoDaddy

Usually transferring a domain from one ICANN Accredited Registrar to another is a fairly straight forward process. An EPP code is obtain from the existing Registrar, provided to the new Registrar and the transfer is completed.

However, you should expect to encounter various obstacles any time you attempt to reduce your existing payments or liabilities to (the evil) GoDaddy. GoDaddy’s raison d’etre is clearly apparent in the company’s daily business practice and their high level decision to identify their nameservers with the string “DomainCONTROL. This post is to written to assure readers that wresting control of your own domain from the scared, tightfisted, egocentric, sexist, criminal and paternalistic ‘Daddy’ is possible with determined application of the following six steps.

Step 1. Obtain user name and password of the domain name’s Owner’s GoDaddy Account.

This first step if often very difficult.

Sometimes the owner was never even made aware of their own GoDaddy account information because some family friend or fly-by-night web designer/hobbyist set up the account very early in the web site design phase. Since the GoDaddy account information was never even needed or relayed to the actual owner of the domain name this “owner” is now effectively held captive by GoDaddy in perpetuity. (Just the way godaddy like$ it.)

Other times, the owner simply can not recall this used-once, late-at-night in typical Jerry Mcquire fashion and quickly forgotten type of login information. It’s highly likely that the registrar has never even logged into the account since it was first created several years ago. It’s not uncommon for the resistrar to not even recall the email address originally used when setting up the GoDaddy account several online businesses ago.

The good news is, GoDaddy does provide a “Account Retrieval System” for retrieving customer numbers, password hints or password resets. However, if the original email address is unknown or in many cases if the original email address is no longer even a valid address, the GoDaddy Account Retrieval System will be utterly useless to the owner.

If this is the case the only method of obtaining access to your GoDaddy account is via GoDaddy’s Change of Account/Email Update Form. Directions for completing this form can be found here and will require the submission of a government-issued photo ID such as a driver’s license, military ID, or passport and/or a ‘valid’ business identification such as a Business license, or tax certificate type of documentation. No, I am not kidding.

This is where that previously mentioned “determined” aspect comes into to play if you will ever again exercise your legal ownership rights over your own domain.

Step 2. Obtain user name and password of Owner’s DomainsByProxy Account.

Occasionally it is possible to skip this step. But more often than not the GoDaddy domain registration process makes it HIGHLY likely that the registrar is using DomainsByProxy. After all the “Privacy Enhancement” provided by DomainsByProxy is only another $9.99 per year.

Here is a fun exercise. Try completely this simple statement:

Your identity is nobody’s business but …?

If you thought your identity was nobody’s business but your own you would be wrong. You see, DomainsByProxy, another company owned and operated by GoDaddy founder and Executive Chairman Bob Parsons, enthusiastically promotes the idea that your identity is nobody’s business but Bob Parsons‘. If that is not enough to just turn your stomach, I don’t know what is.

The same mind-numbing process applies here for login assitance as with GoDaddy. For there are password hints and a password retrieval process. Worse case, there’s an email update form that requires, among other things, a government-issued photo identification or government-issued documents for company identification.

You might ask yourself why on earth you might need two DIFFERENT login and passwords to two DIFFERENT web sites just to change your own domain named servers or to register your domain with a different ICANN Accredited Registrar. Even in the extreme and rare cases of fraud it’s not like there is not a very solid trail of WHERE exactly your precious domain name has been transferred to. The ICANN system is already double redundant. It seems more than just a little disingenuous that this convoluted system of multiple web sites, account numbers and passwords is designed to “protect the customer” as Domains By Proxy claims in its FAQ

A separate Domains By Proxy (DBP) account ultimately adds another layer of protection to your domain name — and you!

By having a separate DBP account you thwart potential domain name hijackers — they need access to both your DBP account and your Registrar customer account in order to cancel your private registration and steal your domain name. Most thieves don’t take the time to hack two accounts, and they move on to another domain name.

Domain names are not money that can be stolen and spent without a trace. Domains names only exists within the ICANN System. Where do you suppose an alleged thief is going to spirit your domain name off to? Even fungible cold hard cash can be accessed, transferred and ‘stolen’ by thieves with a single user name and password. But GoDaddy formed this sister company to propagate the myth “for your protection” that a second set of user names and passwords are required to protect your precious Domain Name from being “stolen”. Oh wait- and it only increases the cost of registering your domain name by a factor of nearly 100%.  What a bargain eh?
A domainbyproxy account number is typically an 8 digit number, very similar to your GoDaddy account number with the last few digits changed.  For a while the following work around existed for retrieving your DPB account number from within your GoDaddy account but even this method has been now been thwarted.

With these first to two difficult steps successfully accomplished the escape from GoDaddy is now within your reach.

Step 3. Remove Proxy Coverage on Domains

Log in to and you should arrive within the Private Domains tab.


Select the domain name(s) for which you want to cancel private registration (all). Then either click the Cancel Selected button found at the very bottom of the list shown below in red circles. Or select the individual domain name you want to cancel domains by proxy coverage of and click the top icon I have shown below in blue circles.


Regardless of which method you chose, the end result should be the same with the text shown in the little green circle above changing to reflect Canceled.

Congratulations Domain by Proxy coverage has now been removed.

Step 4. Unlock Domain within GoDaddy

Again another totally redundant step who’s only purpose is to prevent existing GoDaddy ‘customers’ from voting with their feet and leaving in droves is the “Lock” feature within GoDaddy’s notoriously bad control panel. To remove the lock on a domain in GoDaddy do the following.

Log in to the registrar’s GoDaddy Account


Click My Account on the far right of the screen in black.


Record the Customer Number.


Click Update Security Settings


Record the 4 digit PIN displayed. ( You will need this later). Change Email to reflect your current email address.


Select the Products tab


Hit the Launch button next to Domains


Select All Domains by clicking the little black check-mark icon.


Unlock Domain by hitting the lock icon. All the domains should have the little lock icon greyed out.


Your domains are now clear of all the extraneous mechanism by which GoDaddy holds domain names captive. Just a few more hurdles to clear and your domain will be transferable.

Step 5. Obtain EPP code from GoDaddy to authorize domain name transfer.

From the Tools Menu Select Exportable Lists


Click Add New Export

Make sure “All My Domains” is displayed then click Next


Check mark Authorization Codes then Click Next


Select file type CSV, compression None. Name it something you’ll remember. Then hit Finish. This will work for 99.9% of users contrary to what GoDaddy auto-populates


You are now suppose to wait for GoDaddy to send you an email. It has been my experience that that email will never actually arrive. So go pour yourself a self-congralutaory drink or go indulge yourself in a nice healthy treat then come back and complete the following step.

Log back in to your GoDaddy Account one last time

Click My Account on the far right of the screen in black.


Hit the Launch button next to Domains


From the Tools Menu Select Exportable Lists


Check the box to select the file then click Download Now!


If for whatever reason there is NOT an available option to Download Call 480-505-8877. You will be prompted to enter your account number followed by the # key. Option 3 Option 1 will connect you with technical support. Have that PIN number you saved the first time you logged in at the ready.

Hopefully, you now have a .cvs file on your local hard drive containing the EPP required to complete domain transfer. Let’s check to make sure.

Step 6. Verify your work.

From inside your web browser hold down the control key and letter “j” at the same time (Control+j) and a list of your recent downloaded files should appear. Double click on the .csv file you just downloaded from GoDaddy. If it does not automatically open the most popular program  for viewing .CVS files is Microsoft Excel. With Excel you can open the .csv file and it should look something like this.

The important thing to check for is that the DomainName you are transferring OUT of GoDaddy should now be both PUBLIC and UNLOCKED. If it is not, you should review the steps above to see what you missed the first time through. As a hint, if the “Privacy” column is not reflecting PUBLIC that means DomainsByProxy will prevent the transfer until you’ve successfully remove proxy converage ( see Step. 3 above ). If the “Locked” column is not showing UNLOCKED that means GoDaddy will prevent the transfer until you’ve successfully unlocked the domain (see Step. 4 above).

The long string of nonsense characters in the  “Authorization Code” column is the EPP code required to effect the transfer via ICANN’s system. CONGRATULATIONS, with this authorization code in hand you are now finally free to transfer your domain away from GoDaddy to any one of the hundreds of ICCAN acredited registrars found on this exhaustive list.

If you get stuck along the way or would like someone to just do all of this for you, pick up the phone and call 352-356-8985 or  send us an email to Just let us know you want to get rid of GoDaddy today. You’ll feel much better knowing your funds aren’t continuing to feed this monster.

We’ll handle the rest.

Designed to Fit Your Visitors’ Screen

To view the screen resolution statistics of your site’s existing visitors, access your Google Analytics account.

Click “Standard Reporting”


Select “Browser & OS” from the “Technology” Menu along the left side-bar.

About half-way down the page, select “Resolution” from the “Primary Dimension” menu.

The result will be a report displaying data something like this.

If I were to re-design this site to be best viewed on a display 1024 pixels long and 768 pixels wide (or better) my design would match the display resolution of 42.4 % of my existing viewers.

Adjust Size of WordPress Tag Cloud

The default text size for WordPress tag clouds can be quite large. By default there are no options to change this. One option that I’ve seen recommended on forums is to hack core WordPress files to change this default behavior. However, these changes can be overwritten upon version update. A more permanent change is possible with the help of a plugin and some simple custom code:

  1. Install and activate the plugin PHP Code Widget
  2. Replace the old tag cloud widget with the new PHP code widget
  3. Insert this code into the new PHP code widget:
    <?php wp_tag_cloud('smallest=7&largest=13&number=15&orderby=name&format=flat'); ?>
  4. More options for customizing tag clouds are available from the WordPress Codex

Save WordPress Custom Headers on Theme Change

When changing themes in WordPress custom headers are lost and must be re-uploaded. This even applies when installing a child theme and can be quite a hassle when using themes like Twenty Eleven with potentially a great number of header images. This can be fixed with the following MySQL commands, issued from the command line or phpMyAdmin:

  1. Get the exact name WordPress uses for the new theme with:
    SELECT option_value FROM wordpress_database_name.wp_options WHERE option_name = 'current_theme';
  2. Associate the old images with the new theme:
    update wordpress_database_name.wp_postmeta set = 'new_theme_name' WHERE meta_key = '_wp_attachment_is_custom_header';


Free Open Source Carts versus Paid Proprietary Carts

Many clients come to us having heard about paid proprietary carts like Shopify, Volusion, & 3DCart. This is not surprising, as these companies tend to have large marketing budgets. While we evaluate each client’s specific needs, we generally recommend free open source carts like Magento, ZenCart, & osCommerce for the following reasons:

Free open source carts Paid proprietary carts
Open source so code is changeable, can be tailored to exact needs Proprietary so code is unchangeable, only superficial changes allowed
Can be moved to any web host if there are problems All in one package so stuck with a single company, migration to another platform is expensive
Free so only cost is setup and web hosting, not punished for growth Entry-level plans start cheap but get expensive very quickly, limits growth

APC + PHP-FPM + nginx = 200% Performance Increase with Magento

Magento is notoriously slow out of the box. The built-in caching helps a lot but it still requires a bit of tweaking. When a client was rightfully complaining about their slow load times, we went to work to get the most out of Magento. In addition to moving them to a better server we utilized APC, PHP-FPM and the lightweight nginx web server. The results speak for themselves:

Apache Benchmark was used to derive these numbers, set at 20 page loads with 5 concurrent connections in order to simulate 5 customers looking at the site at once.

Magento: Display Amount Until Free Shipping

A client requested their Magento store display at checkout the amount customers need to purchase to qualify for free shipping. This is a quite useful feature that unfortunately Magento does not support out of the box. No worries, as we added it with just a bit of PHP in app/design/frontend/default/yourtheme/template/checkout/cart.phtml:

<?php if ($this->getQuote()->getSubtotal() < 50): ?>
<?php $subtotalamt = $this->getQuote()->getSubtotal(); ?>
<?php $freeshipamt = 50; ?>
<?php $sumtotal = $freeshipamt - $subtotalamt; ?>
<?php Mage::helper('checkout')->formatPrice($sumtotal); ?>
<p>You are just <span>$<?php print ($sumtotal); ?></span> 
away from earning free shipping!</p>
<?php endif ?>

Convert HTML emails to plain text and trim for SMS text messages

I forward emails from clients to my phone via SMS, i.e. Initially I thought something was wrong on my carrier’s side as I was only sporadically receiving them on my phone. However, it turned out these were HTML emails and the SMS gateway will not deliver those. Also, the tendency to reply with very long quotes results in excess texts as the limit is 160 characters per text message. Here is how to fix those two problems using procmail.

Setup a forward that pipes to /usr/bin/procmail (or whatever the location on your server). Below is my .procmailrc with the filters that worked for me:

* ^Content-Type: text/html;
                    file = "$HOME/mail/prc.out"
                    LOCKFILE = $file$LOCKEXT
                    :0 fbw
                    | cat > $file && /usr/bin/lynx -dump $file
                :0 E fbw
                | /usr/local/bin/perl -0777 -pe 's/<[^>]*>//g'
| cut -c 1-160                        
* ^Content-Type: text/plain;
  | tr -s '\011\012 ' ' ' | cut -c 1-160

Plesk error: mail server requires authentication to send to a non-local email address

Funny how many of the odd server admin problems that I run into have to do with Plesk. This error randomly started happening one day when trying to send email to any user on a Plesk windows server:

503 This mail server requires authentication when attempting to send to a non-local 
e-mail address. Please check your mail client settings or contact your administrator 
to verify that the domain or address is defined for this server.

All the mailboxes were enabled. Mailenable relay settings looked OK. Maybe something happened with Plesk? I just repaired all the mailboxes for the heck of it:

%plesk_bin%\mchk.exe --all --fix=local

Error magically fixed!

Get Redhat updates without subscription, fix cPanel “No method to auto repair package system” EasyApache error

A Red Hat 4 server could not rebuild Apache or PHP with cPanel’s EasyApache. It kept getting a no method to auto repair package system error. cPanel support said this was due to the Red Hat subscription expiring.

Instead of paying for another $375 subscription just to get some updates, I migrated the server to the corresponding Centos 4.x release. I then made the proper packages were excluded in the first yum [main] block:

exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*

and then yum list and yum update worked.

Using find on Linux

Basic search with find:

find /directory -name 'search term'

Search files in subdirectories of current directory:

find . -name 'search term'

Find large files:

find / -type f -size +100000 -exec ls -lh {} \;

Search inside file contents:

find . | xargs grep --color=auto -iR 'search term' *


find . -type f -exec grep -lR 'search term' {} /dev/null \;

Find files modified in certain time period:

find . -name 'search term' -mtime -1 -print

Exclude certain directories in search:

find . -name 'search term' -prune -o -name 'excluded directory1' -prune -o -name 'excluded directory2' -prune -o -type f -print

Find files older than a certain date (2 days in example) & delete:

find . -mtime +2 -exec rm {} \;

Find and replace in files:

find ./* -type f -exec sed -i 's/search term/replacement/g' {} \;

Automated MS SQL database backup using command line

A customer wanted automated backups for their MS SQL database. Unfortunately MS SQL management can be a little tricky since it doesn’t have something straight forward like phpMyAdmin for MySQL.

  1. Load SQL Server Management Console or Studio Express
  2. Select New Query
  3. Enter the query:
    backup database databasename to disk='C:\db.bak'
  4. Save query to C:\backupdb.sql
  5. Create a new .bat file by right clicking in Windows Explorer, select New Text Document, then rename to backupdb.bat
  6. Enter the command:
    sqlcmd -S .  -i "C:\backupdb.sql" > "C:\backupdb.log"
  7. Navigate to Control Panel, Scheduled Tasks, Add New Task, and select Command Prompt
  8. Change the task path to backupdb.bat, start path to C:\ and set how often you want to backup

Script to sort & show directory sizes in Linux

Just change /www/htdocs/ to the desired directory that you want to see the subdirectory sizes for, sorted by size descending.

du -k /www/htdocs/* | sort -nr | awk '
     BEGIN {
 split('KB,MB,GB,TB', Units, ',');
 u = 1;
 while ($1 &gt;= 1024) {
 $1 = $1 / 1024;
 u += 1
 $1 = sprintf('%.1f %s', $1, Units[u]);
 print $0;
 ' > filesize.txt

Upgrading PHP on Plesk Virtuozzo VPS

The CentOS 5 EZ template released by the Russian mafia at Parallels contains an old version of PHP and is yum-less. The first step to upgrade this is to install yum with this huge number of packages.

Next install the great atomicrocketturtle repositories:

wget -q -O - <span></span> |sh

And then finally update PHP:

yum upgrade php

If upgrading from PHP 4, there maybe some additional config files to mess with. See atomicturtle’s wiki page on PHP for troubleshooting.

Rotate Apache (or any) logs on linux

Logs can quickly grow to take up disk space. To alleviate this problem, install logrotate if your distribution does not come with it already. Edit /etc/logrotate.conf changing the first line to the period when you want to rotate the the logs (daily, weekly, monthly, yearly). Change the rotate command under that to how long you want to keep old logs for, e.g. if rotating logs every month and to keep the logs for a year use rotate 12.

Edit (or create if necessary) /etc/logrotate.d/httpd to contain the following:

/usr/local/apache/logs/*_log {
 rotate 12
 /usr/local/apache/bin/apachectl graceful
  • monthly: time period elapsed before the logs are rotated
  • rotate 12: logs are rotated 12 times before being removed (i.e. 1 year), if set to 0 old logs are removed rather then rotated
  • compress: old logs are compressed with gzip to save disk space
  • missingok: if logs are missing skip and do not issue an error
  • notifempty: do not rotate empty logs
  • sharedscripts: only run postrotate command once for all the logs in the specified directory, rather for each log
  • postrotate: command to run after logs are rotated, necessary for apache to start logging again

Be sure the paths /usr/local/apache/logs/*_log and /usr/local/apache/bin/apachectl graceful are correct for your configuration. Graceful will restart apache without ending any current requests being served.

Disable catchalls on entire cPanel server to prevent spam

By default cPanel is set to accept catchalls, that is mail to non-existent users, and bounce them. This can result in much spam being accepted by a cPanel server as spammers often brute force or randomly address their spam. Further, the bounce is usually set to an innocent address that was spoofed, creating what is an increasing problem known as backscatter spam.

A few steps are required to completely fix this. First disable this default setting in cPanel WHM by going to Server Configuration > Tweak Settings > Mail > and set Default catch-all/default address to :blackhole:. This will silently drop spam rather than bounce it, preventing more backscatter spam.

Next, disable all catchalls on the server:

mkdir -p /etc/valiasesbak
cp -R /etc/valiases /etc/valiasesbak
sed -i 's/^\*: [^ ]*$/*: :blackhole:/g' /etc/valiases/*
replace ':fail: No Such User Here' ':blackhole:' -- /etc/valiases/*

Check if there are any lingering aliases set to bounce with:

grep '*:' /etc/valiases/* | egrep -v ':blackhole:'

There maybe a few other bounce fail phrases like “Invalid e-mail address. Check and re-send.” Simply substitute these phrases in the replace command above, so:

replace ':fail: Invalid e-mail address. Check and re-send.' ':blackhole:' -- /etc/valiases/*

Ensure users can write with:

chmod 777 /etc/valiases/*
chown nobody:nobody /etc/valiases/*

Lastly, prevent users from re-enabling the catchall. In WHM > Packages > Feature Manager, select Default under Edit a Feature List and then edit. Uncheck Default Address Manager and then save.