01.13.08
Posted in Work at 11:38 pm by iosakwe
Perl is great for file processing and as I write more code with it, i constantly find new things that I would like to do. The other day I was trying to process a file with fixed number of lines and here’s what I prototyped. Please feel free to improve on it. I am always game for enhancements.
Here’s the file to process. I want to grab 3 lines and place them in one line.
#!/usr/bin/perl
open F, outt ;
@file=<F>;
$n=0; $e=3;
for (@file) {
($x,$y,$z) = @file[$n..$e];
$x =~ s/\n//; $y =~ s/\n//; $z =~ s/\n//;
last if (!defined($x)) ;
print “LINE: \$y-[$y];\$x-[$x];\$z-[$z]\n”;
$n+=3; $e+=3;
}
[iosakwe@MackSTA]-0-[Sun Jan 13,06:37 PM]
<~/tmp> $ cat outt
adm-as01.ny.itginc.com
SunOS
root:BeYwy678Hg0xk:::::::
adm-as02.ny.itginc.com
SunOS
root:Aon/giarB00vM:6445::::::
adm-as03.ny.itginc.com
Linux
root:BeYwy678Hg0xk:12598:0:99999:7:::
[iosakwe@MackSTA]-0-[Sun Jan 13,06:37 PM]
<~/tmp> $ perl p.pl
LINE: $y-[SunOS];$x-[adm-as01.ny.itginc.com];$z-[root:BeYwy678Hg0xk:::::::]
LINE: $y-[SunOS];$x-[adm-as02.ny.itginc.com];$z-[root:Aon/giarB00vM:6445::::::]
LINE: $y-[Linux];$x-[adm-as03.ny.itginc.com];$z-[root:BeYwy678Hg0xk:12598:0:99999:7:::]
Permalink
08.28.07
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 ;
Permalink
06.04.07
Posted in Work at 4:18 am by iosakwe
As the market becomes more Algo-based, here are some strategies that currently out in the market.
1. VWAP (Volume Weighted Average Pricing): This executes a buy order in a stock as close as possible to its historical trading volume in an effort to reduce the trade’s impact on the market. It is calculated by “($total_number_of_shares * $price)/$shares_traded_for_the_day”, so generally if $share_price < $vwap, its a deal, so the algo will execute a buy.
2. TWAP (Time Weighted Average Price): It trades based on the clock, allowing a trades to be sliced up over time. Good for illiquid stocks where volume analysis makes little sense.
3. Participation Strategies: this model trades on momentum. If there’s a particular interest in a stock, this algo will trade more aggressively and if there’s less trading going on, it will execute accordingly. Good for momentum traders, follow the money kind of trading. .
4. Guerrilla: This model was developed by CSFB that works orders without signaling the presence of a buyer or seller to the marketplace by slicing up big orders into smaller low key sizes. Credit Suisse’s AES (Advanced Execution Services) describes it as “using a variety of trading techniques to disguise its trail”.
5. Sniper: Another Algo from CSFB that will trade aggressively until it either completes or reaches arn investor’s limit price.
6. Sniffers: This is used to sniff out algo trading used by others. Its technique is aimed to find out other software that are trading and either work with or trade against them.
7. Dark Pools of Liquidity: private trading networks that don’t post prices. The buyers and sellers remain anonymous until trades are executed. It dissects brokers’ order books looking for better prices than are available on the exchanges or public trading networks. It will only record the trade after its been privately done.
Permalink
05.10.07
Posted in Work at 11:37 pm by iosakwe
So as I have been focusing on Systems Administration in the past years, the current that propelled my stream of passion to embrace technology is running dry. Its becoming more and more mundane, build a server to standards, hand it over to Developers or Application folks who design it to match a business logic which morphs into a product that is either generating revenue or calibrating analytics. I guess that infrastructure work exists to initialize the processing of raw material. I detest the notion of not knowing the specifics of what purpose the application serves, especially if I built the server. I am now interested in being closer to the final product, the business as some say, further down the value chain instead of at the beginning. In light of this, I am considering switching my major to Quantitative Methods and Modeling from Computer Information Systems. Incidently ,to my vantage point, Baruch University has a policy mandating all undergrads to complete liberal and business requisites before stabbing at your major. This affords me to divert majors without sacrificing any credits — sweet. “Who moved my cheese” advocates welcoming change with open arms and past experience also thought me the same, but that’s another blog. The short end of this babble is that I don’t want to be another ignorant IT chap. Being technically sound, its time to I understand the industry that employs me, diversify my experience and contribute to solving complex business agendas - not just routine actions. You can say I got inspired by working for a mid size leader in Algorithm Trading; furthermore, financial markets aren’t what they used to be and with regulations like Reg NMS, the industry is reshaping. As I embark on this path to QMM, I hope it will avail me to new opportunities. I very aware that this is not walk in the park but more like a hurricane however I will just have to weather it. The discipline basically comprises of Financial Mathematics, Algorithms, Statistics, Mathlab, R, S and SAS Programming. I have lots to learn but then again, the adage says ‘little by little is how you eat hot soup’. I recall telling a mentor back at Merrill Lynch that, “I am on a mission” and he called me “mission man” - indeed, that I am.
Permalink
11.28.06
Posted in Work at 5:08 pm by iosakwe
So following up on Part 1, we actually know a little bit more about LDAP now, but in this post, we will include an Automounted home directory. Before we delve into the notes, I just want to cover some essentials. In LDAP vernacular, A schema is a collection of object classes and attributes that define your entry. In Posix standard, a user account entry must have certain characteristics such as a shell, uid, gid,.. In this case, the attribute “shell -> /bin/bash” will be provided by the “objectclass: posixAccount”, ,while the attribute “userPassword: -> xxxxx” will be stored in the objectclass shadowAccount. This can be applicable to any entries you want to store in your directory, such as People, hosts, groups, netgroups, printers, etc. These are usually stored in a hierachical form of . See Getting Started for more details.
1.) So we are going to setup a directory server and add a user account.
Permalink
02.23.06
Posted in Work at 5:54 am by iosakwe
In my environment, we have about 400+ Sun servers, mostly Sun fires that range from v210s to 15k domains.Managing these servers individually could be an nightmare, especially for user, device and host management.. Can you imagine, editting >400 servers just to add a user.. Oucch! In order to streamline such processes, a reliable and robust method to attaining such tasks was necessary, which brings us to the meat of this discussion.
For the past couple of months, I have been designing an infrastructure that will scale reliability to meet our needs, henceforth. For naming services, we chose LDAP because it’s much more flexible, extensible (most ISV’s have builtin API support), better security model and built-in replication framework. Most establishments that i worked at such as Morgan Stanley and ML, NIS was the name service of choice but these environments were built many years ago when LDAP was not even ratified. Some even incorporated kerberos to get over the security setback in NIS. LDAP, on the other hand, is ideal for newer shops that just building out an Infrastructure from scratch and even those mature environments that currently rely on the Yellow Pages (NIS). One of many attributes of LDAP over NIS is the replication mechanism. In NIS, when the master makes a change, the slaves need to explicity pull the specific map or the server pushes the entire database. In other words, if you add a new user, you need to update at least 3 maps, password, shadow and netgroup. To add insult to injury you need to make sure the slaves are aware, say you have a password database of over ~100000 users, that means you are pushing the same database that already exists on the slave just to update one attribute. This can costly because of the load on the network especially during business hours. One solution I saw to this was to store the changes in a database that gets propagated to the clients during off hours. While this was an ideal solution, it had limitations. If you needed to build a new server or add a new user, you needed to wait until the 24 hours for the user to be globally defined. LDAP, unlike NIS, will replicate only the deltas thus minimizing the load of flooding your production network to update one attribute . Another cool feature of LDAP, based on the x.500 uses a hierachy name space whereas NIS uses flat based name space. Extended security framework (ACL) that can applied down to the attribute level via aci (access control instructions). Lastly, Sun One Directory 5.2 allows you to have 4 multi-master servers now. This boosts service availability because password updates, syncs, new attributes, etc.. can be applied virtually any one of the RW (read write) Replicas even 3 masters are down.
These are just some of the nice features about LDAP, there are many more than the minute points i mentioned here. Stay tuned for my follow up to HA computing.
Permalink