Posted on January 31, 2008 by linuxconfig
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 [...]
Filed under: Administration, Bash, Linux, Networks | Tagged: automate, automatic, Bash, download, file, ftp, Linux, script, session | Leave a Comment »
Posted on January 15, 2008 by linuxconfig
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 [...]
Filed under: Commands, Linux | Tagged: avi, backup, command, copy, dvd, format, Linux, mencoder, mpeg4, rip | Leave a Comment »
Posted on January 15, 2008 by linuxconfig
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
Filed under: Linux, Perl, Programming | Tagged: email address, match, Perl, regex, regular expression, validate | Leave a Comment »
Posted on January 10, 2008 by linuxconfig
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”
Filed under: GNOME, Linux | Tagged: dialog, example, gui, Linux, progress bar, pulsate, zenity | Leave a Comment »
Posted on January 7, 2008 by linuxconfig
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.
Filed under: Programming | Tagged: 301, Moved Permanently, php, redirect, script | Leave a Comment »
Posted on January 4, 2008 by linuxconfig
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 ‘ ‘ [...]
Filed under: Administration, Linux | Tagged: Bash, command, directory, file, Linux, name, remove white space, whole | 4 Comments »
Posted on January 4, 2008 by linuxconfig
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 [...]
Filed under: Administration, Debian, Linux | Tagged: /etc/apt/sources.list, apt, australia, list, mirror, packages, repositories | 1 Comment »
Posted on January 3, 2008 by linuxconfig
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 [...]
Filed under: Commands, Linux, Perl | Tagged: convert, format, from, Linux, mp3, music, ogg, sound, soundconvert, to | 5 Comments »