Bash prompt pimping

Today at work over lunch I read an article in Linux Magazine called Pimped Prompt.

It inspired me to try different stuff out. I often missed an indication on when I was doing different stuff in the terminal… this is what I ended up with:

export PS1='\[\e[0;34m\][\@\e[1D]\[33[0m\] \u@\h:\w\$ '
This is how it looks like.
This is how it looks like.

To make it permanent put it in your .bashrc file in your home directory. Remember that this variable is propably already set so you either need to replace the line or instert closer to the bottom of the file.

Mass converting flac to mp3 with Gstreamer from cli

I’m extracting all my CD’s to flac files but my girlfriend is using iPod and iTunes on Windows which won’t play flac files. So I looked into converting all the music to mp3 so she could use it as well. I wanted a way to do it from the command line and I knew Gstreamer was up for the job:

gst-launch-0.10 filesrc location="music.flac" ! flacdec ! audioconvert ! lame ! id3mux name=tag v2-tag=true v1-tag=true ! filesink location="music.mp3"

The cool thing is that tags is preserved.

Note: Actually first I thought tags wasn’t preserved during the the gstreamer conversion, but that was because I used Totem with the Xine backend which apparently cant show mp3 tags.

Now I only need to write a bash script to run through all the music… lets see when I find the time :D

Lenovo laptops with preinstalled Ubuntu?

Just found this on the Ubuntu forums:

Lenovo Blogs - Linux Follow Up

I would be very interesting indeed :)

Bazaar (bzr) howto - Creating your own branch

I have been learning a bit of Mono over the last couple of months and yesterday I decided that I wanted my code in a verison control system. The choice fell on Bazaar for various reasons which is unimportant and uninteresting at this point. Right now I just wanna write down how I did :D

First off you tell Bazaar who you are with:

bzr whoami "Jacob Emcken "

To test it is set correct just type:

bzr whoami
Jacob Emcken 

For the sake of it, lets imagine my project I want to version control is called Starfire. Go to the directory with the project and initialze the directory as a Bazaar branch:

cd Projects/Starfire
bzr init

Within that directory a new directory called .bzr will be created:

ls -la
drwxr-xr-x 5 je je 4096 2007-09-01 23:56 .
drwxr-xr-x 3 je je 4096 2007-09-01 23:37 ..
drwxr-xr-x 6 je je 4096 2007-09-01 23:37 .bzr
drwxr-xr-x 2 je je 4096 2007-09-01 23:37 Glade
-rw-r--r-- 1 je je 5342 2007-09-01 23:37 Starfire.cs
-rw-r-xr-x 1 je je 5342 2007-09-01 23:40 Starfire.exe

Now tell Bazaar which files your branch consist of. In the following example we’ll tell Bazaar to ignore Starfire.exe because we dont need the compiled file within our version control:

bzr ignore Starfire.exe
bzr add .
added Glade
added Starfire.cs
added Glade/
ignored 1 file(s).
If you wish to add some of these files, please add them by name.

Ignored files is found in the file .bzrignore, just try run ls -la if you wont take my word for it :P

And finally to actual save the code in the branch repository commit your files:

bzr commit -m "Initial revision"
added .bzrignore
added Glade
added Starfire.cs
added Glade/
Committed revision 1. 

By supplying commit with the parameter -m you avoid a text editor popping up asking you for a commit message.

Now you can just hack away and you can check changes with:

bzr diff

Whenever you want to save you changes to the branch, just do a commit again. In the following example I change a line in Starfire.cs:

bzr commit -m "Fixed small typo"
modified Starfire.cs
Committed revision 2. 

Now if you want to make your code available on the another machine ie. a server on the internet you can push you code out there through ssh (and ftp). Place yourself in the root directory of your project. The following example will push the branch out to my server ( where I have a ssh key so I dont need to write a password when logging in:

bzr push s

Now a copy of my branch is available in my home directory on my server (/home/je/development/Starfire).

As a last thing I would like my server to be central for my development. From the root directory of my project I tell Bazaar that my current branch is a checkout of the branch on my server:

bzr bind s

Now whenever I commit changes they will be committed to the server as well so I don’t need to push the copy of the branch out there every time. You can test the settings with:

bzr info

My experience with version control systems are very limited to say the least which was why some of the above wasn’t obvious to me before I made a few tests and read the man pages. But the above was what I needed to get started and I hope that this might help someone else. You can find more inspiration here and here.

Helpdesk from medieval times... users are still stupid

I was cleaning my (computer) desktop and found this video about a helpdesk from medieval times ( sadly it is in Norwegian :( ). I had saved it on purpose because I though it was so funny. Now I found it on YouTube… deleted :P