Category Archives: How-to

How To Install Intel Graphics Drivers in Ubuntu Linux

The motherboard that I picked up for the VCR project provides out-of-the-box full-resolution HDMI video under Linux, but requires an additional proprietary Intel graphics driver to process audio through the HDMI port. Thankfully, this is not a terribly difficult process thanks to the fine folks at Intel providing an easy graphical installer package.

Head over to and download the .deb package for Ubuntu.

Use your preferred package manager to install the .deb package, then run the installed package.

Follow the on-screen instructions to install the drivers.

How To Optimize Your WordPress Website

I’ve been on a bit of a cleaning kick the past few days–probably because the new year is always a good excuse to declutter as much as possible. As such, I have taken to cleaning up and optimizing my website here. I’ll be fixing a few things as the year progresses, piecemeal as always. I’ll be cleaning up broken links as much as possible, removing posts that aren’t relevant anymore, and generally working to optimize WordPress as much as I can.

To start to optimize WordPress, I would start with deleting any database tables left behind from plugins that you have since uninstalled. There is a great plugin that will take care of most of the heavy lifting for you in this regard: Plugins Garbage Collector.

Once installed and activated, you’ll find the plugin under the “Tools” menu on the WordPress admin panel. Make sure the “Search none-WP tables” radio button is selected, then click “Scan Database”.

optimize wordpress with plugins garbage collector

The plugin will present a list of all the non-Wordpress database tables, but do exercise caution here. You absolutely should back up your database before proceeding. Check the box by each of the tables you don’t need and click the delete button.

Now that all the unnecessary database tables are cleared up, the next step to optimize WordPress is cleaning up all the ancillary junk that gets bogged down in your website–orphaned metadata, automatic drafts of posts, etc. The WP-Optimize plugin scans the most common sources of junk files in your website and deletes them, speeding up caching, prefetching, and other behind-the-scenes functions that make a WordPress site run smoothly.

Lastly, I need to clean up the unused images that I’ve uploaded. Not only do I have images scattered about that I have not used for any articles, but WordPress make four copies of each image for use in various areas! For this, I’m going to use DNUI (Delete Not Used Images) to scan my site and remove all the unused files. This isn’t so much an optimization, but a way to recover a significant amount of space on my server.

DNUI also lives in the Tools menu on the WordPress admin panel, so you should see it conveniently located next to the Garbage Collector. The first thing to do is click the “Options” tab, then click to create a backup folder and enable backups–just in case. (Un)Check any other options you wish, and click the “Images” tab to run the scan. The plugin will list any unused image files it finds in your library. All you have to do is click to delete them. A word of caution here: DNUI will list images from draft posts as “not used”, so please verify the images before deleting them.

For the interim, until I get all my drafts fleshed-out and posted, I’ll stick to manually deleting unused images. To do this, click the “Library” link under the “Media” menu on the WordPress admin panel. In the drop-down menu where it says “All media items”, click “Unattached” to show all the images that aren’t attached to a post. This is also not foolproof as it will list featured images and header images that are not already attached to a post, so err on the side of caution here. My suggestion would be to make a post with all your featured and header images, then set it to private.

That’s really all there is to easily optimize WordPress! Run these steps every few months and you’ll have a faster, more efficient website!

How To Automatically Add YouTube Subscriptions To A Playlist

Remember when YouTube used to have a built-in playlist that automatically grouped all your subscriptions’ new videos in one convenient place, allowing you to hit play once and watch all the new content as it was published? Yeah, those were the days…. Now we have a company that seems to be in an adversarial relationship with not only its casual users, but also some of its biggest content creators–a company that seems to want to remove useful options in the name of “progress” (as seems to be a consistent refrain from Menlo Park to Cupertino). Apparently, though, I am not alone for there is a lot of chatter about how to automatically add YouTube subscriptions to a playlist. It seems to be a feature that the users miss, but–thankfully–there are a few civic-minded hackers out there that put a little Google Fu to good use.

Benjamin Worrel found the beginnings of an answer while trawling Reddit for any insights on the problem (I originally found the same post he references in his write-up) in the form of a rudimentary Google Apps script that he then took and improved upon. The idea is that the script scrapes your Gmail inbox for notifications of new videos from your subscriptions, then adds the video to a specific playlist on YouTube (but not the sacred “Watch Later” list, YouTube doesn’t allow you to play with that one!).

To use the script, download a copy (link on this page) to your Google Drive, then follow the instructions in the commented lines of your copy of the script. Start by ensuring that Google Advanced Services is enabled for your account by clicking on the “Resources” menu and selecting “Google Advanced Services”. In the window that pops up, click the toggle next to “YouTube Data API” and make sure it’s on. Then click the “Google Developer’s Console” link to open the API manager and enable the YouTube Data API as there as well. You may now close the Developer’s Console tab as well as the Advanced Services window.automatically add youtube subscriptions to a playlist

In a separate tab, create a new YouTube playlist, copy the ID from the URL (That’s the long string of characters at the end. You’ll see an example in the script’s comments), and paste it inside the pair of single quotes next to var targetPlaylistId.

Personally, I don’t use the “clear old videos” option, so I commented it out with a pair of forward slashes (//). I also don’t want live stream announcements (because I’m usually not around to watch them anyway), so I leave that as true. My subscriptions run the gamut of short to long, so I just comment out the time restrictions as well.

After playing around with the settings and results, I noticed that I was getting a lot of duplicates showing up in my playlist, so I tracked it down to the search query. Leave the line that reads emailQueries.push('from:"" subject:"uploaded a video"');

while commenting out the one that reads

emailQueries.push('from:"" subject:"new videos from"');.

This will help cut down on the duplicates. I also made filters that automatically deleted any emails that weren’t specifically notifying me of a uploaded video (such as live streams and “reminders to watch”) which has also drastically reduced the duplicates I get as well.

You’ll also likely want to keep a log just in case something breaks. In a new tab, open Google Drive and create a new spreadsheet. Copy the document ID from the URL (just like your playlist) and paste it between the single quotes next to var logsheetId.

One last bit of code to change: search for the commented line that reads “// mark the email read and archive it” and below that, change the command




Finally, we’re ready to run the script. Click the “Run” menu, then select each of the items to run them once. You will need to grant the appropriate permissions as requested for the script to function correctly.  By default, the script will run, server-side, every hour, but that can be changed by adjusting the .everyhours() value inside the AddTrigger function. Of course, you also need to turn on notifications for all your subscriptions and make sure that you are emailed when new videos upload.

The script still has a few flaws in it, like not automatically removing watched videos and occasionally adding duplicate videos to the list, but it is so much easier to click an X to remove a few errant videos than it is to go through and click “Watch Later” on piles of backlogged Game Grumps and Channel Awesome videos!

For more information on this script and to get started by copying it to your Google Drive, please visit Benjamin Worrel’s website.

How To Customize Your Terminal Prompt

This is a bit of a goofy hack, but some of the options can be useful if you need a little more information on your terminal prompt. Basically, I’m using it to put a Space Invader as my command prompt.screen-shot-2016-11-07-at-10-02-38-pmThis technique is for OSX/MacOS, but it will likely work on various Linux distros as they share a common terminal shell implementation.

In Terminal, open the .bash_profile file using the nano text editor
sudo nano .bash_profile

Add a new line containing the following code:
PS1=" "

Inside the quotes, you could add nearly anything you want. There are a handful of official switches that generate specific outputs:

  • \d Current Date
  • \t Current Time
  • \h Host Name
  • # Command Number
  • \u User Name
  • \W Current Working Directory (/Folder)
  • \w Current Working Directory, Full Path (~/Desktop/Folder)

Now, if you want to drop a Space Invader inside the quotes, just add it (or any other emoji) from the Edit>Emoji & Symbols menu.

How To Increase WordPress Max Upload Size

I’ve got a major organizational project underway, going through my archives and building new websites for old projects to migrate everything under the domain. As such, I started to build a new website for the old Afterburn podcast, but I couldn’t upload the 15MB MP3 files because of the silly 2MB WordPress max upload size.

Increase WordPress Max Upload Size
“No one will ever upload a file over 2MB! That’s absurd!”

I started by digging through the plugin “store”, trying  a few “upload enhancer” plugins that only gave lip service to the larger upload size. To actually increase WordPress max upload size, you’ll need to do a little editing on the back end. Open a text editor and create a file named php.ini, then add the following lines of code:

memory_limit = 100M
upload_max_filesize = xxM
post_max_size = xxM
file_uploads = On

Where xx denotes your desired file size in MB. 100 is a safe number in most cases, but note that your max_post_size value must be larger than your upload_max_filesize value otherwise you’ll have some heartache when you try to publish a post with one of those large files embedded in it! Save the file and upload it to your the wp-admin folder in your WordPress directory. It couldn’t be much simpler.

How to schedule a task in Linux

Sometimes, you need a task to run at a particular time on a particular schedule. For Project Spoofy, I need the Raspberry Pi to reboot periodically so that any new photos added to ownCloud will be subsequently added to the fbi slideshow. For simplicity, I’m going to schedule a task in Linux to reboot the Pi each night at about 2:30AM, so no one should be affected by the short break in the slideshow.

Schedule a task in Linux

To schedule a task in Linux, use the cron utility to define the schedule as well as the command to be executed. Cron has to be edited by the root account, so a standard user (pi) would need to execute the following command:

cron -e -u root

If logged in as root already, simply execute cron -e

Debian will ask which utility to use to edit the crontab file; I prefer using nano as with everything else. Once the crontab file is open in nano, you will see some information as well as some example formatting. Basically, every task should exist on a separate line starting with the scheduling:
┌───────────── min (0 – 59)
│ ┌────────────── hour (0 – 23)
│ │ ┌─────────────── day of month (1 – 31)
│ │ │ ┌──────────────── month (1 – 12)
│ │ │ │ ┌───────────────── day of week (0 – 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
│ │ │ │ │
│ │ │ │ │
* * * * * command to execute
To reboot at 2:30AM every day, the following line must be appended to the end of the file:

30 2 * * * /sbin/shutdown -r now

The biggest thing to remember is ensuring that the time and time zone are correct. As a pilot, I understand the importance of UTC (or Zulu) time for coordinating across time zones, so I prefer to keep my remote machines set to UTC and do the math accordingly!

How to Automatically Run a Linux Command on Boot

For Project Spoofy, once we’re automatically logged into the Raspberry Pi, we need to execute the commands to run the DDNS update client and the slideshow. It’s a simple process to automatically run a linux command on boot in Debian: just add the command(s) to the end of the .bashrc file in the user’s home folder.

sudo nano ~/.bashrc