For my documentation. Here is the command line parameters, I used to convert a video file in mpg format to flv (flash video) format using ffmped (open source format converter)
Adding the following options to the [Global] section in the samba (open source software providing windows compatible file sharing for *nix operating systems) will most likely speed your throughput
There are a ton of scripts to find how many IP addresses  are configured on a system, but I could not find one, whic would show me which particular network interface an IP address was configured on. Here is a one liner, that will give you this information in Linux
The same script can be changes a bit to support other operating systems too. Essentially, I am doing a grep (search) of the output of ifconfig, which shows all the network information on the system for a particular IP. At the same time, I am using the -B1 option, which will show the line above the matching line. Finally, I am piping this to awk and printing the first row in the first column.
Say you need to sudo as a particular user and run a command and at the same time you need to pass an environmental variable to the command, you can do it by passing the command in doublequotes.
For example, I want to start Oracle while I am logged in as another user (vinay), I can start the database using dbstart by issues
"sudo su - oracle -c "dbstart /$ORACLE_HOME"
$ORACLE_HOME is an environmental variable listed under user oracle’s environment.
Needless to say, you need to ensure that you have sudo configured to allow your userID to su to oracle.
I ran into a challenge at work, where we had to allow e-mail delivery for certain domains, but block all other domains. But at the same time, we had to ensure that the clients sending e-mails did not get a delivery error. We were using Postfix as the MTA running on Redhat Linux. Here’s how I resolved it
Edit the main.cf file (the default location is in /etc/postfix) and add “transport_maps = hash:/etc/postfix/transport” (without the quotes) to the file.
Create a file named “transport” in /etc/postfix, if it doesn’t exist
Add the following at the end of the transport file
DOMAIN1 :
DOMAIN2 :
* discard:
Run “postmap /etc/transport” to create a hash of the transport file
Run “service postfix restart” to restart the postfix service
This configuraiton will ensure that all e-mails address to DOMAIN1 and DOMAIN2 are delivered normally, but the rest of the e-mails are silently discarded.
Note : Ensure that you follow the syntax for where to place the : verbatim.
I ran into a challenge recently, when I tried to connect to my IM services (Yahoo, MSN, AOL, GTalk) using Pidgin in a secured network. For some reason, the network administrator thought that he/she should make life hell for people trying to log into IM. I will have a whole new rant about companies trying to lock down networks thinking they are making the employees productive..
Most people might not be aware, but a typical SSH client can act as a SOCKS proxy. So I decided to leverage this functionality.
You will need access to a SSH server and Putty (Opensource Windows SSH client)
Launch Putty
Setup a new server connection profile. I used FREE_MY_IP as the profile name in this screen shot, but you can name it anything you want
Expand the SSH option in the left column and click on Tunnels
Choose any port higher than 1024 as source port (unless you are running some kind of server software on your workstation, it is safe to use any port above 8000) and enter the SSH server in the Destination field. Then choose the “Dynamic” option and click on Add.. the screen shot below shows the options I used
The tunnel will show up as below
Click on Open and establish the SSH tunnel
Configure Pidgin (open source IM client) to use the SOCKS proxy
Launch Pidgin
Click on Tools -> Preferences in the menu
Click on the network tab
Choose SOCKS4 as the proxy type and enter localhost in the host field. In the port field enter the port you selected when setting up the tunnel in Putty.
Connect to your IM services.. chat away and be unproductive 🙂
Ever run into a situation when you thought you had sudo rights on a machine and tried to issue the sudo command and upon finding that you don’t have them..get your name added to the sudoers list by begging the sysadmin.. and then frusrated when sudo keeps throwing an error that you are not part of the sudoers list? Hmm.. that is a long sentance :)..
To expire any cached security permissions, so that sudo is forced to check the sudoers files, issue the following command
Nothing fancy.. but here is a simple perl script to open a file, search for specific content in the a line and replace it with some other content.
open (SOURCE, "< source.xml")
or die "Could not open file source.xml: $!\n";
open (DESTINATION, ">modfile.xml")
or die "Could not open file modfile.xml: $!\n";
while (defined($line =)) {
if ($line =~ m/YYYYYYYY/i) {
$line = "XXXXXXXXXXXXXXXXXXX\n";
}
print DESTINATION "$line";
}
close (SOURCE);
close (DESTINATION);
You are opening a file named source.xml, reading every line and if there is some text that matches “YYYYYYYY”, you are replacing the whole line with “XXXXXXXXXXXXXXXXXXX”. I am sure there are more elegant ways to write this :).. but this will do the trick too..