Nevermind streaming, mount your mp3 dir over SSH and listen to your music at work!

This whole streaming hype sometimes makes you think it’s the ideal way of doing things.
But sometimes it’s just a hassle to setup the streaming server and possibly have to deal with lower quality than the original file to boot.

My solution for listening to my music at work now is to just mount my MP3 directory to a directory on my work machine over SSH.
So far it has been working flawlessly although it has a few problems streaming considerably large files like FLAC/WAV, but that was to be expected since my downstream at work is actually lower than my upstream at home.

To get it to work you will have to install sshfs first:

sudo aptitude install sshfs

Then add yourself to the fuse group to be able to use it:

sudo gpasswd -a $USER fuse

And here’s a simple command I run to mount it:

sshfs -o idmap=user myhomeuser@home.domain.com:/media/1tb/mp3 /home/myworkuser/music_home/ -p 22 -C
  • with -p you can set the port to connect to (your ssh port)
  • -C tells ssh to compress the connection, can’t hurt

You can also make the system mount this location on startup using /etc/fstab but I don’t want to do that so haven’t set that up.

Automatic Lossless JPEG Optimisation

Just stumbled upon this little program which optimizes JPEG images.
In my directory of thumbnails it saved an easy 20KB for only 16 images, so that’s not half bad if you ask me. Every little bit helps :)

I’ve been working on a little gallery in Zend Framework, and am generating thumbnails in a cache dir.
They were pretty damn small already, but I like to keep tweaking at things so this was a nice little extra.

In Ubuntu you can install it quickly using:

sudo aptitude install jpegoptim

Then in my PHP code I just used this:

// Thumnail?
if($b_thumb)
{

$cache_dir = $b_full ? ‘../cache/images/thumbs/full/’ : ‘../cache/images/thumbs/small/’;

// IS THUMBNAIL CACHED?
if(!file_exists($cache_dir . $s_imageName))
{
$i_thumb_width = $b_full ? 100 : 50; // set thumbnail width
$i_imageNewHeight = ($a_imageSize[1] * $i_thumb_width) / $a_imageSize[0]; // calculate new height
$i_imageNewHeight = round($i_imageNewHeight, 0); // round it nicely
$temp_image = imagecreatetruecolor($i_thumb_width, $i_imageNewHeight); // create a new image object
imagecopyresampled($temp_image, $o_image, 0, 0, 0, 0, $i_thumb_width, $i_imageNewHeight, $a_imageSize[0], $a_imageSize[1]); // copy content from image into the new object
$o_image = $temp_image; // too lazy to clean this up
imagejpeg($o_image, $cache_dir . $s_imageName); // write the image file to disk

$jpegoptim = ‘jpegoptim ‘. $cache_dir . $s_imageName; // create optimizating command
exec($jpegoptim); // execute the jpegoptim command

}
else
{
// CACHED!
$o_image = imagecreatefromjpeg($cache_dir . $s_imageName);
}

header(‘Expires: ‘ . gmdate(‘D, d M Y H:i:s’, time()+24*60*60) . ‘ GMT’);
header(‘Content-Type: image/jpeg’);
imagejpeg($o_image);
imagedestroy($o_image);
}

You might want to be aware of the fact that since I am writing the thumbnails to disk as apache and then running jpegoptim on the file from php the permissions are already set correctly. Otherwise you might have to check the owner of the file, when testing from command-line in Ubuntu I had to use sudo to run it against the thumbnails since they were owned by www-data (the default apache user in Ubuntu).

CSS3 Maker (awesome css generator!)

Dunno about you guys but I am pretty thrilled about all the new possibilities in CSS3. However, it can be a bit of a hassle to figure out all the right values if you’re writing CSS by hand.

So enjoy this amazing WYSIWYG tool to visually generate good CSS code which is cross-browser compatible!

Visit the homepage here

Linux Mint Menu in Ubuntu (Lucid) by using the Mint Repo

This has been popping up on sites today, and people are installing from .deb files downloaded out of the Mint repo’s. Now, I like to keep my software up-to-date and thus don’t like installing loose .deb files without adding the repo where they came from.

Just a note of warning: this is meant for Ubuntu Lucid (Gnome) in combination with Linux Mint 9!

So here’s how you can install the Linux Mint menu by adding the Mint repo, and thus keeping up to date :)

First we want to add the Mint repo by creating a new file in /etc/apt/sources.list.d/ called mint.list:

sudo nano /etc/apt/sources.list.d/mint.list

Paste in the following line:

deb http://packages.linuxmint.com/ isadora main

Press Ctrl+X to close Nano and save the file.
Install the GPG key for the repo:

sudo apt-key adv –recv-key –keyserver keyserver.ubuntu.com 0FF405B2

Next run aptitude update, and install some Mint packages:

sudo aptitude update; sudo aptitude install mint-translations mint-common mintmenu

Now just add the Mint Menu to the Gnome panel:

Click to view larger image

To tweak it a bit more follow this (blatantly copied from this Ubuntu Forums post):

Ubuntuize it
If you right-click on the menu button and select “Preferences” you will see the menu with a whole bunch of stuff. On the first tab which is shown, named “Main Button” you can change how the button looks in the gnome pane. For me, I deleted the button text as I just wanted to have a logo, but of course the choice is yours.

As for the icon, if you want an ubuntu logo, here are the paths to copy in (NOTE: paths are based of Ubuntu 10.04)

If you’re using a light theme:

/usr/share/icons/ubuntu-mono-light/apps/24/start-here.svg

If you’re using a dark theme:

/usr/share/icons/ubuntu-mono-dark/apps/24/start-here.svg

Play around!
Have a good look around the preferences and what you can do. There is quite a lot you can play with.
You can choose what items you have in the “Favourites” section but right clicking on a menu item (from “All Applications”) and choose “Show in my favourites”. You can remove items from your favourites by right clicking on them and selected “Remove from favourites”.

Known Issue…
After you ave added it to the panel, you will notice that if you select “All Applications”, that there is nothing there, or that there are no sub-menus. No problem, all should be fine and working after a the next reboot.

So there you have it, the Mint Menu in Ubuntu. And remember, Mint is made off Ubuntu so everything is pretty much interchangeable, so don’t worry that you’re using a menu made for a different
distro.

PS3 Modchip being tested and confirmed to work!

I own a PS3 Slim myself since the release of Skate3. I had been going over to a friend’s house in the past with each new release of Skate to help him finish the game.

However, with the release of Skate3 and my new job I didn’t really have that much time to go over to his place each time so I decided to buy one myself.

The biggest let-down of the PS3 was the fact it couldn’t be modchipped, but it seems one is just around the corner!

Check these video’s!

From psx-scene.com:

PS Jailbreak is a USB plug and play solution that installs in seconds, keeping your valid warranty seal in tact.

Easy to use installer and GUI takes you step by step.

Compatible with all production models FAT and SLIM. Supports all regions: USA, JAP, PAL and KOREA

PS Jailbreak disables forced software updates and will never brick your console.

Supports all games (it does not allow backups of bluray movies , dvd movies , or past consoles games)

Backup games to your internal hard drive or external hard drive through USB, and boot directly off GUI. Eliminating the need for expensive blueray burners and costly blank media.

Play backups off your hard drives 2x as fast as off the blueray drive. This eliminates lags and glitches to provide you with smoother game play.

Open up your console to a new generation of homebrew applications. Load homebrew apps/games off any USB hard drive/flash drive.

Fully updatable with new features/updates by connecting PS Jailbreak to any computers USB port.

Some links related to this:
PSX-Scene Server might be down, there’s hundreds of thousands of users trying to visit the site!
Engadget
Pocket-Lint

Auto start Teamspeak 3 Ubuntu

Before I start I am asuming you have already downloaded your copy of teamspeak 3 and unpacked it.
For reference I will assume the path to where you unpacked TS3 is:

/home/ts3/teamspeak3-server_linux-amd64

Now to make an autostart script you can actually just reuse the one that comes with TS3: ts3server_startscript.sh

The only thing I did to get this working was edit ts3server_startscript.sh and change one line.

BINARYPATH=”$(dirname “${0}”)”

I replaced with the actual path:

BINARYPATH=”/home/ts3/teamspeak3-server_linux-amd64/”

Then I went into /etc/init.d and made a symlink to this file, like so:

cd /etc/init.d
sudo ln -s /home/ts3/teamspeak3-server_linux-amd64/ts3server_startscript.sh ts3

Then we need to make sure the TS3 server starts on a reboot, so we at it to the various runlevels like so:

sudo update-rc.d -f ts3 defaults

Now you can start/stop/restart TS3 like any other service:

sudo service ts3 start

TS3 will run as root though, which is a bit of a vulnerability, maybe I’ll figure out how to fix that later.
I used another very simple start script before, but because it lacked start/stop/restart commands the server couldn’t actually reboot..
It would send the stop command to the service, which would just hang there and the server wouldn’t proceed to shut down processes after that.
The way I described above works perfectly for me :)

Ubuntu Natty Narwhal (11.04)

Well it seems Canonical has finally decided on the name for the newly announced Ubuntu version, to be released in April 2011. It will be called Natty Narwhal.

What wikipedia has to say about the Narwhal:

The narwhal (Monodon monoceros) is a medium-sized toothed whale that lives year-round in the Arctic. One of two species of whale in the Monodontidae family, along with the Beluga whale, the narwhal males are distinguished by a characteristic long, straight, helical tusk extending from their upper left jaw. Found primarily in Canadian Arctic and Greenlandic waters rarely south of 65°N latitude, the narwhal is a uniquely specialized Arctic predator. In the winter, it feeds on benthic prey, mostly flatfish, at depths of up to 1500 m under dense pack ice.[3] Narwhal have been harvested for over a thousand years by Inuit people in Northern Canada and Greenland for meat and ivory and a regulated subsistence hunt continues to this day. While populations appear stable, the narwhal has been deemed particularly vulnerable to climate change due to a narrow geographical range and specialized diet.

Natty means neat and/or tidy. I kind of miss the relevance to the Narwhal…

Upgraded VPS from Karmic (9.10) to Lucid (10.4)

I followed the really simple guide posted by my VPS hoster for upgrading my VPS to Ubuntu Lucid.
It took quite a while to run, but after adding a single row to /etc/fstab it restarted without problems!
Seriously, I didn’t change a single thing and everything “just worked”.. That’s how it’s supposed to be!

Now to experiment with the 2.6.35 kernel, no idea if that will run on a VPS but we’ll see soon enough :P

Discover Motherboard Make & Model in Linux

I never knew how to do this before, and never really needed it since I pretty much know my motherboard models by heart.

However, with the increasingly weird model numbers these days from companies like Gigabyte and Asus I can’t seem to remember them anymore.
I also have way too many computers to take care of to remember my own now (am I getting old?).

Anyway’s, here’s the command. The data we are interrested in should be at the top of the output. I like to “pipe” it to the “less” command so we can scroll through it easily:

sudo dmidecode | less

Hope this helps someone :)

Ubuntu Lucid vs Windows XP

At work I have been working on Windows XP but for testing reasons I installed Ubuntu Lucid as well and am dual-booting now. Switching between the two I have started to get a bit annoyed with XP because it is much slower than Ubuntu is. Programs seem to take a lot longer to start, even when using the same software (Zend Studio, OpenOffice, Firefox, Thunderbird, etc).

In the past it used to be the other way round, but Canonical really did a good job on Lucid!
Sometimes I still have to go back to XP (to test websites in IE for example) and it’s really a disappointment.