Category Archives: How-to

How To Verify HDMI Audio Out In Ubuntu Linux (And Its Derivatives)

Assuming you have installed your graphics card drivers correctly, you will still want to quickly verify your HDMI audio out is working before any further mucking about in the operating system environment. In Ubuntu 14.04, this is done quite simply from the menu bar.

Click the sound icon in the upper-right corner, then in the context menu that appears, click on “Sound Settings”

Screen Shot 2015-04-03 at 11.02.11 PM

In the Sound Settings dialog box, verify that your sound card is activated and click the “Test Sound” button.

Screen Shot 2015-04-03 at 11.02.32 PM

Click the test button for each channel and verify the output.

Screen Shot 2015-04-03 at 11.02.38 PM

Other derivatives of Ubuntu (particularly the lightweight Lubuntu) do not have the robust GUI that Ubuntu features. In these cases, a little terminal jiggery-pokery will be necessary.

Verify the HDMI audio output with this terminal command:

aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav

Use Nano (or another inline text editor) to add the following line to /etc/asound.conf AND/OR ~/.asoundrc (depending on what your distro uses)

pcm.!default = pcm.hdmi

Reboot, and you should be up and running with full HDMI stereo sound!

Also on:

Cross-cut Paper Shredder Teardown and Repair

I managed to completely jam my paper shredder during a bout of document disposal last summer. An old credit report managed to wrap itself around the blade drum and would not back out, so I had to either buy a new shredder or tear this one apart and fix it!

Be sure to like, share, comment, and subscribe! Tally-ho, y’all!

TRANSCRIPT:

1
00:00:00,000 –> 00:00:01,740
gentlemen welcome back to the kitchen table

2
00:00:01,740 –> 00:00:05,220
today we have got this skookum mcchoocher

3
00:00:05,220 –> 00:00:10,500
i can’t! with apologies to

4
00:00:10,500 –> 00:00:13,769
ave that was my my impersonation

5
00:00:13,769 –> 00:00:15,420
there anyway

6
00:00:15,420 –> 00:00:19,439
no i done fuckered up my shredder

7
00:00:19,439 –> 00:00:24,359
here so I yes it’s stuck there’s a

8
00:00:24,359 –> 00:00:28,109
jamalamma paper in there and I can’t

9
00:00:28,109 –> 00:00:33,210
get it to start functioning so our need to take her

10
00:00:33,210 –> 00:00:37,530
apart and yank that paper out and hopefully get it

11
00:00:37,530 –> 00:00:41,370
working again now go here is obviously

12
00:00:41,370 –> 00:00:44,129
the head of the shredder the works really

13
00:00:44,129 –> 00:00:47,850
and hopefully all i’m going to need is a screwdriver

14
00:00:47,850 –> 00:00:52,050
a simple cross-head screwdriver–philips head

15
00:00:52,050 –> 00:00:57,210
and it is hot as balls outside so my frosty

16
00:00:57,210 –> 00:00:58,410
beverage today

17
00:00:58,410 –> 00:01:05,420
courtesy of san diego brewing mission brewing down in san deigo

18
00:01:05,420 –> 00:01:09,500
pacific drift very good new guys on the

19
00:01:09,500 –> 00:01:14,330
block good stuff anyway so we’ll dig in here

20
00:01:14,330 –> 00:01:24,260
we really have to is take these screws out one at a time

21
00:01:24,260 –> 00:01:28,070
by the way, if you don’t know who ave is, he is a

22
00:01:28,070 –> 00:01:30,740
rather skookum

23
00:01:30,740 –> 00:01:33,079
canadian fellow who does a lot of this kind of stuff

24
00:01:33,079 –> 00:01:35,540
stuff for heavy industry kind of stuff

25
00:01:35,540 –> 00:01:39,799
always entertaining to watch or

26
00:01:39,799 –> 00:01:43,130
listen to do anyway check out his

27
00:01:43,130 –> 00:01:45,439
channel and comment on his videos

28
00:01:45,439 –> 00:01:48,110
tell him that the airbornesurfer sent you and

29
00:01:48,110 –> 00:01:54,229
we’ll see what happens i’ve had this shredder for some 20 years

30
00:01:54,229 –> 00:01:56,840
I could go buy another one at Walmart

31
00:01:56,840 –> 00:01:58,520
but where’s the fun in that

32
00:01:58,520 –> 00:02:01,670
besides I don’t want to go to walmart if i don’t

33
00:02:01,670 –> 00:02:11,120
have to seriously that place is like the seventh circle of hell on the

34
00:02:11,120 –> 00:02:12,569
weekend

35
00:02:12,569 –> 00:02:15,420
and and I’ve been walmart in

36
00:02:15,420 –> 00:02:19,230
the south and walmart in midwest I’ve been

37
00:02:19,230 –> 00:02:21,090
walmart here in Southern California I’ve

38
00:02:21,090 –> 00:02:25,019
been to walmart in canada and you know

39
00:02:25,019 –> 00:02:28,319
actually I’ve gotta say my best experience with

40
00:02:28,319 –> 00:02:30,689
walmart has been in Canada actually

41
00:02:30,689 –> 00:02:35,730
Bradford Ontario which is actually

42
00:02:35,730 –> 00:02:38,010
where I got the shirt interestingly enough

43
00:02:38,010 –> 00:02:42,510
Bradford Ontario by far had

44
00:02:42,510 –> 00:02:44,909
the best walmart experience i’ve ever had so

45
00:02:44,909 –> 00:02:45,930
shoutout to

46
00:02:45,930 –> 00:02:49,379
bradford that now again it was like in

47
00:02:49,379 –> 00:02:52,199
the middle of the morning that i was

48
00:02:52,199 –> 00:03:00,480
there so yeah I guess that might’ve had something

49
00:03:00,480 –> 00:03:09,160
to do with it. there was nobody in the store

50
00:03:09,160 –> 00:03:16,390
but nevertheless i

51
00:03:16,390 –> 00:03:19,510
walked about the store, i was there on business

52
00:03:19,510 –> 00:03:22,510
and saw what they had to offer and noticed it was

53
00:03:22,510 –> 00:03:25,510
nearly canada day and they had all their

54
00:03:25,510 –> 00:03:28,630
patriotic stuff out so i got myself a little t

55
00:03:28,630 –> 00:03:39,180
shirt i think i’ve got all the screws out now so two screws came out

56
00:03:39,180 –> 00:03:43,379
the problem with wearing the maple leaf in

57
00:03:43,379 –> 00:03:45,090
southern California is that they think it’s a

58
00:03:45,090 –> 00:03:53,450
different kind of leaf let’s try this again

59
00:03:53,450 –> 00:04:05,200
well, it’s coming apart anyway there it goes!

60
00:04:05,200 –> 00:04:18,910
all right, so we’ve got her opened up here there’s some wiring guts

61
00:04:18,910 –> 00:04:29,630
got some shmoo there–shmoo, that’s a technical term i picked up in canada

62
00:04:33,360 –> 00:04:35,440
ok

63
00:04:35,440 –> 00:04:39,340
see here where the paper jam is apparently i

64
00:04:39,340 –> 00:04:50,740
busted the works

65
00:04:50,740 –> 00:04:54,790
let’s see what we’ve got

66
00:04:54,790 –> 00:04:59,620
obviously our switch

67
00:04:59,620 –> 00:05:07,630
that tells the machine to turn on when the paper is inserted

68
00:05:07,630 –> 00:05:13,090
big ol’ 115 volt motor here

69
00:05:13,090 –> 00:05:18,180
provides all your traction

70
00:05:35,129 –> 00:05:40,190
that pops out there, just leave it over there

71
00:05:40,190 –> 00:05:46,820
okay we got our shredder guts

72
00:05:46,820 –> 00:05:57,340
definitely need some tweezers

73
00:05:57,340 –> 00:06:07,020
aha! i’ve got some needle nose pliers

74
00:06:07,020 –> 00:06:09,040

75
00:06:09,040 –> 00:06:10,529
don’t put your finger in the pinchy part

76
00:06:10,529 –> 00:06:12,779
so what happened here was you know i

77
00:06:12,779 –> 00:06:17,099
had a handful papers that i was shredding and

78
00:06:17,099 –> 00:06:19,439
i happened to stick them in their kind

79
00:06:19,439 –> 00:06:21,139
of kind of

80
00:06:21,139 –> 00:06:34,480
sideways i gotta get around this blade here that’s the problem they kinda rolled up over this blade

81
00:06:34,480 –> 00:06:43,409
kids don’t try this at home

82
00:06:43,409 –> 00:07:01,139
contact

83
00:07:01,139 –> 00:07:27,550
there is a shutoff in here somewhere

84
00:07:27,550 –> 00:07:47,129
so you have to raise that up

85
00:07:47,129 –> 00:07:59,520
there it goes! that took it right out!

86
00:07:59,520 –> 00:08:03,249
there’s the culprit right there

87
00:08:03,249 –> 00:08:11,569
a little hunk of paper jamalamma in there

88
00:08:11,569 –> 00:08:21,740
the rest looks like it is okay

89
00:08:21,740 –> 00:08:46,279
just do a test fit right quick

90
00:08:46,279 –> 00:08:50,750
looks like everything’s working now

91
00:08:50,750 –> 00:09:02,680
and it looks like we are all set here now we just gotta get this all back in there

92
00:09:02,680 –> 00:09:15,160
power off

93
00:09:15,160 –> 00:09:39,769
now we just put our screws back in place we’re all set [whistling o canada]

94
00:09:39,769 –> 00:09:42,319
you watch enough hockey games you learn

95
00:09:42,319 –> 00:09:54,540
the tune to o canada and eventually you learn the lyrics

96
00:09:54,540 –> 00:10:08,819
she’s all done

97
00:10:08,819 –> 00:10:17,600
that’s it i’m going to drink my beer and i’m going to shred some papers

Also on:

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 https://01.org/linuxgraphics/ 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.

Also on:

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!

Also on:

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:"noreply@youtube.com" subject:"uploaded a video"');

while commenting out the one that reads

emailQueries.push('from:"noreply@youtube.com" 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

threads[i].moveToArchive();

to

threads[i].moveToTrash();.

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.

Also on:

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.

Also on:

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 AirborneSurfer.com 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.

Also on:

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!

Also on:

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

Also on:

How to Automatically Login to Linux

For Project Spoofy, I’m using fbi to pull photos from ownCloud and display them automatically on screen with no further input. In order to do this properly, the system must automatically login to Linux without a password. What’s more, I need the system to login as root so that fbi will have access to the proper folders to display images. Since we’re working on a Raspberry Pi, note that these instructions are specific to Debian and it’s derivatives.

How to automatically login to Linux

To do this, we simply need to edit the getty@.service file

sudo nano /lib/systemd/system/getty@.service

Then change the file that reads ExecStart=-/sbin/agetty --noclear %I $TERM to ExecStart=-/sbin/agetty --noclear -a USERNAME %I $TERM

Adding the -a option will enable autologin for the USERNAME that follows, so -a root will automatically login to the root account.

Also on: