Category Archives: Ubuntu

Spotify tray icon in Ubuntu Ambiance after recent update

A recent update to Spotify for Linux (much needed, the program runs 90% flawlessly now!) broke the commonly used “fix” to the ugly tray icon that the default Spotify install comes with (see old tutorial examples here, here, and countless others). It totally ruined the look of my system, and I had to fix it.

spotify_bad

The old fix involved replacing the icon used by Spotify with a new one, created by (I actually don’t know who made it, I think maybe it was Michael Tunnell?) a user, so that on loading Spotify, it would call the user-made icon instead. Well, the process is still the same, but you need to replace a different image file. I’ve created my own, which I’m offering to the world, but I’ll say that I did it in about 4 minutes and I am no graphic designer (still, I think it looks pretty good).

Spotify stores the icons it uses in /opt/spotify/spotify-client/Data/resources.zip. You will need to replace the icon used for the tray icon with my new icon and then reload Spotify. So let’s go ahead.

1) download the spotify-linux-512.png file from my Github repo, here.
2) navigate to /opt/spotify/spotify-client/Data/resources.zip and open it with the Archive Manager. Note: you may have to do this as root in order to be able to modify the folder.
3) within the zip navigate to the _linux folder.
4) right click on the spotify-linux-512.png file and rename it to spotify-linux-512.png.bak.
5) select the “add” button, and navigate to the file you downloaded from my Github, named spotify-linux-512.png. Select it and press add. Now close the zip file. Note: I do not recommend replacing the other spotify-linux-xxx.png files unless this tutorial fails (see troubleshooting below)
6) relaunch Spotify and voila.

spotify_upd

I’ve also included in the Github folder the Inkscape .svg file I made the icon with, so that someone who is a better graphic designer can make it really match!

Troubleshooting:

1) possibly lower resolution systems may use the lower resolution files in the resources.zip folder. I have no way to test this, if the tutorial doesn’t work for you, try a lower resolution one, but make sure to back it up with the .bak extension first!
2) make sure you are root (sudo) for the process, or you may not have permission to rewrite the files Spotify uses.

 

Quick script for connecting to University VPN

I can be pretty lazy at times, so much that I will go out of my way a bit to write a bit of code to simplify my life. I don’t often connect to my university’s VPN, but when I eventually do want to, I can never remember the command needed to do it. So I have to take the time and look it up. Well I cut that out today with a basic little bash script with a name I can remember when I need it. I titled my script “rice_proxy.sh” but anything memorable to you would be fine. The script takes one argument (“on” or “off”) to either connect or disconnect with the proxy. Stick the script in your bin folder and it will execute simply with rice_proxy.sh on.

The script is reproduced below, or you can grab it from here.

#!/bin/bash
# Andrew J. Moodie
# Feb 2015
# easily remembered interface for vpn connection
if [ "$1" = "on" ]
    then
    sudo /usr/sbin/vpnc RiceVPN.conf
elif [ "$1" = "off" ]
    then
    vpnc­-disconnect
else
    echo " input error -- one argument must be given"
    echo " valid inputs: 'on' or 'off'"
fi

Note that you could further automate this if you wanted to (e.g. auto-enter passwords, connect on startup), but this is a bad idea for both security and for internet speed.

Installing the Generic Mapping Tools 5 (GMT 5.1.x) on Ubuntu Linux

The Generic Mapping Tools (GMT) are a suite of tools for making maps. The graphics generated with default settings in GMT exceed in many ways those which would come out of most users’ ArcGIS work. Admittedly, GMT does come with a steep learning curve, not excluding the installation process. For earlier versions of GMT (4.x.x) installation is more simple and direct, as you can just install from the Ubuntu Software Center (or other package managers), however, these managers typically don’t have the most recent versions — in this case GMT version 5.1.x.

Without further adieu, in the following steps, we will collect the necessary components of the GMT install, compile, and install. Most of the guide comes from the GMT website, but is supplemented with some of what I think are helpful details for new users to GMT.

READ: This guide uses the terminal and a file explorer, but the entire install can be done from the terminal; in some steps incomplete commands to do operations via terminal are listed in square brackets […] where items in carrot brackets must be replaced with system/your-install specific items <…>. All terminal commands listed without brackets are required for successful install.

1) Begin by installing several dependency packages. Running the following command will be sufficient, as any already installed packages will be skipped.
sudo apt-get install subversion ghostscript build-essential cmake libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-dev

2) Download the latest stable version of GMT using
svn checkout svn://gmtserver.soest.hawaii.edu/gmt5/trunk gmt5-dev

3) Visit the GMT download page and download the latest versions of the packages titled “gshhg-gmt-x.x.x.tar.gz” and “dcw-gmt-x.x.x.tar.gz”.
[wget http://gmt.soest.hawaii.edu/files/download?name=dcw-gmt-x.x.x.tar.gz]

4) Copy each compressed folder into the directory downloaded via subversion — this should be located at ~/gmt5-dev by default. Uncompress the folders here.
[cd ~/gmt5-dev]
[cp ./ && cp ./]
[tar -zxvf gshhg-gmt-x.x.x.tar.gz]

5) In the ~/gmt5-dev folder, enter the cmake folder, make a copy of the ConfigUserTemplate.cmake file and rename the copy to ConfigUser.cmake. Open this file in an editor.
[cp ConfigUserTemplate.cmake ./ConfigUser.cmake]
[gedit ConfigUser.cmake]

6) You need to edit the following lines of this file:
a. enable (uncomment) line 107 (set (GSHHG_ROOT…) and replace the path name with the absolute path to the gshhg-gmt-x.x.x folder.
b. enable copy in line 110
c. enable line 113 and replace the path nae with the absolute path to the dcw-gmt-x.x.x folder.
d. enable copy in line 116
Save the file and return to the terminal. NOTE: the line numbers may change with updates by the GMT devs to the .cmake file. Thanks @jerrodwalker for the most recent file lines.

7) cd into the ~/gmt5-dev folder and execute the following commands, waiting to finish each time.
mkdir build
cd build
cmake ..
make
sudo make install

That should complete your install of GMT 5.1.x! To test the install, try the following command into a new terminal window
gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps

Check out the first article of my series on making maps with GMT here!

UPDATE: These instructions were tested on 08/25/16 on Ubuntu 16.04 LTS and remain successful when followed correctly (thanks Luis M.).

Make desktop launcher for Matlab 2014 on Ubuntu

This brief tutorial will demonstrate how to make a .desktop file for Matlab on Ubuntu 14.04 LTS or another standard compliant desktop environment. Open up a terminal, and run the following. In order for this to work, you will have needed to set up symbolic links during installation.

sudo wget http://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -O /usr/share/icons/matlab.png
sudo touch /usr/share/applications/matlab.desktop
sudo gedit /usr/share/applications/matlab.desktop

and paste the following into the document.

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Icon=/usr/share/icons/matlab.png
Name=MATLAB R2014a
Comment=Start MATLAB - The Language of Technical Computing
Exec=matlab -desktop
Categories=Development;

Save, and you should have a new desktop shortcut in your launcher. Comment with any issues or concerns following an update to Matlab and I will see if I can help.

Google chrome profile fix (Ubuntu 14.04)

There was a period a number of months back where I had been getting this annoying error each time I opened Google Chrome about my profile failing to load. “Your profile could not be opened correctly”. Most of the time it had no effect on me but annoying me, but I wanted it gone.

Well I found a solution (although it seems to only be temporary…as I get the error once every few months still) and I’m here to share it. If you are using Ubuntu you can follow the code below exactly, otherwise you may have to do it manually with a file browser or some other method.

  1. quit out of Google Chrome
  2. open up a terminal shell (CTRL + ALT + T)
  3. run cd ~/.config/google-chrome/Default && rm -rf Web\ Data
  4. start Google Chrome again by your preferred method. Problem solved!

Leave a comment below if you still are having trouble and I can try to help you out. Credit for this solution to Dipto.