08.28.07

ShowSwap.pl

Posted in Work at 4:16 am by iosakwe

One of our business units wanted to make sure that “memory == swap” on a multitude of machines, and yours truly was tasked with this project. I wrote up a quick Perl script to gather this information. This supports swap files as well. Please feel free to improve on it.

#!/usr/bin/env perl

$hostname=`hostname`;
open SWAP, “/usr/sbin/swap -l | ” or die “Err: $!\n”;
open MEM, “/usr/sbin/prtconf |” or die “Err: $!\n”;
$count = 0;
while () {
next unless /^\// ;
$count++ ;
/\S+\s+\S+\s+\S+\s+(\S+).*/;
$swap{$count++} += $1*512/1024/1024
}
close (SWAP);
while ( ($k,$v) = each %swap) {
$swapSize += $v ;
}
while () { /\w+\:\s+(\S+)/; $size = $1 }

sub linez {
@hmm = (split(//,$hostname));
printf “-” x scalar(@hmm) . “\n”;
}

&linez;
printf “$hostname” ;
&linez;
printf “Memory size: $size MB\n”;
printf “Swap size: %.0f MB\n”, $swapSize ;

08.26.07

They know nothing!

Posted in Finance at 8:33 am by iosakwe

This is really a funny one, Jim Kramer, host of Mad Money, broke it down over the FED reaction to the subprime crisis.

Order types.

Posted in Finance at 5:56 am by iosakwe

When buying or selling securities, an order needs to be placed facilitate process. There are 4 ways this can be accomplished.

Good-Till: 3 types, good-till-(time,date,cancelled), means the order is valid until you either cancel or the time frame expires.

Limit: You place specify how much you are willing to sell or buy, remains in effect until period of time expires.

Market: Once your request hits the market, buy or sell at the current best price.

Stop: Only execute a buy or sell once the security surpasses a particular price point.

Lazy approach to dealing with class C “CIDR” only ?

Posted in Technology at 5:25 am by iosakwe

CIDR ,”Classless Inter-Domain Routing”, was introduced to as a solution to the problem of decreasing IPV4 addresses and simplification of our inter-domain routing. It’s generally written as either x.x.x.x/n or /n, (n=cidr, x=each 8 bit internet address). There’s a wealth of information out on the net for further reading, but this post just summarizes how to derive a class C netmask and number of hosts from /n.

Let’s take /24, a common class C network, if we wanted to find how many hosts and netmask of these CIDR.

(1.) Since IPV4 is practically a 32-bit address, we will subtract 32-24 = 8 bits.

(2.) 2^8 = 256 hosts

(3.) To determine the netmask, 256-256 = 0 , 255.255.255.0

Lets try this for /25, 32-25 = 7 , 2^7 = 128 hosts, and mask will be 128/256 = 1/2, therefore 256-128 = 255.255.255.128. Another example with /23, 32-23=9, 2^9=512. 512/256=2, so that means that 256-256 = 0, the next left most octet will represent 256-2, 254, thus 255.255.254.0.

I must say that this is an unorthodox way of deriving these numbers, the proven method of solving this is to convert to binary and compute.