Text

12.04 - Ubuntu/Linux Audio Skipping/Stuttering

I recently built a new machine for work and was having a lot of issues with audio (on linux, what a shock ;)). I’d read up on some different fixes and none of them seemed to fix the issues I was having with my system.  After about a week of woes and a lack of music I decided to open up the box and swap the audio cable from HD to AC97 just to see if it might fix the issue.  Low and behold audio plays fine without issue using the older standard.  I don’t reap the benefits of HD audio, but not being an audiophile and working with middle of the road headphones I can’t tell a difference anyways.

So just a heads up, if software can’t fix your skipping audio, maybe give your hardware a try.

Text

Linux simple h264 batch conversion

You’ll need HandBrakeCLI (http://handbrake.fr/downloads2.php) and a terminal.  To convert a video (the easiest way possible, thanks to HandBrake mind you, ffmpeg was giving me a lot of issues) is really simple, but depending on your machine, the quality, the size, etc. it can take a good bit of resources and a good bit of time to complete one of these encodings.  If you’re not keen to sitting around watching progress counters and ETAs there will surely be down time between encoding tasks as you’ll have to manually keep an eye on them.  Using some common *nix tools we can make this automated and easy to use.

Basic HandBrakeCLI encoding:

HandBrakeCLI -Z Universal -i infile.avi -o outfile.mp4

The above will take a standard avi format video and convert it to an h264 format video, simple.

Batch Conversion:

ls *.avi | awk '{print "HandBrakeCLI -Z Universal -i \x22"$0"\x22 -o \x22"$0".mp4\x22"}' | sh

The above will (assuming you’re in a directory with several .avi files) will go over each file, build the appropriate conversion command for HandBrakeCLI and then pipe that into sh to execute the command.  I’ve been doing mass conversions for web streaming purposes using this technique, so far I’ve converted over 600 individual videos and still going strong.

Photo
“If you can get Nyan Cat into the servers MOTD you’re more than welcome to do so…”
CHALLENGE ACCEPTED

“If you can get Nyan Cat into the servers MOTD you’re more than welcome to do so…”

CHALLENGE ACCEPTED

Text

Booting OS X with Grub2

I installed Ubuntu on a Mac Mini at work and needed to get back into OS X for some testing.  The default configured Grub entries wouldn’t load for OS X (hd0, part0).  After looking over the net and digging through lines and lines of Grub conf I found a little blurb from another user saying they’d tried this and it worked… so if you’re beating yourself up over OS X and Grub2 give this a try and see if it works… it did for me.

open up your Grub2 conf file, which in Ubuntu is located at

/boot/grub/grub.cfg

Then at the bottom of the menu entries I added:

menuentry "Mac OS X (Custom/Bootable)" --class osx --class darwin --class os {
        set root=(hd0,0)
        exit
}

This entry gets me booted into rEFIt at which point I can properly boot into OS X Lion without issues.  From this point forward the machine will default into rEFIt until you choose to boot into Linux again… which will push you back into Grub2 for future boots.

“If it’s stupid but it works, it isn’t stupid.”

Note: I’d already installed and had rEFIt running from the previous Ubuntu install

Text

Bash’isms (SVN+Awk+Grep+Cut+Bash one liners)

A couple bash 1 liners I threw together recently that I’ve found to come in very handy so I thought I’d share.

The back story is simple, yearly reviews, talk about what you’ve done, yadda yadda yadda.  Well, I don’t remember honestly. I’ve done A LOT.  That’s not going to fly in a serious meeting with “The Bobs”.  So I needed a way to look over my years work, as a refresher of little and big projects alike.  No problem SVN to the rescue… but our SVN has a lot of developers, and several commits per day of new features, bug fixes, tweaks, etc. After consulting the SVN docs I was pretty shocked to find no way to pull logs based on the user submitting said changes… one would expect something along the lines of:

svn log -uchad

And one would be wrong in assuming such a feature exists.  Some Google time turned up convoluted and down right ugly solutions.  I decided to have a go at it with my bash-fu… for practice and profit.  Below is an easy way using a couple common *nix tools to get the info you want fast and easy. In the following examples data you’ll need to replace will be wrapped in %’s with example data in []’s (e.g. %username[chad]%)

Get all svn commits for a given username:

svn log | grep '| %username[chad]%' | cut -d' ' -f1 | awk '{print "svn log -"$1}' | bash 

Get all svn commits for a given username in a year/month/day:

svn log | grep %date[YYYY-MM-DD]% | grep '| %username[chad]%' | cut -d' ' -f1 | awk '{print "svn log -"$1}' | bash 

Get all modified files for a users commited for a day/week/etc.:

svn log | grep %date[YYYY-MM-DD]% | grep '| %username%' | cut -d' ' -f1 | awk '{print "svn log -v -"$1}' | bash | grep %files['/trunk']%
Text

GrooveShark App (kind of) [Linux, Chrome]

I love GrooveShark, I love them so much that I looked for a stand alone app without much luck.  I usually just ran it in a background Chrome instance but I just wanted to be able to click a button and have all my Groovy goodness without tabs, or address bars, etc.

It took about 10 minutes, but here it is, super simple.

Step 1: Install Google Chrome 

(http://www.google.com/chrome/)

Step 2: Setup launcher with the -app flag

    /path/to/google-chrome -app=http://grooveshark.com
    example:
    /opt/google/chrome/google-chrome -app=http://grooveshark.com

This flag will cause Chrome to launch without common browser elements like the address bar, buttons, bars, etc.

Optional Steps: (for great justice)

Pick an icon for your launcher

Text

Nexus S + MIUI + Netflix = Working

You’ll need root, and you’ll need a 2.3+ ROM installed.

In

/system/build.prop

You’ll have to edit the lines.

ro.product.model=[model_name_here]

ro.product.manufacturer=unknow

To 

ro.product.model=Nexus S

ro.product.manufacturer=samsung

Reboot the phone and install the Netflix app from the market or install the .apk manually from your sdcard.

For navigating to / and editing build.prop I suggest using ES File Explorer as it supports root, navigating to /system/ and writing to the file all in a single app.

Note: For safety sake you might want to copy an unedited version of build.prop to your sdcard (/mnt/sdcard/) for safe keeping should you need to revert back to the old file easily.

Protip: If you’re running a rooted device with a 2.3 ROM using these flags on your phone will make the Netflix app usable.

Text

Ubuntu / Debian : List software from repository

This will list packages coming from a specific repository

grep <repository_name> /var/lib/apt/lists/* | grep tar | cut -d' ' -f4 | sort -u

Example

$ grep backbox /var/lib/apt/lists/* | grep tar | cut -d' ' -f4 | sort -u
aircrack-ng_1.1-1backbox1.debian.tar.gz
autotools-dev_20100122.1backbox1.tar.gz
backbox-about_1.2.tar.gz
backbox-artwork_1.6.tar.gz
...
Text

Redirect user, hide referrer

Found a nice little way to trick browsers into redirecting users without passing a long associated referrer information.  Works in Chrome, IE6/7/8, and Firefox… sneaky sneaky sneaky.

For more info drop me a message in the comments.

Text

VTech Pre-Computer Power Pad … I love thee.

VTech

My little cousins pulled out my VTech PreComputer Power Pad (the laptop looking version) while I was home this holiday at my Grandmothers house. I hadn’t seen the thing in years and was so happy to see it still around. I waited for them to get tired of it and sat down at the kitchen table to give it a go. It had been years and I recall one application but I couldn’t remember the name. It was the only one that would let you type and type and type, almost like a word processor, but you couldn’t save anything.

I always loved computers as a kid and when I was given this vtech I was a little disappointed. It was 1994, going on 1995 (christmas gift) and Windows 95 was coming out. My friends were playing solitaire, my uncle had a Mac PowerPC with full paint application and screen savers… and I was given a VTech. It played crossword puzzles, and math games, some basic trivia. Basically my 11 year old self saw it as a toy, capable of nothing more than making me a better student, but never teaching me about computers like I wanted to learn about them. I would go and hang out at office depot and circuit city just so I could play with the real laptops of the time with their spring loaded roller ball mouses, and tiny screens.

I recall hating mine, it was pointless… useless! I would still play on it, pretending to be a troubled lawyer, or possibly some form of hacker. I recall one day opening that “one word processor application” and typing gibberish in while pretending to be stealing top secret government files. When I pressed enter on the keyboard the screen lit up… it was lines and lines and lines of gibberish back, x’s, 0’s, #’s, and I was sure I had broken the thing, pulling the plug and restarting it fixed it right up, and I could never figure out what I had typed.

So now, 2011 is here, it’s been nearly 14 years since I was given my first VTech from my grandma and I sit down at her kitchen table to play with my old “toy” laptop that was “useless” for all those years. Something is different this time, I’m telling my little cousins that there is an application on here and you can just type whatever you want… it was the one I used the most as a kid. Then I realize it and a huge smile comes across my face. I look down at the buttons (applications) that you can press and I see one, almost in disbelief, it reads “BASIC”.

At this point I’m in disbelief, I press the button and sure enough the screen reads “BASIC HAVE FUN!”. This was IT, this was that application… and what’s even cooler, is now I’ve been working full time as a programmer since I was 20… and now I know what BASIC is! I immediately realize that this “useless” toy is far more powerful than I had ever realized as a kid! I sat there at that little laptop on a tiny screen only capable of displaying a handful of characters at time taking requests from my cousins and writing them little applications, there was a birth date calculator, a weight on mars calculator, a square footage calculator, I made special messages appear when they entered correct words when we played 21 questions.

That little VTech sparked my inner child again, and I’m still floored that I was given (and wasted) such a valuable tool as a child, I hope that I sparked the same interest in my cousins that day and they’ll spend as many hours playing with that little VTech as I did… but hopefully they’ll be able to grok BASIC and get a real head start on the “other kids” with their fancy WIndows 7 and OS X.

And that’s how I learned that I achieved my first buffer overflow at the age of 11… on accident.

Text

Chrome Extension : Screenshots made sexy

 After browsing the Google Chrome extensions catalog I found this little gem.  If you’re in the business of taking screenshots of web pages (developer, designer, sharing funny stuff online, etc.) I highly recommend giving the “Awesome Screenshot” extension an install!.

download it here (https://chrome.google.com/extensions/detail/alelhddbbhepgpmgidjdcjakblofbmce)

Text

Virtualbox & Windows 7 : Shared Folders

I’ve just recently installed Virtualbox on my Ubuntu machine and decided to set up a Windows 7 VM.  Once everything was complete it was time to enable shared folders so I could transfer some files to and from the VM.  Only 1 problem… I can’t find them?!

After a bit of looking around on the web I finally found a random user comment on a random blog that hinted at where they “might” be so I decided to put this article up for any future VB + Win7 users that are just as confused as I was.  Some people were suggesting installing FTP servers to the Windows install and even using Web services like Dropbox to move the files from the host machine to the VM. :/

First things first… create your folder on your system.

mkdir ~/VMShare

Add said folder to your VB shared folders list.

Once that is done you’ll open up your Win7 Network view.

Start > Computer > Network (in the left window pane)

And clicking on VBOXSVR will list your shared folders.

Now you’re sharing files easily.

Note: You’ll need to have the Virtualbox Guest Additions package installed in the VM for this to work properly.

Text

Ubuntu 10.04 Netbook Remix : Disable UNR Launcher

I installed UNR in version 9.10 and immediately disabled the netbook launcher for the classic desktop.  This was easy in 9.10 thanks to a setting in the system preferences called “Desktop Mode Switcher”.  It was great, it was easy… and now it’s gone.

For whatever reason in 10.04 they decided to get rid of this handy little tool.  I had to purge some nautilus config files and all of a sudden, I was back to UNR launcher.  I couldn’t find my trusty switcher so I started looking around the web… people are going through 5-12 steps to get around this thing, many without full success.  I’m writing this in the hopes that _YOU_ the person reading this finds it before you go through 12 steps of tweaking config files. 

Step 1: Remove the netbook-launcher

sudo aptitude remove netbook-launcher

Step 2: Install regular ubuntu-desktop

sudo aptitude install ubuntu-desktop

Step 3: Restart Gnome

sudo service gdm restart

Step 4: Login using Gnome as your session

Done and done… hope this saves someone from a headache.

Text

Quickly search your bash history using arrow keys

Add these lines to your /etc/inputrc to enable the functionality.

"\e[A": history-search-backward
"\e[B": history-search-forward

Thanks Reddit and Archwiki!
(http://wiki.archlinux.org/index.php/Bash)

p.s. this functionality is included in your inputrc file by default on Ubuntu 10.4 and can be used by uncommenting the lines (41 & 42), but rather than arrows it uses Page Up and Page Down.

Text

9.10 + Google Chrome + Netbook = YES!

If you haven’t tried Google Chrome on *nix yet I highly recommend it.