MV

Wednesday, June 22, 2011

startup script ubuntu

When creating a new script to be executed at the startup of Ubuntu, create a script in /etc/init.d

For example 'foo', google for examples of startup scripts, can be anything...

Make the script executable: sudo chmod +x foo

And finally update the list of startup scripts: sudo update-rc.d foo defaults

Simple as that.

Tuesday, May 17, 2011

Increase duration of ringtones

When you get a call on your mobile, the duration of the dialing tone is 15s for most of the Belgian mobile providers before forwarding to voice mail. For some people this is too short, so here's a list how you can increase the dialing tone for the various Belgian mobile providers. Just enter the code and press the dial button to activate the new duration. In the examples I set the duration to 30s.

Proximus: **61*+32475151516*11*30# or **61*+32475151516**30#
Base: **61*+32486191933**30# or *61*+32486191933**30#
Mobistar: **61*5555**30#
Telenet: **61*5555**30#

Apparently for Proximus you can only use this code if you have post-paid formula, with Pay-And-Go (pre-paid) numbers the codes don't work.

Thursday, February 3, 2011

ssh with passphrase authentication

i need to ssh quite a lot and i'm getting tired of always entering my password, so I finally decided to make use of the passphrase authentication.

By far this is the easiest way:
ssh-copy-id -i path/to/id_rsa.pub user@ipaddress

You can do this also manually, which is does the same as the ssh-copy-id command:

1. Check if you have already an rsa key-pair in ~/.ssh directory. You should have the files id_rsa and id_rsa.pub (or another name-combo, f.e. loboloco and loboloco.pub)
If there isn't such a file combo, proceed with the next step, otherwise skip to step 3.
2. first generate an rsa key-pair on your local machine in ~/.ssh:

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dewolfth/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/loboloco/.ssh/id_rsa.
Your public key has been saved in /home/loboloco/.ssh/id_rsa.pub.
The key fingerprint is:
d9:c5:65:7d:6b:38:fe:a2:d5:d4:d9:fc:c9:88:a9:01 loboloco@blackfrancis
The key's randomart image is:
+--[ RSA 2048]----+
| o. |
| . o o|
| o . o|
| o . o ++|
| ES . . oo+|
| . o.= o|
| . o o.+.|
| o .. . |
| . .. . |
+-----------------+
loboloco@blackfrancis:~$

3. Copy the .pub file to the destination server (scp, rsync)
4. Connect to the server via ssh
5. Copy the .pub file to the file ~/.ssh/authorized_keys: cat id_rsa.pub >> .ssh/authorized_keys

That should be it, when you connect again you won't have to enter your password anymore. Very handy if you have to commit code via ssh.

Wednesday, January 19, 2011

EID card reader on Ubuntu... what a mess

Installing a card reader on ubuntu isn't that hard, there exists even good documentation... but Ubuntu seems to mess up the middleware with some updates, kernel updates seem to be most likely.

So each time I need my card reader (let's say 1 time every three months), it has become out of order when trying to connect to a site with my EID, giving either error:

"ssl_error_handshake_failure_alert" or "ssl_error_bad_cert_alert"

This is what helps for me:

A. Reinstall middleware:
1. Download the middleware: here
If the link doesn't work, try this page (in Dutch) which contains a link to the binary.
2. Unpack the .tgz file: tar xvf beid-middlew...tgz
3. cd install
4. Execute "sudo ./install.sh" and follow the instructions. The execution can end with the following lines:

libqtgui4 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
./install.sh: 390: [[: not found
checking pcscd running...
./install.sh: 390: [[: not found
./install.sh: 390: [[: not found
Follow the instructions in the documentation to:
- register the software in Firefox.
- set the environment variable MOZILLA_CERTIFICATE_FOLDER

Please read the README file and licensing information for more information about
libraries this software and the software it is depending on


Try again in Firefox to connect to site with EID.

B. Certificate issues
1. uninstall the beid add-on in firefox, if already installed.
2. Open Firefox
3. Go to this page.
4. Click "Add to firefox".
5. Click "Install Now"
6. Restart firefox.
7. Go to Edit > Preferences > Advanced > Encryption and click View Certificates
8. On Authorities tab, select Belgium CA Root certificate and click Edit.
9. Select the 3 available options and click OK until you return to firefox.
10. Restart firefox to complete the update.

Hooray for ubuntu updates... next time take care of the middleware

Thursday, August 12, 2010

Renaming files

When I travel, I always have at least two CF cards to take some, well most of my family say A LOT (but who cares...), pictures. My problem is always the numbering of the files, because I have set my camera to restart the numbering for a new card. Why, I don't have a clue, but it's like that... perhaps I should change my setting, but then you wouldn't be reading this blog message.

So my issue is that I want to put all files in one directory but then I have conflicting files because there will be 2 files named bla00001.jpg. So I have to add a fixed number to each file name of the second, third,... CF card in order to avoid these conflicts.

Perhaps my solution isn't the shortest, nor the best, but at least it works for me. The solution described here is originally created by my ex-colleague Erik.

So my camera produces the following file name format: DSC000001.JPG
Let's say that the highest number on my first CF card is 313, the first file name of the second CF card must then be 314, i.e. DSC00314.JPG.

So create a file somewhere on your hard drive, for example in /home/myworkspace/Pictures/rename.sh

Add this code to your file:

#!/bin/bash

for file in `ls *.jpg`
do
    numberpart=`echo ${file} | sed 's/DSC[0]*//g'`
    let number=`echo ${numberpart} | sed 's/\.jpg//g'`
    let number=number+313
    filename=DSC00${number}.jpg
    mv ${file} ${filename}
done


Save the file and make it executable via chmod +x rename.sh

Before testing it, make a backup of your pictures directory of which you need to rename the files!!!

Put the script in the directory and run it (./rename.sh)

Now I can put all my pictures in one dir, /me happy

Thursday, February 11, 2010

Sound through HDMI cable

Recently I got myself a fine new full HD television. My laptop has HDMI output so I immediately wanted to watch some movies on my new television. Unfortunately the sound still came through the lousy laptop speakers. Some googling made me a happy man :-)

My system is an HP dv7 1140eb with nVidia 9200M GS running Ubuntu 9.10.

So this is what I had to do to get video and sound to play on my television through my HDMI cable:

1) Update the nVidia drivers to the latest (I used the nvidia drivers from nvidia.com). Go into
2) open sound preferences (system > preferences > sound): on the hardware tab, check if there is a profile Digital Stereo (HDMI) Output. If so select that profile
3) open alsamixer in shell, go to S/PDIF 0 and 1 with RIGHT arrow and unmute by pressing m.
4) test

if there is still no sound via your tv speakers continue, otherwise: w00tness!

1) upgrade alsa version to version 1.0.22:
http://ubuntuforums.org/showthread.php?p=6589810#post6589810
This procedure might take some time (in my case appx 15 minutes)
2) open the sound preferences (system > preferences > sound): on the hardware tab, select the proper Profile, in my case Digital Stereo (HDMI) Output (original value: Analog Stereo Output)
3) open alsamixer in shell, go to S/PDIF 0 and 1 with RIGHT arrow and unmute by pressing m.

That should do the trick. I hope this information helps other people.

Bye Bye til the Next Time

Friday, January 15, 2010

Help no sound in flash apps :-(

Today, on my Ubuntu 9.10 I was trying to watch a youtube video, unfortunately my flash completely freaked out and unfortunately there was no sound either. In the past I used to reboot my machine and then the issue was solved, however, since I had so many apps open, I didn't want to reboot.

So here's how I got it back working:

1. lsof | grep pcm
2. kill the results for pulseaudio and firefox
3. restart alsa: sudo /etc/init.d/alsa-utils restart
remark I killed firefox too because when I then restart firefox it asks me to restore the previous session, so I have all my pages (even in different windows) open again upon starting firefox

w00t, youtube, here I come !

However, if it's still not working after this, most likely there has been a kernel update. Then I used this procedure and then everything worked again:
http://ubuntuforums.org/showthread.php?p=6589810#post6589810
This procedure might take some time (in my case appx 15 minutes)

This procedure could perhaps solve a lot of threads on ubuntu forums like "no sound in flash", "flash makes FF crash", etc...