VARIOUS HOWTOs

Network traffic

dstat
vnstat -i wlan2 -l

nload
iftop
nethogs

Command line VLC transcoding and streaming

vlc -vvv udp://@239.193.0.1 --sout '#transcode{vcodec=h264,vb=700,scale=0.75,acodec=mp4a,ab=128,channels=2}:duplicate{dst=std{access=http,mux=ts,dst=129.177.24.177:8001}'

Xvid for my Archos 605 wifi with mencoder

Download and install mplayer, xvid and lame.

mencoder file.avi -vf scale=700:-2 -oac mp3lame -ovc xvid -xvidencopts bitrate=600 -o file-archos.avi

SopCast for Linux

Download:
http://download.sopcast.org/download/sp-sc.tgz

Start local server:
./sp-sc-auth sop://broker.sopcast.com:3912/10912 8900 8800

View:
mplayer http://localhost:8800

Channels:
http://www.sopcast.org/channel/

NETGEAR WG111 v2 Wireless USB Adapter

(this is what I added to the ndiswrapper wiki)

- Card NETGEAR WG111 v2 Wireless USB Adapter
  • Chipset: Realtek
  • usbid: ID 0846:6a00 NetGear, Inc. WG111 WiFi (v2)
  • Kernel: 2.6.20-16-generic This kernel comes with ndiswrapper module in place so I had to delete it. You can find the module with 'locate ndiswrapper.ko'
  • Distro: Ubuntu Feisty Fawn
  • Driver download from: http://kbserver.netgear.com/release_notes/d103125.asp
  • Driver link: ftp://downloads.netgear.com/files/wg111v2_3_3_0_setup.zip
  • Installation: Used unzip to extract the setup program and then wine (NOTE: set winecfg | win98) to install the utilities that places the driver into ~.wine/drive_c/Programfiler/NETGEAR/WG111v2/Driver/Win98Me . Setting wine to win98 gives me win98 drivers. I tried the winXP drivers without success.
  • Driver version: driver net111v2 (NETGEAR Inc.,02/07/2007,5.1283.0207.2007)
  • WINXP driver does not work although it installs fine and also discovers some networks while scanning with 'iwlist scan'.
  • ndiswrapper version: Installed ndiswrapper from svn sources, revision 2427. Older versions of this driver did crash my system and freeze it completely when unloading the ndiswrapper module or when removing the USB wireless adapter. New version does not crash my system.

Dumping Garmin GPS data to file (using USB cable)

gpsbabel -i garmin -f /dev/ttyUSB0 -o gpsdrive -F gpsdump

Readi ng all:
gpsbabel -t -r -w -i garmin -f /dev/ttyUSB0 -o gpx -F backup.gpx

Setting time

sudo date -s 10:59
sudo hwclock --systohc

FreeBSD Mplayerplug-in

Add line below to CFLAGS (in Makefile)
-I${X11BASE}/include -I${LOCALBASE}/include -DBSD

FreeBSD ports

portsnap fetch extract
(This gives you ports in /usr/ports)
portsnap update
(updating ports, NOT installed apps)

Installing apps

pkg_add -r firefox
(using pkg)
cd /usr/ports/www/firefox
make install clean
(using ports)

Searching for applications

cd /usr/ports
make search name=applicationName | more
http://www.freebsd.org/ports/
(web based search)

Finding packages

pkg_which pkgdb

Deleting applications

pkg_delete kaffeine-mozilla-0.2_6

Versions

pkg_version | more
=: the application is up to date.
< : there is a newer version of the application available.
>: your index may be out of date.

Upgrading installed apps

a@bsd /usr/ports/ports-mgmt/portupgrade]$ make install clean
/usr/local/sbin/pkgdb -F
/usr/local/sbin/portupgrade -ra

Listing a ports dependencies

make pretty-print-build-depends-list

What services/ports are running on your box?

echo "Open Ports:" ; netstat -anp | grep LISTEN | grep tcp | awk '{print $4, "\t", $7}' | more

nmap localhost

rcconf (lists services)

netstat -tulpn

Getting .odt support working in Abiword 2.4.6 with Debian Stable

Problem: Debian Stable is using an old libgsf with a bug that makes trouble for Abiword and it's .odt plugin.
Solution: Install a version of libgsf 'manually' and tell abiword to use this new installed version.

e@debian:~$ wget http://ftp.gnome.org/pub/GNOME/sources/libgsf/1.12/libgsf-1.12.1.tar.gz
e@debian:~$ ./configure
e@debian:~$ make
e@debian:~$ make install (as root)

Then start Abiword with:
e@debian:~$ LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH abiword2-4 (where abiword2-4 is your executable for abiword)

Thanks to uwog !

Building Abiword from source in Mandriva

Get the source code
wget http://www.abisource.com/downloads/abiword/2.4.4/source/abiword-2.4.4.tar.gz
tar -xzvf abiword-2.4.4.tar.gz

Install some dependencies
urpmi libgtk+2-devel
urpmi libxorg-x11-devel
urpmi libglade2.0-devel
urpmi libgnomeprint2-2_0-devel
urpmi libgnomeprintui2-2_0-devel
urpmi libgnomeui2_0-devel

Configure, compile and install Abiword into /usr/local/abiword as root
cd abi
./configure --prefix=/usr/local/abiword/ --enable-gnome
make
make install

Build support for OpenDocument and OpenWriter format using Abiword plugins.
cd abiword-plugins
urpmi libgsf-1_1-devel
./configure --prefix=/usr/local/abiword/ --disable-all --enable-OpenDocument --enable-OpenWriter
make
make install

Wordpress backup/restore

Adapted from: http://codex.wordpress.org/Backing_up_your_database

Backup using the msqldump utility.

e@debian:~$ mysqldump --add-drop-table -h localhost -u mysqlusername -p databasename | bzip2 -c > blog.bak.sql.bz2

Enter password: (enter your mysql password)
e@debian:~$

Restore

e@debian:~$ bzip2 -d blog.bak.sql.bz2

e@debian:~$ mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql

Enter password: (enter your mysql password)
e@debian:~$



Subversion basic commands

svnadmin create /path/to/repos

svn import /tmp/myproject file:///path/to/repos/myproject -m "initial import"

svn import ClientPlanet svn://bybris.intermedia.uib.no/hacks -m "First import"

svn co http://server/repository/directoryForProject localDirectory

svn diff

svn update

svn commit

svn add newFile.txt

svn log -v -r #

Bluetooth file transfer in Debian Sarge

Nokia 6630 to Debian Sarge Box

e@debian:~$ sdpd
e@debian:~$ sdptool add --channel=10 OPUSH
OBEX Object Push service registered
e@debian:~$ obexserver
Waiting for connection...

...................................HEADER_LENGTH = 34862
put_done() Skipped header 44
Filename = FEscr(009).jpg
Wrote /tmp/FEscr(009).jpg (34862 bytes)


e@debian:~$

Opera devel snapshots on Debian Sarge

Download the latest snapshot from the Opera Desktop Team.

For the static .deb version:

mkdir ~/opera_9.0-20060310
cd ~/opera_9.0-2006031
ar -x opera-static_9.0-20060310.1-qt_en_i386.deb
tar xzvf data.tar.gz
perl -pi -e 's/^OPERA_BINARYDIR=\//OPERA_BINARYDIR=/' usr/bin/opera
usr/bin/opera -personaldir ~/opera_9.0-2006031

Source nicomen in this comment thread.

Open office 2.2.0 in Debian Sarge

I'am still using OpenOffice 1.1.3 in Debian Sarge (the supported OO version).OpenOffice2.0 and 2.0.1 have both been too buggy for me. Now that OpenOffice 2.0.4 is released I've will give the 2XX branch another try.

This is how I install OpenOffice 2.2.0 in Debian Sarge.

Go to openoffice.org and download the bittorrent version (2.2.0 | Linux x86 | en).

Start the bittorrent download with the btdownloadcurses command:

e@debian:~$ btdownloadcurses OOo_2.2.0_LinuxIntel_install.tar.gz.torrent

Your terminal will turn into something like this:

file: OOo_2.2.0_LinuxIntel_install.tar.gz
| size: 122,488,813 (116.8 MB)
| dest: /home/rune/OOo_2.2.0_LinuxIntel_install.tar.gz
| progress: _____________________________________
| status: connecting to peers (0.0%)
| speed: 0 B/s down - 0 B/s up
| totals: 0.0 MB down - 0.0 MB up
| error(s):
|

When the download is finished extract the file, go to the RPM directory, change to root and run alien, last, install the generated deb packages with dpkg:

e@debian:~/apps$ tar -xzvf OOo_2.2.0_LinuxIntel_install.tar.gz
e@debian:~/apps$ cd OOB680_m5_native_packed-1_en-US.9011/RPMS
e@debian:~/apps$ su
Password:
e@debian:~/apps$ alien *rpm
e@debian:~/apps$ dpkg -i *deb

You will now find OpenOffice in /opt

Adding java support to OpenOffice

Basically I prefer installing both the complete Java SE package from http://java.sun.com/javase/6/, and the Java Media Framwork package from http://java.sun.com/products/java-media/jmf/index.jsp . JMF is needed for the Media Player in OpenOffice.

Installing and setting up Java SE.

Install Java SE with:
chmod +x jdk1.60.bin
./jdk1.6.0.bin

Tools | Options | Java and then choose 'Add' and then locate your Java SE directory.

Installing and setting up JMF

e@debian:~/apps$ chmod +x jmf-2_1_1e-linux-i586.bin
e@debian:~/apps$ ./jmf-2_1_1e-linux-i586.bin
(answer 'no' to all questions)

Tools | Options | Java and then choose 'Add' and then locate your JMF directory.

mplayer in ubuntu dapper

For some reason mplayer is just a PITA in Ubuntu so I decided to install it using the source from the mplayer subversion server. This is what I did.

Where do I install my local apps?

I have a directory named programs in my home (~) directory for locally installed apps (yep, I dont' use /usr/local as I probably should).

cd ~/programs
mkdir mplayer
cd mplayer

Install some tools and libraries

sudo apt-get install build-essential subversion libpng12-dev libgtk2.0-dev libtheora-dev nasm

Include x264

svn co svn://svn.videolan.org/x264/trunk x264
./configure && make && sudo make install

Include live555

wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz
tar -xzvf live555-latest.tar.gz
cd live
./genMakefiles linux
make
cd ..
cp -r live /usr/lib

Get the mplayer sources from subversion

svn co svn://svn.mplayerhq.hu/mplayer/trunk/ mplayersource

Build mplayer

./configure --prefix=~/programs/mplayer --win32codecsdir=~/programs/mplayer/codecs --enable-gui
make
make install

Get skins

mkdir ~/.mplayer/skins
cd ~/.mplayer/skins wget http://www2.mplayerhq.hu/MPlayer/skins/proton-1.2.tar.bz2
tar -xjvf proton-1.2.tar.bz2

Get fonts

mkdir ~/.mplayer/font
cd ~/.mplayer/font wget http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
tar -xzvf font-arial-iso-8859-1.tar.bz2

Run mplayer

gmplayer -skin proton movie.avi

mplayerplug-in in Debian Sarge (does work in Ubuntu Edgy as well)

Delete the mplayer and totem plugins that do already exist:

(The best way to do this is probably to remove the deb packages!)

admin@ubuntu:/usr/lib/mozilla-firefox/plugins$ sudo rm mplayerplug-in*
admin@ubuntu:/usr/lib/mozilla-firefox/plugins$ sudo rm nlibtotem_mozilla.*

cd ~/program
mkdir mplayerplug-in
cd mplayerplug-in

Get the code from cvs

cvs -d:pserver:anonymous@mplayerplug-in.cvs.sourceforge.net:/cvsroot/mplayerplug-in login
(just hit enter for password)

cvs -z3 -d:pserver:anonymous@mplayerplug-in.cvs.sourceforge.net:/cvsroot/mplayerplug-in co mplayerplug-in

Install some dependencies

apt-get install libgtk2.0-dev (will probably install a bunch of other packages)
apt-get install gettext
apt-get install libxpm-dev
apt-get install mozilla-dev
sudo apt-get install libxpm-dev

OLD DEBIAN SARGE INSTALL METHOD!

Get gecko (mozilla dev libs)

wget http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.8/gecko-sdk-i686-pc-linux-gnu-1.7.8.tar.gz
tar -xzvf gecko-sdk-i686-pc-linux-gnu-1.7.8.tar.gz

Building mplayerplug-in

First I check if firefox is linked against gtk. If it is I will configure the build with '--enable-gtk2'.

ldd /usr/lib/mozilla-firefox/firefox-bin | grep gtk

(or ask the bot in #debian /msg dpkg depends mozilla-firefox)

Configure

./configure --with-gecko-sdk=/the/path/to/gecko-sdk --enable-gtk2

NEW DEBIAN SARGE/Ubuntu Edgy INSTALL METHOD!

In Ubuntu Edgy

e@laptop:~/apps/mplayerplug-in$ ./whatoptions.sh
Run configure with the following options
./configure --prefix=/usr --with-mozilla-home=/usr/lib/firefox
e@laptop:~/apps/mplayerplug-in$ ./configure --prefix=/usr --with-mozilla-home=/usr/lib/firefox

Compile

make

Install into /usr/lib/mozilla/plugin

make install

Also install/copy the plugins files into the Firefox plugin diretory

cp mplayerplug-in*.so /usr/lib/mozilla-firefox/plugins
cp mplayerplug-in*.xpt /usr/lib/mozilla-firefox/components
cp mplayerplug-in.types /etc
cp mplayerplug-in.conf /etc

Sound and Movie

Saving an audio network stream to disk

Use mplayer to dump the stream

mplayer http://45.23.161.248:6005 -dumpstream -dumpfile myRadioShow.stream


Now we need to convert the stream to a more suitable format:

mplayer -ao pcm myRadioShow.stream

Now you can burn it to a cd or convert it to another format.


cdrecord dev=1,1,0 -eject speed=4 -pad -audio myRadioShow.wav
(you need to put in your dev)

Encoding using oggenc to ogg vorbis

oggenc myRadioShow.wav

mplayer tips and tricks

Dump audio to a raw sound(pcm in wav)

mplayer -ao pcm:file=DesigningInteractions.wav -vo null -vc dummy DesigningInteractions.avi

Turn up the volume with sox

sox -v 3 DesigningInteractions.wav DesigningInteractionsNew.wav

Put them all together again

mencoder DesigningInteractions.avi -audiofile DesigningInteractionsNew.wav -oac copy -ovc copy -o DesigningInteractionsNew.avi

Building ffplay when building ffmpeg:

apt-get install libsdl1.2-dev