24 April 2010

Spotify links in Ubuntu & Chrome

Spotify doesn't work in Linux, natively. (edit: it does now) So it's done using wine following this excellent howto.

This means however, that Chrome (and your Ubuntu) is unaware of spotify running "under the radar" as a wine/spotify.exe process. So when clicking a link, like this one: http://open.spotify.com/track/61K2lUXbNSvhEIOkhcozK4 spotify doesn't react.

I've Copy&Paste this dead-on recipe from another blog I found, just so I don't loose it in the future. I can confirm it's working on my Ubuntu 10.04 x64 desktop machine.

echo '#!/bin/sh' > ~/.browser2spotify
echo 'wine "$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe" /uri "$@"' >> ~/.browser2spotify
chmod 755 ~/.browser2spotify
gconftool-2 -t string -s /desktop/gnome/url-handlers/spotify/command "/home/${USER}/.browser2spotify %s"
gconftool-2 -s /desktop/gnome/url-handlers/spotify/needs_terminal false -t bool
gconftool-2 -s /desktop/gnome/url-handlers/spotify/enabled true -t bool

The clue with this is to make gnome pass URLs starting with spotify: to the script which passes the URL to spotify.exe

This will do the job until Spotify makes a proper native linux client. Id'e think that wouldn't be too hard as it's an Adobe Air application, which is flash, which is pretty platform independent and very capable of running properly on Linux.


13 April 2010

sshfs - brilliantly simple

Got another linux/unix -box sitting somewhere in your home? I do, and I want _everything_ available to me from where I sit at my desktop.

I've used nfs quite a bit in the past, while quite easy to set-up it's a hassle compared to the simpleness of sshfs. And setting up samba is like getting skinned alive on this scale.

#apt-get install sshfs

(ubuntu, the other machine / slave)
#apt-get install openssh-server

put this in /etc/fstab, and you can on-demand mount/unmount the other computer when you see fit:

sshfs#finn@ /home/finn/theslavecomputer fuse noauto,defaults,users,idmap=user 0 0

Now you have the root of the filesystem of the other machine sitting in your home directory. Sweet?

#mount theslavecomputer
... any time you need it. I prefer not using auto mount as I only need access to the other machine like 1 in 20 times I boot. A good rule on fstab in my experience is to not put a lot of stuff on auto-mount. It will get you in trouble when booting eventually which makes you so miserable you'll not click 'like' on any comments you'll read Facebook that day.

Tip: make this password less by uploading the public certificate. Google it and you'll get a step-by-step in a sec.


07 April 2010

Synergy between Ubuntu and OS X

I use Synergy to share one set of mouse and keyboard between my workstation PC, running Ubuntu 10.04 and my laptop sitting on my desk next to my workstation screen. The laptop is running OS X.

How about not raising your hands off your keyboard and mouse when you have to do stuff on that laptop? Greetings Synergy

Here is how I configured it.

On OS X, the keboard+mouse -client
... I followed one of the suggested steps on synergys website. Copy&Paste:

# sudo su -
# defaults read com.apple.loginwindow LoginHook
# sudo mkdir -p /Library/LoginWindow
# sudo vi LoginHook.sh

killall ${prog[0]##*/}
exec "${prog[@]}"

# sudo chmod 755 /Library/LoginWindow/LoginHook.sh
# defaults write com.apple.loginwindow LoginHook /Library/LoginWindow/LoginHook.sh

On Ubuntu, the server with mouse+keyboard attached
... the guide wasn't that much help as it wasn't specific for any distribution, so I decided to just put the startup after gdm is fired up.
# sudo vi /etc/gdm/PostLogin/Default

killall synergys
sleep 1
/usr/bin/synergys -c /etc/synergy.conf &

My /etc/synergy.conf looks like this:

section: screens

section: links
right = finnmac.local
left = finnbuntu


Rescue Ubuntu 10.04 graphics crash after grub

This is a note to self, in case I run into this problem again. Obviously a (beta) problem with the nvidia -driver.

The symptoms is that you get the grub chooser showing just fine, but get a distorted strange looking graphics crash screen directly after - when it's supposed to show the boot splash. Turned out I had to disable nvidia to find my underlying problem which prevented me booting. This was a error in /etc/fstab, my own fault entirely.

This is a very generic and nice way to mount up and rescue your system, and using chroot you've almost got your system running as if you've booted it off your hard drive. (well, not entirely true)

Boot off the Ubuntu the 10.04 CD and open a terminal

#mount /dev/sda1 /mnt
#mount -o bind /proc /mnt/proc
#mount -o bind /dev /mnt/dev
#sudo chroot /mnt
#apt-get remove nvidia-96 --purge
#apt-get remove nvidia-173 --purge