Sunday, August 17, 2014

New Ubuntu Install Essentials

This is a live document I am keeping for myself of everything I need to do when I setup a new machine with Ubuntu. It is not intended to necessarily be useful for anyone else.

PPAs

ppa:libreoffice/ppa
ppa:git-core/ppa
ppa:jtaylor/keepass
ppa:byobu/ppa
ppa:dlech/keepass2-plugins



sudo add-apt-repository ppa:libreoffice/ppa

sudo add-apt-repository ppa:git-core/ppa
sudo add-apt-repository ppa:jtaylor/keepass
sudo add-apt-repository ppa:byobu/ppa
sudo add-apt-repository ppa:dlech/keepass2-pluginssudo add-apt-repository ppa:openjdk-r/ppa

Programs To Install

zsh
oh-my-zsh
byobu
Google Chrome
keepass2
git
gitgssh
unity-webapps-gmail
unity-webapps-googlecalendar
unity-webapps-googleplus
unity-webapps-pandora
unity-webapps-youtube
Owncloud
keepass2-plugin-application-indicator
keepass2-plugin-application-menu
keepass2-plugin-keepasshttp
gnucash
openjdk-8-jre
wine

sudo apt-get install zsh byobu keepass2 git gitk gitg ssh unity-webapps-gmail unity-webapps-googlecalendar unity-webapps-googleplus unity-webapps-pandora unity-webapps-youtube keepass2-plugin-application-indicator keepass2-plugin-application-menu keepass2-plugin-keepasshttp gnucash openjdk-8-jre wine
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud-client.list"
wget http://download.opensuse.org/repositories/isv:ownCloud:desktop/xUbuntu_14.04/Release.key

sudo apt-key add - < Release.key
rm Release.key
sudo apt-get update
sudo apt-get install owncloud-client
ssh-keygen -t rsa -C "maxolasersquad@gmail.com"
# This then needs to be added to https://github.com/settings/ssh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
cd ~/.oh-my-zsh/
git remote add maxolasersquad git@github.com:maxolasersquad/oh-my-zsh.git
git pull maxolasersquad master
git push maxolasersquad master
byobu-enable

Firefox Plugins

https://addons.mozilla.org/en-us/firefox/addon/uacontrol/
This needs to be configured as follows.
Site: www.netflix.com
Custom: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/31.0

Weather Indicator

sudo add-apt-repository ppa:pywapi-devel/ppa
sudo add-apt-repository ppa:weather-indicator-team/ppa

Next, these entries need to be changed from 'trusty' to 'saucy'.

sudo apt-get update
sudo apt-get install indicator-weather

Tuesday, August 12, 2014

Facebook Messenger Controversy Explained

I have seen a number of people on Facebook reposting a "news" articles explaining the privacy violations of Facebook's Messenger application. A number of people have declared that they have uninstalled Facebook from their phone completely. Even the reviews featured on the application's page on the Google Play Store are all complaining about the privacy invasion.


The article, which I am not linking to here (you can Google it), set off a lot of red flags. I have never written an application for Android, though I have followed their developer's tutorials a few times. I'm not an expert on Android development, but I have a rough understanding of the basics.

When writing applications for a desktop computer (PC, Mac, etc.) applications have a lot of access to the computer hardware. Mobile devices are much more restrictive. Android locks out key functionality of the hardware from the applications that are installed. Before an application can have access to these parts of the system the application must first "request" permission. This is done by declaring in a file what permissions you need for your application. This includes permission to make and receive calls, access to the contact list, use the microphone, GPS, etc. This allows users to review and approve an application's access before installing it.

However, if an application needs any access to one of these resources it can either always have access to that resource or never have access. This can make some applications look more scary than they are. For example, an application that shows you the weather based on the city you are in will need access to your GPS and the Internet. Granting these permission could allow this application to surreptitiously spy on you without your knowledge and report that back to some database, but it does not necessarily follow that it is actually spying on you.

This is how the Messenger scare is working. For example, there is a feature that allows you to record an audio clip and then send it to a friend to listen to whenever they have the chance. To provide this functionality the application has to require access to the microphone. With this access the application could be listening in on you. However, the mere fact of the application having this permission is very, very different than proof  that it is spying on you. In fact, it is not evidence at all. Fortunately it actually is possible to know if the application is using this permission for these purposes, but I'll get to that later.

There is a great deal of irony in seeing people complain on Facebook about the privacy implications of their messenger application. It is hard to imagine how the privacy concerns of Facebook itself can be acceptable, but the possible implications of the Messenger applications are not. There are much better ways to protect your privacy than uninstalling a single application.

One way I protect myself is by running an aftermarket version of Android called Cyanogenmod. It is based on the Android Open Source Project and is fully open source. The version of Android that carriers ship contain a lot of proprietary code that they have written to customize the experience. In the past some carriers have been shown to spy on their users in ways that where very embarrassing to the companies, and they where forced to remove it. However, there is no guarantee that many devices are not reporting on their users in ways that users would not agree with. In a post Snowden-world this is more than paranoia, but actually very likely.

A nice feature of Cyanogenmod is that it provides much more fine-grained control over an applications privacy settings. Usually if you do not trust an application to have a permission it is requesting, your only recourse is to not install the application at all. Privacy guard allows the users to turn off any feature, or put it on "always ask." It also reports how often an application has used a permission and when it did it last. This allows us to peer into what an application is actually doing with the access it is requesting.

What follows is a very long list of all of Messenger's permissions and reports on its use.

Click to enlarge
So let's talk a little about what is going on here. As you can see, Messenger has to ask me before it can know my location. The only time it ever actually does that is when I message somebody. and that's only because I checked the "New messages include your location by default" box in Settings. It has never attempted to read my call log, calendar, SMS (text message) database or send or a text message, record audio, or make a phone call. In fact almost everything in here is looking pretty legit. Almost.

You may notice the "Read Contacts" section. I have it set to Deny. Why? Look at the subtext. "Allowed 1854 times, denied 429 times." I had set this to Ask for a little while. I noticed that whenever I made or received a phone call or text message that the Messenger app was trying to read my contacts. I can imagine some semi-legitimate reasons why it might be doing this. For example, it may be trying to gauge who are the friends I contact the most so that it can then prioritize their posts on Facebook.

However, this is too creepy. I do not want Facebook knowing this level of detail about my life. I do not want them knowing every time I send or receive a phone call or text message and who I was communicating with. I think that there is an actual new story behind this and would be worth someone's time to grill Facebook on and educate the public.

And that's the real point. There are legitimate privacy implications of these portable computing devices we are carrying around in our pocket. People need to be more informed on what those implications are and have the education necessary to make informed decisions on how to manage these privacy concerns. Yellow-journalism articles that spread half-truths, getting people riled up about nothing-much are more hurtful than they are good.

Friday, January 17, 2014

It May Be Time to Abandon Artificial Sweeteners

I have never been a fan of artificially sweetened food products. At first I just wanted things that are delicious, but as I get older I am thinking more and more about my health, and so these decisions are becoming more important. However, I feel that if I am going to put trash in my body, it should at least be delicious.

I find artificial sweeteners to be disgusting. I can pick them out too. When my wife buys something artificially sweetened, sometime on accident, I notice the flavor immediately. Many people claim that they cannot tell the difference in the taste, but I can definitely tell the difference. The worst part, for me, is the horrible aftertaste that artificial sweeteners leave on my tongue.

So when I want to be healthy I consume things that are both healthy and delicious. I can enjoy a glass of water, a plate of broccoli, or use a carrot as a snack with no problem. A lot of more recent research, though, is suggesting that choosing food products sweetened with real sugar may be more healthy than their low-calorie, artificially sweetened counterparts.

In Trends in Endocrinology & Metabolism, researcher Susan Swithers publishes "Artificial sweeteners produce the counterintuitive effect of inducing metabolic derangements" findings that show artificial sweeteners may be messing up our body's ability to properly process real sugar, which she discussed on NPR's Science Friday.

According to Swithers, when our brain detects sugar from smell or taste it tells your digestion system to get ready to start processing the sugar very soon. As most of us know, our bodies ability to properly process sugar is vital to our health. When it cannot process sugar right it can lead to diabetes. When we train our bodies that the sensation of sweet does not equate to the consumption of sugar, our bodies gets tired of your nose and tongue crying wolf and stops directing our digestion system appropriately. When we really do consume sugar our bodies stop processing sugar like it should and, according to Swithers, could be leading to an increased risk of diabetes.

There is also evidence found by researchers at John Hopkins University that those who consume foods using artificial sweeteners may also be making up for the lost calories by consuming them in higher quantities in other foods. There are many reasons why this may be true, but the overall result may not be quite what dieters are looking for.

At the end of the day, if we want to be healthy we need to stop consuming unhealthy foods and switch to more healthy foods. Tea and coffee can be healthy zero-calorie drinks in moderation, for those who simply find moving to drinking more water to be too hard.

Thursday, October 3, 2013

Install KeePassHTTP on Ubuntu

First, of course, we need keepass, and we'll grab git while we are at it. Git is optional here, it just allows for easier updating.
sudo apt-get install keepass2 git-core
Where to put KeePass plugins is non-obvious, but fortunately some Googling reveals it to be at /usr/lib/keepass/plugins. Lets go there and create a directory for KeePassHTTP.
cd /usr/lib/keepass2/
sudo mkdir plugins
cd plugins
Great, now we just need to download the plugin. As I alluded to at the beginning we can grab the plugin via git for easier updating. The project is maintained at https://github.com/pfn/keepasshttp, but we can just grab the one plugin file we need. In fact, if we checkout the entire repository then KeePass will throw some errors as the plugin is there twice in two different formats and it can only load the plugin one time.
sudo git clone -n https://github.com/pfn/keepasshttp.git --depth 1
cd keepasshttp
sudo git checkout HEAD KeePassHttp.plgx
Now you can update the plugin at any time by running the following from the /usr/lib/keepass/plugins/keepasshttp directory.
git pull
If you are only interested in downloading the file once and not worrying about updates you can simply download the extension file.
wget https://raw.github.com/pfn/keepasshttp/master/KeePassHttp.plgx
Now you can restart KeePass2 and the plugin will be loaded.

Congress Shall Make No Law

It seems that a lot of people are very confused about the Bill of Rights and what it legally affords the citizens of the United States. I'm not referring to confusions what the right to bear arms mean, or what speech is free speech. I am referring to who the Bill of Rights is designed to protect citizens from. This misunderstanding became prominent in both the Chick-Fil-A brouhaha over marriage equality, and Starbucks and their policies about guns in their stores.

So in these debates people are referencing the constitution to make it known what their rights are, accusing those who disagree with them of denying them their rights. This would be laughably wrong if the accusations where not so widespread, large in numbers, and coming from every side of the issue.

Here is what the Constitution says about your rights in these situations. If I own a business, and it is truly MY business, I can use the money made from that business and spend it on any political, social, or ethical type of causes within the limits of the laws that govern such things.

So I have the right to do that with my business. But it is a two-way street, consumers can choose to not shop at my store for any reason they want. It could be the color or fashion of my tie. It could be my race, gender, ethnicity, socio-economic upbringing. Oh yeah, it can also be for my politics or the way I use the profits generated from my business. And in response I can do nothing, pretend to do something, or actually change my practices. That is my right. But the constitution does not restrict how I can run my business, and it does not say that anyone has to ever purchase my products, ever. This is how things work in a free society. In fact, this is how capitalism is supposed to work. People boycotting CFA over the gay rights issue is capitalism in action. CFA can change their behavior in response to the boycotts, do nothing, or choose any other option they want.

So this takes us to Starbucks where the coin is flipped over a little bit. Gun rights activists took Starbucks establishments by storm in states that have open-carry laws, buying coffee at Starbucks while carrying a weapon on their person. Shortly after Starbucks changed their policy to "ask" customers carrying a weapon in an open-carry state to leave their weapon in their car. Customers where still allowed to actually carry a weapon on them, the new policy just stated that they would be asked not to. This got gun-rights activists upset so they started boycotting Starbucks. To be clear there where some very uncivil responses leaving some Starbucks cafes with smashed windows. However, the boycott alone is just capitalism at work in a free society. It is the right of Starbucks to have whatever policy they want regarding weapons in their store, and it is the right of open-carry supporter to note buy a Starbucks. Neither the policy nor the boycott are a violation of anyone's rights.

I ran into this same issue again when someone on Facebook posted "Will someone just take one for the team already and shoot Obama???" I decided to take this person to task on their remark and received the response "Freedom of speech. If you don't like it delete me" Putting aside the issue of whether or not saying someone should be murdered really is freedom of speech, there is a more important issue here. If I disagree with something you say, that is not a violation of your freedom of speech. It is in fact a dialogue. It seems that many believe anything outside of an echo chamber is a violation of their freedom of speech.

We need to stop muddying the waters of freedom. You don't get to do and say anything you like and expect nobody to respond with dissent. Dissent is how we get stuff done. It is how we grow us both individuals and collectively as a society. We disagree, we make our disagreements known, we work them out with those that we are disagreeing with. We move on and grow. People need to get over themselves and their opinions and realize if you have something you care about there is someone out there who is going to disagree with them. Get over it. If you can't think of a better argument than hiding behind rights you don't have then it may be a good time to reexamine your values.

The freedoms granted to us in the constitution, freedom of speech and religion, "the right of the people to keep and bear Arms", etc. are there to keep congress from passing laws infringing on those rights. They are not there to keep other citizens from disagreeing with you, and taking actions against your point of view.


Sunday, September 29, 2013

Compiling Snes9x on Ubuntu

After looking into the various SNES emulators available for Linux it looks like Snes9x is the only one that is of high quality and currently maintained. ZSNES seems to work pretty well, but it won't compile on 64-bit, giving you a very old emulator running as a 32-bit binary for the foreseeable future.

I used these instructions on a 64-bit Ubuntu 12.04 machine and a 32-bit Ubuntu 13.10 machine. There are two sets of instructions here. One is for compiling the Unix version of Snes9x and the other is for install the GTK3 version. Theses instructions worked perfectly on 12.04 but on 13.10 the GTK3 version segfaults. I don't know if the issue is with 13.10 or perhaps an incompatibility with my laptop's hardware and Snes9x GTK.

The currently maintained codebase of Snes9x is hosted up on github so we will need to install git. We'll get all the tools required to build the source code while we are at it.
sudo apt-get install git build-essential
Now we can check out the codebase.
git clone https://github.com/snes9xgit/snes9x.git
cd snes9x

Part 1 - Building the Unix version of Snes9x
The Unix version does not contain any sort of interface save for the running game itself. It supports a number of command-line switches. Unfortunately it does not seem to provide any way of running in fullscreen mode.

First we need the dependent libraries.
sudo apt-get install zlib1g-dev libpng12-dev xorg-dev
Now we can compile.
cd unix
autoconf
./configure --enable-netplay
make
sudo cp snes9x /usr/bin/
sudo chown root:root /usr/bin/snes9x
Now we have an executable binary named snes9x. You can go ahead and execute it passing in a SNES rom as the first argument or with no arguments for a list of acceptable options.

To create an entry in our desktop menu create the following file and save it as /usr/share/applications/snes9x.desktop
[Desktop Entry]
Version=1.0
Name=Snes9x
Comment=A portable, freeware Super Nintendo Entertainment System (SNES) emulator.
GenericName=Snes9x
Keywords=Games
Exec=snes9x
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/share/pixmaps/snes9x.png
Categories=Game
StartupWMClass=Snes9x
StartupNotify=true
Finally, find an icon you want to use and save it as /usr/share/pixmaps/snes9x.png You can get a good icon to use here.
sudo wget http://maxolasersquad.com/snes9x.png -O /usr/share/pixmaps/snes9x.png

Part 2 - Building the GTK3 version of Snes9x
The GTK3 version includes a nice GTK interface with all sorts of configurable options, including fullscreen.

First we need to get the dependent libraries.
sudo apt-get install intltool autoconf automake libglib2.0-dev gawk libgtk-3-dev libxml2-dev libxv-dev libsdl1.2-dev libpulse-dev libportaudio-dev 
As of Ubuntu 15.10, instead of libportaudio-dev you need to install portaudio19-dev.
If you want a GTK2 build then install libgtk2.0-dev and you can leave out libgtk-3-dev.
Now we can generate the install scripts and compile.
cd gtk
./autogen.sh
./configure --with-gtk3
make

sudo cp snes9x-gtk /usr/bin/
sudo chown root:root /usr/bin/snes9x-gtk
You can leave out --with-gtk3 if you want a gtk2 build instead.

Now we have an executable binary named snes9x-gtk.

To create an entry in our desktop menu create the following file and save it as /usr/share/applications/snes9x.desktop
[Desktop Entry]
Version=1.0
Name=Snes9x GTK
Comment=A portable, freeware Super Nintendo Entertainment System (SNES) emulator.
GenericName=Snes9x GTK
Keywords=Games
Exec=snes9x-gtk
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/share/pixmaps/snes9x.png
Categories=Game
StartupWMClass=Snes9x
StartupNotify=true
Finally, find an icon you want to use and save it as /usr/share/pixmaps/snes9x.png You can get a good icon to use here.
sudo wget http://maxolasersquad.com/snes9x.png -O /usr/share/pixmaps/snes9x.png

Thursday, September 5, 2013

How to flush your swap on Unix machines

After your computer has been running for some time you may find that some memory is stuck living in swap while your RAM has space readily available. The data in your swap will be accessed much slower than if it was living in proper RAM space and it may be to your advantage to force it to RAM. I use the following to clean out the swap on my Ubuntu 12.04 workstation.
sudo swapoff -a && sudo swapon -a
Of course, if you are running as root you can omit sudo from the above command.

Plenty of room to move the swap in to.


Swap has been flushed to RAM.

Sunday, August 18, 2013

Using Rom Collection Browser to play NES games on XBMC 12 with Ubuntu

XBMC is by far my favorite IPTV software. I run it in my living room and use it to play my music collection and easily watch my entire DVD collection without ever needing to pop in CDs or DVDs. All my media is stored in a hard drive on my home server.

I had toyed around with using the Rom Collection Browser plugin to play Nintendo games, but getting it working right is not a trivial task. After a lot of messing around I finally have it working right. These instructions are using XBMC 12 on Ubuntu 13.10 and fceux for the emulator.

First things first. Never run with the version of XBMC packaged for Ubuntu. Team XBMC keeps an up to date version in their ppa at https://launchpad.net/~team-xbmc/+archive/ppa. You can set it up with the following commands.
sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install xbmc
Next we need fceux to act as our NES emulator. You could install fceux with the following command.
sudo apt-get install fceux
However, I wanted to have the latest version of fceux. Since a ppa does not seem to be available I figured out how to compile it from source. It is not very hard and I have full instructions here. Whether you choose to use the version from apt or compile it should not affect it working with the following instructions. If you do install it from apt and have issues let me know in the comment section and I will look in to it for you.

Now that our system is setup we need to fire up XBMC. Choose Programs from the strip and then "Get More..." select "Rom Collection Browser and install it.

The first time you launch it you will get a menu asking you to create a config file. Choose Yes. Next choose "Scrape game info and artwork online." For the platform select NES.

Now it needs to know where the emulator is located at. Select "Root filesystem". Next choose the usr directory, followed by the bin directory. In here scroll down until you find fceux. Select it and click OK.

Your emulator params should be as follows.
-f 1 -x 1440 -y 900 "%ROM%"
You will need to change the 1440 and 900 to match your screen resolution. It can be any resolution your monitor/TV supports. The best way to get it is to either go to the Displays section in the Ubuntu Settings screen, or in XBMC under SYSTEM→Settings→System→Video output→Resolution.

Finally it ask you to tell it where you save your game roms. Usually it will be somewhere in your home folder so select "Home Folder" and browse down from there. When asked for the file mask type use *.nes, unless you keep all of your roms in a zip file, in which case choose *.zip. Theoretically you could use *.zip, *.nes but I had problems getting this to work. YMMV. I choose to just keep all my roms uncompressed since they are so small anyways.

The next question asks you about where to store artwork. You can create a separate directory for the artwork if you like. I chose the same directory as the roms. It creates subdirectories to store the art anyways. How you want to handle this is up to you.

Lastly, answer No when asked if we want to add another rom collection.

With all of our parameters setup click the Import Games button leaving all the settings in tact. Depending on the size of your rom collection this could take a while as it looks up each rom and downloads the metadata for each rom.

There is one last setting we need to make for convenience. Go to the main XBMC page and navigate to System→Settings→Appearance→Skin→Settings→Add-on. Under Home Page Programs Submenu choose Add-on 1 and then select Rom Collection Browser. Now the rom list can be loaded from the home screen.

Now you should be ready to play your favorite Nintendo games straight in XBMC. There are a few gotchas you should be aware of.

The default fceux keys are as follows.
Start: Enter
Select: s
A: f
B: d
Reset: F11

The next one that bit me is that fceux doesn't seem to support batteries so game saves are lost after you exit. Instead use F5 to save your game and F7 to restore from the save.

The delete key shuts down the emulator and takes you back to XBMC.

It is a good idea to log into the regular Ubuntu desktop and play with the fceux settings directly in fceux. My personal favorite is to go under Options→Video Config and set the special scalar to hq3x. This plays with the 8-bit graphics to make them look less blocky. You can also configure a gamepad, set hotkey bindings, etc. The changes you make here will be reflected when it is ran from XBMC.

Compiling fceux on Ubuntu

The following instructions are what I used to install fceux 2.2.1 on Ubuntu 13.10.

First you need to download the source. You can get it from http://www.fceux.com/web/download.html. Download the FCEUX src.

The rest of the instructions will assume that you are at the command line in the directory where you downloaded the file. Replace the file name in the instructions with the name of the file, which will be different if you downloaded a version different from 2.2.1.
sudo apt-get install libsdl1.2-dev scons libgtk-3-dev liblua5.1-0-dev libgd-dev
tar xzvf fceux-2.2.1.src.tar.gz
cd fceux-2.2.1
At this point you will need to open the file named SConstruct
vi SConstruct
Change lines 27 and 28 to look like this.
  BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 0),
  BoolVariable('GTK3', 'Enable GTK3 GUI (SDL only)', 1),
This will give us a modern GTK3 interface instead of using the now outdated GTK2 toolkit. Feel free to change any of the other settings if you wish. I turned off the debug symbols. Now we are ready to compile our binary.
scons
This took about 10 - 15 minutes on my Dell 1420. Once it is done we can install it to the system.
sudo scons --prefix=/usr install
The last step is optional but provides a little more desktop integration. You can get a better fceux icon here.
sudo cp fceux.desktop /usr/share/applications
sudo cp fceux.png /usr/share/pixmaps
If you use Unity for your desktop you can change the contents of fceux.desktop in the /usr/share/applications directory to append the following to get some additional benefits when you right-click on the launcher icon.
Actions=Fullscreen;DefaultConfig;
[Desktop Action Fullscreen]
Name=Open in Fullscreen
Exec=fceux -f 1
OnlyShowIn=Unity
[Desktop Action DefaultConfig]
Name=Start With the Default Configuration
Exec=fceux --no-config 1
OnlyShowIn=Unity

Monday, July 1, 2013

Installing Minecraft 1.6 on Ubuntu

I had previously blogged about Installing Minecraft on Ubuntu. As of Minecraft version 1.6 these instructions no longer work because of a newly introduced launcher. The following is updates instructions for version of Minecraft 1.6 and above.

First we need to install Java. The website claims it needs Oracle Java, but the open source Java in the Ubuntu repos works just fine in my experience.
sudo apt-get install openjdk-7-jre
Now we need the launcher
sudo wget https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft
The file contents should be as follows.
#!/bin/bash
java -jar /usr/games/Minecraft.jar
And then set the proper permissions on the file
sudo chown root:games /usr/games/minecraft
sudo chmod 755 /usr/games/minecraft
Again, change vi with something else if that is easier for you.
sudo vi /usr/share/applications/minecraft.desktop
And put this in the file.
[Desktop Entry]
Name=Minecraft
Comment=Build your own world
Exec=minecraft
Icon=minecraft
Terminal=false
Type=Application
Categories=GNOME;Applications;Game
Keywords=minecraft;Game
StartupNotify=true
The last piece we need is an icon. There are many good Minecraft icons at http://www.rw-designer.com/icon-detail/5547 I like http://www.rw-designer.com/icon-image/5547-256x256x32.png as it gives us the highest resolution available. Replace the URL of the icon you prefer to use in the following command.
sudo wget http://www.rw-designer.com/icon-image/5547-256x256x32.png -O /usr/share/pixmaps/minecraft.png
Now you should be able to play Minecraft by simply typing minecraft in the command-line, in the Unity dash, the KDE prompt, or by browsing to the games menu in the applications menu in your desktop environment of choice. It is also available to all users of your desktop.

You also do not need to do anything to update. Minecraft updates itself each time you start it.

BONUS

I've got one more neat trick up my sleeve. If a CraftBuntu spin sounds good to you, here's how you can setup Ubuntu to just run Minecraft when you sign in. It assumes you have already done the above.
sudo cp /usr/share/applications/minecraft.desktop /usr/share/xsessions/
Now Minecraft is an available option when you select your desktop environment. This works best if you set Fullscreen in the Minecraft options.

You could do a number of things with this setup. You could setup a minimal Ubuntu installation that has no desktop environment, or other desktop-related software installed. You could also allow guests to play Minecraft without touching any of your stuff by them selecting the Ubuntu guest account and setting Minecraft for the login. I have even found that on my struggling laptop this setup allows Minecraft to run more smoothly as there is no other desktop cruft running in the background.


UPGRADING FROM 1.5

If you had already followed my instructions back in the days before 1.6, the following will get you updated to 1.6
sudo rm /usr/games/minecraft.jar
sudo wget 
https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft

The file contents should be as follows.

#!/bin/bash
java -jar /usr/games/Minecraft.jar