Linux - DHCP Client Configuration (RedHat)
1. Check which DHCP client are you using is dhcpcd, dhclient or pump2. Remove /etc/resolv.conf file and touch a new /etc/resolv.conf
Or do a
cp /dev/null /etc/resolv.conf
3. Add an entry into /etc/sysconfig/network such that it looks as follows
NETWORKING=yes
HOSTNAME=k5rec
DHCP_HOSTNAME=k5rec
where k5rec is the new hostname
4. In case you are using dhclient, do the setup as follows
Remove dhclient-eth0.leases file, which mostly resides under /var/lib/dhcp
where eth0 is the interface name.
5. In case you are using dhcpcd/pump
- Edit /sbin/ifup script
- See if the call to dhcpcd and pump include a -h $HOSTNAME switch. If they do not, add them, so the calls looks as follows
/sbin/dhcpcd -i $DEVICE -h $HOSTNAMEor
/sbin/pump –i $DEVICE -h $HOSTNAME
6. Remove un-neccessary entries from /etc/hosts such that it looks like
127.0.0.1 localhost localhost.localdomain
7. Restart the network service
/etc/init.d/network restartor
service restart network
8. Check the IP Address using ifconfig
9. Do a nslookup to see whether the IP points to the new hostname.
eg.
nslookup 155.123.33.23
It should be pointing to the new hostname.
Posted by - at 8/28/2006 01:24:00 AM | 0 comments read on
Puzzle - Blind and 26 Coins
Q. You are blindfolded and are presented with a collection of coins on a table. You are told that exactly 26 coins show heads.How can you divide all the coins into two sets, with the same number of coins showing heads in each set? You cannot distinguish, by sight or by touch, which coins are showing heads or tails.Select 26 coins at random to be one pile (or in general, select a number equal to the number of coins specified showing heads), and simply turn the coins in that pile over. Call all remaining coins the second pile. The two piles now have the same number of coins showing heads. Many people doubt that the solution is this simple.
Posted by - at 8/22/2006 12:06:00 PM | 0 comments read on
Puzzle - Why are manhole covers circular?
Q. Why are manhole covers circular?1. Circular manhole cover doesn't fall into the manhole shaft.
2. Less Area
3. Doesn't need to aligned or oriented
Posted by - at 8/22/2006 11:41:00 AM | 0 comments read on
C Programming - Max Sum
You have an array of n nonzero numbers. The array is randomly filled with positive and negative numbers.Write an algorithm/program to find 2 such indexes in the array, so as the sum of the numbers between these indexes is the maximum.
For e.g. if the array is
10, -20, 9, 8, 3, -12, 6, 3, 4, 1, -5, 3, -1
Then the indexes would be 2 and 9, the sum is 9 + 8 + 3 + -12 + 6 + 3 + 4 + 1 =22
At first glance it might look that the correct answer is 2 and 4, the sum is 9 + 8 + 3 =20
And if u r thinking that if we sum up all, then the sum is 10 + -20 + 9 + 8 + 3 + -12 + 6 + 3 + 4 + 1 + -5 + 3 + -1 = 9.
In some cases it might turn out to be the right one, but not always.
Solution:
#define LIST 10, -20, 9, 8, 3, -12, 6, 3, 4, 1, -5, 3, -1
#define LIST -5, -2, -1
#define LIST -5, -2, 0
int main()
{
int nArray[]={LIST};
int nMax,nTempMax,i;
int nStartIndex=0, nStopIndex=0,nSIndex=0;
nMax=nTempMax=nArray[0];
for(i=1;i < sizeof(nArray)/sizeof(int);i++) {
(nTempMax +nArray[i] > 0) ? (nTempMax +=nArray[i]) : (nSIndex= i, nTempMax =nArray[i]);
(nMax < nTempMax ) ? (nMax = nTempMax, nStartIndex = nSIndex, nStopIndex = i) : 0;
}
printf("Start: %d, Stop: %d Max: %d\n",nStartIndex+1,nStopIndex+1,nMax);
}
Posted by - at 8/03/2006 01:01:00 AM | 1 comments read on
C Programming - Shellcode Writing Part 1 (NO AUDIO)

ShellCode writing (without trimming null).
Reference: Smashing The Stack For Fun And Profit
Download - Video File
Posted by - at 8/03/2006 12:59:00 AM | 0 comments read on