March 04, 2009 at 12:37 PM | categories: Tips | View Comments

Restoring grub

This will help you to restore your grub boot loader if it has been overwritten by another operating system say M$ windows.

  1. Boot using a live cd or boot into rescue mode
  2. Type grub
  3. Type root(hd0,0) where the first 0 is the disk and the second is the partition substitute to fit your disk layout
  4. Type setup (hd0) where the 0 is your disk substitute to fit your installation.
  5. Type quit
  6. reboot

Thats it you are home and away.

Migrate dovecot from mbox to maildir

To move to the better maildir format from mbox, there are several converts to do this but i found convert-and-create was the most effective in that it even creates the maildirs for the users who may not have mail in the spool file

 # wget
 # chmod +x convert-and-create
 # service dovecot stop
 # stop your Mail server as well (exim,postfix,sendmail)
 # ./convert-and-create

Another way to do it on the fly is described here

Su without typing password

Sometimes you need to su frequently, typing the password each time may not be convenient. The pam system allows you to configure su without password. To do this you need to add the user to the wheel group and then configure pam

Add user to the wheel group

 # vigr


configure pam edit /etc/pam.d/su and uncomment the line

auth           sufficient trust use_uid

Now you can su with out being asked for a password.

Convert xvid video divx video

To convert xvid videos to divx format to play on stand alone video players in HDTV mode, you can use memcoder to re-encode the video to divx

mencoder <input> -ovc lavc -oac lavc -ffourcc DX50 -xvidencopts profile=dxnhdtv -o <output>

Convert mkv to xvid avi video

mencoder input.mkv -oac mp3lame -lameopts vbr=3 -ovc xvid -xvidencopts fixed_quant=4 -of avi -o output.avi

Join 2 video clips on linux

When you need to join two or more video clips to create one complete video.

Method 1

  # cat file1.avi file2.avi > file1_file2.avi
  # mencoder -forceidx -oac copy -ovc copy file1_file2.avi -o final_file.avi

Method 2

  # mencoder -oac copy -ovc copy file1 file2 file3 -o final_movie.mpg

Method 3

  # avimerge -i b1.avi b2.avi b3.avi b4.avi b5.avi b6.avi b7.avi -o bloodspell.avi

A detailed explanation of this can be found here

Decent Iptables front-end

I have never been a fan of iptables front ends preferring to work with the rules directly as it makes debugging easy, how ever i have come across a really great front end. So if you are in need of a great front end that is more than just an iptables config tool take a look at vuurmuur http://www.vuu

Postgresql tips

Options available with psql the postgresql client.

  • \du - lists all users
  • \l - list databases
  • \dp - lists privilages
  • \dt - lists tables
  • \di - lists indexes
  • \d [name] - describe an object
  • \df - list functions
  • \dc database - connect to a database.
  • \i filename - read commands from file
  • \o filename - send output to file

Postfix using gmail as a smarthost

Yes, you can use gmail as your smarthost with postfix, this is how you do it.

Add this to your postfix

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/gmail_passwd
smtp_sasl_type = cyrus
smtp_sasl_security_options = noanonymous
relayhost = []:587

Create the file /etc/postfix/gmail_passwd and add this


Create the hash db and restart postfix

# postmap /etc/postfix/gmail_passwd
# postfix reload

Thats it you are done postfix will now send mail via gmail's smtp servers

Concatenating (Merging) PDF files

# gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf 1.pdf 2.pdf 3.pdf

blog comments powered by Disqus