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
09.18.07
Posted in Technology at 3:22 am by iosakwe
Sun Galaxy introduces a new range of x64 hardware platforms. Its very different from the old Sparc architecture. This post serves as a reminder for me on how-to gather information from the Service Processor. (”->”: denotes SP prompt)
To view Serial Number, Ethernet Mac address: ” -> show /SYS/MB/ || -> show /SYS/MB/NET0″
To reboot either console or system: ” -> reset /SP || -> reset /SYS ”
To get in and out of the console: ” -> start /SP/console || -> ESC ( ”
To log into SP os: ” ssh sunservice@${SP_IPADDRESS} ”
To set IP_ADDRESS:
[->” cd /SP/network && set $value_pending=”$value” { gateway, ipdiscovery,ipnetmask, ipaddress } && “set commitpending=true”]
Permalink
09.07.07
Posted in NihonGo at 3:43 am by iosakwe
Japanese writing system contains of 3 types of characters: Hiragana, Katakana and Kanji.
Hiragana (ひらがな)- the most basic type, consisting of 47 characters, and is mainly used for function words, (at, in, on.. ) , original Japanese words and inflection enders (negatives, tense)
Katana (カタカナ) - Is used mainly for foreign imported words. That’s English, Portugese, French and so on. There also 47 of them. I call it the Japanese way of Japane-fying their word.. Once imported, though the meanings are retained, the pronunciation takes on a new life.
Kanji (かんじ) - These are imported words from China thousands of years ago. It’s like vocabulary, it never stops growing. Usually Japanese names are written in this form. You also find it mixed in with Hiragana. It is said that in order to read the newspaper, you need to master about 2500 Kanji.. ouch.. right now I am at like 30. Hopefully, this time next year, I know about 100 more. がんばります
Permalink
Posted in Random at 2:27 am by iosakwe
Oh well, the summer is over and now its back to school. This summer was fulfilling, I took Finance 3000 and learned about common stock, preferred stock, bond valuations and many other introductory concepts to finance. Upon completion, I traveled to Japan. It was a lovely trip, the food was absolutely delicious, ふとつていました, (I got fat?). The country side was stunning, lush green lakes, evergreen bamboo trees, sort of reminded me of the good old samurai scenes. Most of all, I got to meet my extend family - like I said, it was definitely fulfilling. OK, I strayed off track from the title, “Back to School” - As I have changed my major from CIS to QMM and now Mathematical Finance, I am in a fix? This semester I am taking:
Intermediate Japanese 3001, Math 3020 (Calculus 3) and Corporate Finance.
Of the 3 courses noted above, I am a bit worried about Calculus 3, as I took Cal 2 about 3 years ago. I am kind of rusty on integration, derivatives, trig functions.. so I really need to work extra hard to get up to speed. To aid my catch up process, I have removed all elements of distraction. My Mac Book Pro is sitting in my closet, battery out - I am not bringing it out until I feel much more comfy with Cal. 3. I also decided to limit weekend entertainments and hired a part time tutor. I am on a strict schedule to ‘catch-up’ and get rolling or else, its going to be a long semester. がんばります
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
08.26.07
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.
Permalink
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.
Permalink
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.
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
« Previous entries