Bash Script to create automatic FTP session and download file

This script automatically opens a FTP session and downloads file to local disk. Here is the scenario:
ftp: myftp.ext
username: myusername
password: mypassword
file to download: myfile.txt
1) Create bash script automatic_ftp_download.sh:
#!/bin/bash
# Script to create automatic FTP session and download file
ftp -n myftp.ext << end
us myusername mypassword
get myfile.txt
bye
end
2) make automatic_ftp_download.sh script executable:
chmod +x automatic_ftp_download.sh
3) run automatic_ftp_download.sh scrip:
./automatic_ftp_download.sh
4) find myfile.txt [...]

Rip / backup / copy dvd to avi mpeg4 format with linux mencoder

1)
First identify the chapter which you would like to rip to avi mpeg4 format. Usually it is the biggest file on the dvd with extension *.vob . Other option is to use:
mplayer -identify -nosound -novideo dvd://
2)
Get and covert sound to mp3:
mencoder -oac mp3lame -lameopts br=96:cbr:vol=6 -ovc frameno -o dvdrip.avi dvd://1
3)
Get video:
run this command for [...]

Match / validate an email address with Perl regex ( regular expression )

Match or validate an email address with perl regex ( regular expression )
This perl script shows how to validate an email address using perl and regular expression ( regex ).
#!/usr/bin/perl
@email = (“email\@address”,”email\@address.email”,
“\@address.email”,”address.email\@email”, “validate\@email.address”);
foreach (@email) {
if (/^[A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{2,4}$/) {
print “$_\n”;
}
}
Result:
email@address.email
validate@email.address

Zenity progress pulsate bar dialog example

Here is an example of Zenity progress pulsate bar dialog. Depending on your desktop manager your output may be different:
yes | zenity –progress –width 350 –pulsate –text “Testing Zenity Progress Bar” –title “Zenity Pulsate Progress Bar”

PHP Redirect HTTP/1.1 301 Moved Permanently index.php script

To create permanent redirect with php is very easy task. All what needs to be done is the create file index.php in your root directory of the site which you want to redirect from with following content:
<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.yoursitetoredirect.com” );
?>
Here you can test your php  301 Moved Permanently redirect.

Remove white space from file name and rename it with bash command

Some Linux tools does not properly work with files which include spaces in their names. This simple bash for loop will remove white space from file names and rename/move for all files in the given directory.
First enter directory with cd:
cd /my/directory
and then run:
for f in *; do mv “$f” `echo $f | tr ‘ ‘ [...]

Debian /etc/apt/sources.list Australia apt-get mirrors / repositories list

Main debian Australia’s mirrors / repositories. Note that you do not need to include all repositories. Moreover use http or ftp not both to avoid Duplicate sources.list entry.
This list is for etch but you may change it to any other debian release. To change it to lenny change “etch” to “lenny”. You can also [...]

Convert from mp3 to ogg and from ogg to mp3 format with soundconvert

First install soundconvert linux package. This allows you to convert between ogg and mp3 sound media formats. On debian or ubuntu simply:
apt-get install soundconvert
to convert from ogg format to mp3 format use command:
soundconvert.pl -o mp3 mediamusic.ogg
to convert from mp3 format to ogg format use command:
soundconvert.pl -o ogg mediamusic.mp3
If you wish to convert all files [...]