Software

Fastest way to install the media essentials in ubuntu

If you’re coming from Windows, or like me, find yourself living in a live CD while you figure out which step went wrong; you’ll be interested in the essential media codecs, flash, java, Microsoft fonts, etc.

I thought I’d share the way I did this as quickly as possible in in Ubuntu 10.04 using the command line.

Open up terminal, using ctrl+alt+t (Which I’m very happy about as this has been my default since 8.04). Alternativelty from the main menu -> Applications > Accessories > Terminal

Make a backup in case you’re scared, then remove the comments from repositories you need to unlock to access the restricted (proprietary) packages.

ubuntu@ubuntu:~$ sudo cp /etc/apt/sources.list .
ubuntu@ubuntu:~$ sudo sed -i 's/^# deb/deb/' /etc/apt/sources.list

We do this be matching the first 2 characters with ‘# ‘ and replacing them with ” (nothing). See the diff below (> indicate original lines, < are changed).

 
ubuntu@ubuntu:~$ diff sources.list /etc/apt/sources.list
18,23c18,23
< # deb http://archive.ubuntu.com/ubuntu lucid universe
< # deb-src http://archive.ubuntu.com/ubuntu lucid universe
< # deb http://archive.ubuntu.com/ubuntu lucid-updates universe
< # deb-src http://archive.ubuntu.com/ubuntu lucid-updates universe
< # deb http://security.ubuntu.com/ubuntu lucid-security universe
< # deb-src http://security.ubuntu.com/ubuntu lucid-security universe
---
> deb http://archive.ubuntu.com/ubuntu lucid universe
> deb-src http://archive.ubuntu.com/ubuntu lucid universe
> deb http://archive.ubuntu.com/ubuntu lucid-updates universe
> deb-src http://archive.ubuntu.com/ubuntu lucid-updates universe
> deb http://security.ubuntu.com/ubuntu lucid-security universe
> deb-src http://security.ubuntu.com/ubuntu lucid-security universe
30,35c30,35
< # deb http://archive.ubuntu.com/ubuntu lucid multiverse
< # deb-src http://archive.ubuntu.com/ubuntu lucid multiverse
< # deb http://archive.ubuntu.com/ubuntu lucid-updates multiverse
< # deb-src http://archive.ubuntu.com/ubuntu lucid-updates multiverse
< # deb http://security.ubuntu.com/ubuntu lucid-security multiverse
< # deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse
---
> deb http://archive.ubuntu.com/ubuntu lucid multiverse
> deb-src http://archive.ubuntu.com/ubuntu lucid multiverse
> deb http://archive.ubuntu.com/ubuntu lucid-updates multiverse
> deb-src http://archive.ubuntu.com/ubuntu lucid-updates multiverse
> deb http://security.ubuntu.com/ubuntu lucid-security multiverse
> deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse
>
 
 
<pre lang="bash">

Now that we uncommented these lines, they will be read next time we update, so lets go ahead and do that now. Once that is done, we can install the extras.

ubuntu@ubuntu:~$ sudo apt-get update
ubuntu@ubuntu:~$ sudo apt-get install ubuntu-restricted-extras

Rock and roll.

Packages for nautilus you wish were installed by default in ubuntu

Intro

Thanks to a tip I picked up at Tombuntu about nautilus, after following up on a trick to add files to mocp through nautilus scripts trackback link from Hilltop Yodler (great article), when doing a google search for GiS for nautilus-actions (apt-get install nautilus-actions). I learned about 3 kick ass additions to the nautilus menu. I realized Fedora Linux and Linux Mint had some of these in their context menus but didn’t make the connection to ubuntu until now.

On with the Show

sudo apt-get install nautilus-open-terminal nautilus-image-converter nautilus-gksu

for some kick ass options in the context (right click) menu of nautilus (your default file manager in ubuntu). For more information, check out the tombuntu article I linked above.

pkill nautilus

to restart nautilus and have the new packages in your context menu

More

If you’re interested in this, you’ll probably also like my article about nautilus-actions.

If nvidia-settings cannot save to xorg.conf, do this

If you’re using ubuntu and having trouble with nvidia-settings saving to the /etc/X11/xorg.conf file, you may find the following tip helpful in relieving that annoyance.
Looking for something interesting when I login to one of my servers, I decided to whip up the following script I appended to my ~/.bashrc file.

close nvidia-settings

in terminal:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
sudo gedit /etc/X11/xorg.conf

paste the following:

Section "Device"
    Identifier     "Configured Video Device"
    Driver         "nvidia"
EndSection

save and close.

back to terminal:

sudo nvidia-settings

and save the file.

Using Nautilus Scripting Abilities to Integrate Right Click File Enqueues with mocp

Using moc player can prove to be both beneficial and challenging. I’ve found myself going back to exaile for a few hours on random days for the simplicity in file management via a GUI. Since I prefer to use a single media player and mocp is light weight and helpful in so many other ways to me… I knew I needed a solution. It dawned on me just today how simple that solution could be with nautilus scripts.

#!/bin/bash
# Enqueue with mocp
# by Tyler "-z-" Mulligan
#
# This is a nautilus script.  When placed in ~/.gnome2/nautilus-scripts
# and chmod +x you will have the ability to right click >> enqueue files
# or directories in mocp.
#
 
mocp -a "$@"

Some other tips… [ and ] silently skip back and forward respectively at a rate of 5sec per second held… this beats the left and arrows which work interactively at 1sec per sec.

? and h bring up the help, don’t forget this. Use this, learn the commands that work for you and happy listening.

Thanks to MrBougo again for helping me simplify the script further… I was originally using a for loop which is unnecessary as the quotes will help the variable expansion and mocp -a can accept multiple files/folders.

Reducing pageweight by compressing production css and js files

I’ve been a little obsessed with improving the speed of web pages via minified javascript and css files. YUI’s team not only agrees with this, they recommend gzipping your minified js and css files. For a while I’ve been calling YUI Compressor inside my push to production scripts to do the deed. However, with this new mention of gzipping, I think might be exploring other options such as the method mentioned on the page which originally linked me to that awesome YUI writeup; minifying and gzipping javascript and css on the fly using php.

screenshot-about-shiretoko

Installing Firefox 3.5.2 (Shiretoko) on Ubuntu using the default repos and customizing the icon to be more recognizable

When Firefox 3.5 came out, I along with many others, was eager to try it. For a while I ran it out of the archive directly but this caused minor issues as it’s a messy solution. At some point I noticed firefox-3.5 in the repository:

tyler@quadjutsu:~$ apt-cache search firefox |grep 3.5
abrowser-3.1 - dummy upgrade package for firefox-3.1 -> firefox-3.5
abrowser-3.1-branding - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.1 - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.1-branding - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.1-dbg - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.1-dev - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.1-gnome-support - dummy upgrade package for firefox-3.1 -> firefox-3.5
firefox-3.5 - safe and easy web browser from Mozilla
firefox-3.5-branding - Package that ships the firefox branding
firefox-3.5-dbg - firefox-3.5 debug symbols
firefox-3.5-dev - Development files for Mozilla Firefox
firefox-3.5-gnome-support - Support for Gnome in Mozilla Firefox

and proceeded to install it with the following command:

tyler@quadjutsu:~$ sudo apt-get install firefox-3.5

It runs along-side Firefox 3.0 without a hitch. I often use the two in tandem while testing web applications.

Something that bothered me about this was the default icon isn’t as recongnizable to me as I’d like it to be.

screenshot-about-shiretoko

As such I looked into a way to replace it.

First, I found a replacement icon I liked

hp-firefox-128x128

from the following website (where other nice replacements exist).

Then I went to find the logical location of the files to replace. First I updated my ‘locate’ database file because this software is new, so it’s not yet known. This is done automatically daily on a cron but you can update it any time you’d like as follows:

tyler@quadjutsu:~$ sudo updatedb

Then I probed for icons I might think would be responsible.

tyler@quadjutsu:~$ locate firefox |grep lib |grep icon |grep 3.5
/usr/lib/firefox-3.5.2/icons
/usr/lib/firefox-3.5.2/chrome/icons
/usr/lib/firefox-3.5.2/chrome/icons/default
/usr/lib/firefox-3.5.2/chrome/icons/default/default16.png
/usr/lib/firefox-3.5.2/chrome/icons/default/default32.png
/usr/lib/firefox-3.5.2/chrome/icons/default/default48.png
/usr/lib/firefox-3.5.2/icons/document.png
/usr/lib/firefox-3.5.2/icons/mozicon128.png
/usr/lib/firefox-3.5.2/icons/mozicon16.xpm
/usr/lib/firefox-3.5.2/icons/mozicon50.xpm

The first set in the ‘/usr/lib/firefox-3.5.2/chrome/icons/’ folder will replace the icons used by the application itself (i.e. the icon in the top of your window). The latter, ‘/usr/lib/firefox-3.5.2/icons/’ will replace the ones used by shortcut icons.

Here are all the files for the icons I resized if you’d like to use them.

firefox-3.5_replacement_chrome_icons.zip
firefox-3.5_replacement_shortcut_icons.zip

bash pro-style:

cd Desktop/ && mkdir firefox_replacement_icons && cd firefox_replacement_icons
wget http://www.doknowevil.net/files/firefox-3.5_replacement_chrome_icons.zip && wget http://www.doknowevil.net/files/firefox-3.5_replacement_shortcut_icons.zip
for file in *.zip; do unzip $file; done
sudo cp chrome/* /usr/lib/firefox-3.5.2/chrome/icons/default/
sudo cp shorcuts/* /usr/lib/firefox-3.5.2/icons/