Linux notes | my old linux notes | HTPC notes | smovs.dk | nk-h.dk | Write a comment
My personal notes collected while messing with Ubuntu 6.06 (server) on my Mini-itx M10000 Nehemiah based server (with the OS running of a 2GB CF card, and a Hauppauge PVR-350 for experimental reasons), Ubuntu 7.04 on my IBM ThinkPad T23 and Ubuntu 7.10 on my T40p.
All entries here:
2008-12-15 03:49:41
Turn the display off (and on) remotely
2008-10-01 01:47:53
WD My Book Studio Edition 1TB
2008-07-25 17:37:13
Newcs cardserver
2008-07-19 18:12:09
Batch rename
2008-07-04 20:29:31
ThinkLight Gmail checker bash script
2008-06-28 23:54:42
Pinnacle DVB-T nano stick (PCTV 73e)
2008-06-21 19:21:20
Play video as ASCII in the console with VLC and mplayer
2008-04-30 19:35:23
Quite random short notes
2008-04-27 22:03:04
Drawing graphs with PHP
2008-04-20 19:01:48
Eggdrop IRC bot
2007-12-30 23:40:13
Apple Bluetooth Keyboard in Ubuntu
2007-12-30 23:28:50
Schedule a recording from the Hauppauge PVR-350
2007-12-30 23:23:50
Network streaming from a Hauppauge PVR-350
2007-12-30 23:09:12
System backup
2007-12-30 23:05:01
Apache2 - Restart
2007-12-30 23:03:41
Apache2 - Reverse Proxy
2007-12-30 22:03:39
Select input on Hauppauge PVR-350
2007-12-30 22:03:39
Capture pictures / screen shots from Hauppauge PVR-350
2007-12-30 21:36:13
Video playback through the tv-out on Hauppauge PVR-150

Turn the display off (and on) remotely
I use an old laptop (IBM TP T23) as a small server, but the problem is that it tends to get quite varm when the lid is closed. It's running Ubuntu 6.06 LTS, so I Fn + F3 doesn't work, and neither does this solution. But I came across this thread: Ubuntu Forums - Force Monitor Turn On When You Open the Lid

That explains a problem that's a bit diffirent, but this works for my problem too.

First install vbetool:

sudo apt-get install vbetool


Now, whenever I want to turn off the screen on the laptop (which is usually whenever it has been restarted), all I have to do is to run this command:

sudo vbetool dpms off


Best of all, it works over ssh :o)

2008-12-15 03:49:41 - Direct link to Turn the display off (and on) remotely
WD My Book Studio Edition 1TB
Okay, so I originally ordered the Home Edition, but as the store didn't have that they gave me this Studio Edition at the same price (they're almost identical, just the colour and FireWire speeds are different, oh, and the Studio is formated for Mac).

WesternDigital MyBook Studio

Anyways, I wanted to use EXT3 for the drive, so I installed Ext2 Installable File System for Windows on my Windows box, and formatted the drive on my laptop (currently running Ubuntu 7.10).

When I looked at the drive after formatting it, it struck me that some of it had gone missing somewhere... df -h repported that the drive was 917G big but only 871G were available...

But then I came across this great page: Recovering reserved space in ext2 and ext3 filesystems which explains that 5% are reserved for the root user and that you can use tune2fs to make that space available to other users!

As I'm only using the drive for data storage, there's no need for reserving data for root.

So a quick command later: tune2fs -m 0 /dev/sdb1

And I now had 917G free space, nice!

As a bonus, it even looks like WD's Drive Manager Status utility in Windows works with the ETX3 file system, and shows the used space on the drives LED array!

2008-10-01 01:47:53 - Direct link to WD My Book Studio Edition 1TB
Newcs cardserver
For my HTPC setup I have to read a smart-card to get the keys to decrypt the digital cable (DVB-C) signals. I desided to run this card server on my little server (currently running Ubuntu 6.06LTS on my T23).

Phoenix/Smartmouse interface with a Viaccess smartcard and Seriel to usb interface

The hardware (a Phoenix/Smartmouse cardreader) is connected through a USB to Serial interface, so it comes up as /dev/ttyUSB0 on my computer.

Most of the set-up is described on this site: Cardsharing Forums - Setting up a NewCS cardserver

But it's a bit different on my Ubuntu machine, so I'll try to run through it here.

In my distribution of newcs-1.50 I didn't get the newcs.x86 file, so I use newcs.i686 in stead, and it works just fine :o)

I placed Newcs in a directory under my home dir, but you can put it where you like.

You'll probably have to make a link to libcrypto.so.0.9.7, which is in /usr/lib/, we need to make a link to it from /lib/:

ln /usr/lib/libcrypto.so.0.9.7 /lib/libcrypto.so.0.9.7

Newcs expects the config file to be /etc/newcs.xml

You can copy the file that comes with Newcs that's called newcs.xml.phoenix to that location.

The important parts to change in the file is <node>/dev/ttyUSB0</node>

And the of course enable the servers you need. I currently use the newcamdserver and connects to it with the Acamd multidec plugin in GB-PVR. Somehow I can't get the Yankse multidec plugin to connect to the Newcs server, which is strange, 'cos it worked when I ran it on a windows box, though, it doesn't matter as long as Newcs + ACamd works :o)

Now we can run the server, just go to the directory where the newcs.i686 file (which you may have to made executable with chmod 777 newcs.i686) is (in my case it's in /home/USER/newcs-1.50/bin

While we're testing the server, just run it with ./newcs.i686 this will show you what the server is doing while it's running. Hopefully it'll show you that it has found the smart card, that it's adding the keys, and that it's starting the servers you've chosen. When the multidec plugin asks the server for keys you should see messages about that too.

When the server is running as it's suppose to, you'll probably want to redirect those messages to somewhere else (which could be /dev/null if you don't want them at all), I direct them to a log file so I have a chance of seeing if anything has failed, so I start Newcs with this command:

./newcs.i686 &> /home/USER/newcs-log.txt &

This will start the Newcs server and redirect any output that would otherwise have been displayed in the terminal to the file /home/USER/newcs-log.txt

2008-07-25 17:37:13 - Direct link to Newcs cardserver
Batch rename
I had to rename a bunch of files, where the start of the filename should be changed. After looking at a lot of documentation, I came across something that looks like this:

for FILE in StartOfFileNameToBeChanged*; do NEWFILE=`echo $FILE | sed 's/StartOfFileNameToBeChanged*/NewStartOfFileName/g'`; echo "$FILE becomes $NEWFILE"; mv $FILE $NEWFILE; done


The code above is one line that's executed in the terminal. If you want to test it before actually renaming anything, just remove the mv $FILE $NEWFILE; part like this:

for FILE in StartOfFileNameToBeChanged*; do NEWFILE=`echo $FILE | sed 's/StartOfFileNameToBeChanged*/NewStartOfFileName/g'`; echo "$FILE becomes $NEWFILE"; done

2008-07-19 18:12:09 - Direct link to Batch rename
ThinkLight Gmail checker bash script
This is a simple script that checks a Gmail account, and turns on the ThinkLight on a ThinkPad laptop when there're unread emails. The script includes the email address and login in unencrypted form, so it might be advisable to come up with a neater...

Read more: ThinkLight Gmail checker bash script

2008-07-04 20:29:31 - Direct link to ThinkLight Gmail checker bash script
Pinnacle DVB-T nano stick (PCTV 73e)
Okay, I've been messing with this for some time, so some of this 'guide' might be redundant, but at least it got it working on my system :) The Pinnacle DVB-T nano stick is a pretty small USB2 DVB-T tuner. The cover slides out to hide the USB plug...

Read more: Pinnacle DVB-T nano stick (PCTV 73e)

2008-06-28 23:54:42 - Direct link to Pinnacle DVB-T nano stick (PCTV 73e)
Play video as ASCII in the console with VLC and mplayer
colour ascii in vlc: vlc --vout caca myfile.mpg colour ascii in mplayer: mplayer -vo caca myfile.mpg This will show the output rendered as ASCII :o)...

Read more: Play video as ASCII in the console with VLC and mplayer

2008-06-21 19:21:20 - Direct link to Play video as ASCII in the console with VLC and mplayer
Quite random short notes
Things to start together with the server (this probably doesn't make sense to anyone else..) Eggdrop: cd /etc/ ./eggdrop.conf lcd4linux: sudo mknod /dev/parport0 c 99 0 sudo chmod a+rw /dev/parport0 sudo lcd4linux Other things: Import in mysql f...

Read more: Quite random short notes

2008-04-30 19:35:23 - Direct link to Quite random short notes
Drawing graphs with PHP
I wanted to make some snazzy graphs of statistics from a MySql based forum. Normally I'd just make a php script that outputs the numbers as CSV files, which I would then import in a spreadsheet and spend a considerable amount of time there trying to ...

Read more: Drawing graphs with PHP

2008-04-27 22:03:04 - Direct link to Drawing graphs with PHP
Eggdrop IRC bot
I wanted to run a bot that could provide live stats from an IRC channel on a web site. First we need to install Eggdrop: sudo apt-get install eggdrop Then we need to edit the /etc/eggdrop.conf file, it takes some time to work your way through it, ...

Read more: Eggdrop IRC bot

2008-04-20 19:01:48 - Direct link to Eggdrop IRC bot
Apple Bluetooth Keyboard in Ubuntu
I've been having a lot of trouble getting my Apple Bluetooth Keyboard working in Ubuntu with my D-link DBT-122 usb module. I followed this guide: HOWTO: Apple Wireless Keyboard (Bluetooth) I managed to get the computer to find the keyboard but it w...

Read more: Apple Bluetooth Keyboard in Ubuntu

2007-12-30 23:40:13 - Direct link to Apple Bluetooth Keyboard in Ubuntu
Schedule a recording from the Hauppauge PVR-350
More info: atdvr ./atdvr -d /mnt/hdd160/pvr/ -f 210.25 -o test-dr1.mpg -s 21:08 -e 21:12 Or nicolai@ubuntu-miniitx:~/bash$ ./atdvr -d /mnt/hdd160/pvr/ -f 203.25 -o DR2-Murphys_Law.mpg -s "20:38 Sep 20" -e "21:40 Sep 20" warning: commands will be e...

Read more: Schedule a recording from the Hauppauge PVR-350

2007-12-30 23:28:50 - Direct link to Schedule a recording from the Hauppauge PVR-350
Network streaming from a Hauppauge PVR-350
Install IVTV - Ubuntu 6.06 IVTV Installation (andre Ubuntu guides) Install VLC player: sudo apt-get install VLC Bitrate and resolution can be set with the following command: ivtvctl --set-codec-params=bitrate_mode=1,bitrate=1000000,bitrate_peak=250...

Read more: Network streaming from a Hauppauge PVR-350

2007-12-30 23:23:50 - Direct link to Network streaming from a Hauppauge PVR-350
System backup
More info: Howto: Backup and restore your system! Execute at root (change filenames and exclusions as needed): tar cvpzf /mnt/hdd160/backup/backup20070704.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys / New version (01-09...

Read more: System backup

2007-12-30 23:09:12 - Direct link to System backup
Apache2 - Restart
sudo /usr/bin/httpd -k restart...

Read more: Apache2 - Restart

2007-12-30 23:05:01 - Direct link to Apache2 - Restart
Apache2 - Reverse Proxy
First of all, be carefull when messing with the proxy functions, they could be exploited! sudo vi /etc/apache2/mods-enabled/proxy.conf Uncomment these lines (and maybe others that are between the Proxy tags): # <Proxy *> # Order deny,allow #...

Read more: Apache2 - Reverse Proxy

2007-12-30 23:03:41 - Direct link to Apache2 - Reverse Proxy
Select input on Hauppauge PVR-350
Select composite input: ivtvctl -p 2 Select tuner: ivtvctl -p 4...

Read more: Select input on Hauppauge PVR-350

2007-12-30 22:03:39 - Direct link to Select input on Hauppauge PVR-350
Capture pictures / screen shots from Hauppauge PVR-350
Capture 5 pictures at 1 picture a second: ffmpeg -s 720x576 -i /dev/video0 -vframes 5 -r 1 test%d.jpg...

Read more: Capture pictures / screen shots from Hauppauge PVR-350

2007-12-30 22:03:39 - Direct link to Capture pictures / screen shots from Hauppauge PVR-350
Video playback through the tv-out on Hauppauge PVR-150
Direct playback of the stream from the PVR-350 tuner: dd if=/dev/video0 of=/dev/video16 bs=64k Playback of an MPEG file on the harddrive: dd if=DR1-StoreNoerd.mpg of=/dev/video16 bs=64k More info on Mythtv-users....

Read more: Video playback through the tv-out on Hauppauge PVR-150

2007-12-30 21:36:13 - Direct link to Video playback through the tv-out on Hauppauge PVR-150