[sourcecode language=bash]

rpm -q bind && yum -y install named

cat >/var/named/homelab</etc/named.conf

grep home.lab /etc/named.conf || cat >>/etc/named.conf </etc/resolv.conf<

Posted in Uncategorized | Leave a comment

farewell letter, the geeky way


#note the -1 option lawl
#@awesome_team_of_duane=`ls -1 /i1pb`;
@awesome_team_of_duane=`ls -1 /home`;

foreach (@awesome_team_of_duane)
        print "Hi $_ \n";
        print "It's been a pleasure working with you. I would like to take this time \n";
        print "to thank you and let you know how I've enjoyed working with you these \n";
        print "past few months. I wish you success in the future and am grateful for \n";
        print "opportunity to have worked with you.				     \n";

print "Special thanks to Duane for being an awesome manager and                      \n";
print 'to Jamie for being a wonderful team lead. Thumbs up for the both of you d(")b '."\n";

sub contact()
        print "You can reach me thru the following contact info below:          \n";
        print "        EMAIL=bofh\@philipmorales.net                            \n";
        print "        SITE=http://philipmorales.net                           \n";
        print "        LINKEDIN=http://linkedin.com/in/moralesphilip            \n";
        print "        PHONE=(numba goes here)                                        \n";

#this signifies the change of location/state
Posted in Uncategorized | Tagged , , | Leave a comment

my rig

CPU: AMD Phenom(tm) II X6 1090T Processor (core speed is OC’d to 4GHz)
MEMORY: G.SKILL Ripjaws Series 8GB (2x4GB)
GPU: BFG GeForce GTX 275 896MB
PNY Verto GeForce 9800 GT 1GB (used for Physx)
DISPLAY: 25″ Hanns G HZ251H
32″ Insignia™ Class / 1080p / 120Hz / LED-LCD HDTV
STORAGE: ADATA S596 Turbo (3x32GB) (RAID 0 configuration)
WD 500GB portable
KBOARD: Razer Lycosa
MOUSE: Razer Naga
PAD: Razer Sphex


To be modest, It’s mediocre compared to other enthusiasts’ rigs especially the hardcore ones but my hardware sufficces my computing needs. It’s mostly atm used for multimedia stuff, gaming and development(yes, i don’t always game and just watch stuff when in front of the computer =P).

Posted in Uncategorized | Tagged | Leave a comment

getting LUN IDs via the ‘format’ utility in Solaris

This one’s long overdue and it’s only now that I got to post it:

My team mate was doing server inventory for some DR exercise a month ago. One of his tasks was to jot down the LUN IDs. Like what he said, there are a lot of ways to determine the LUN ID. One way to do that would be to use the ‘format’ utility to determine the ID for nonSVC LUNs, in which I was also taught on how to do it. Having to manually check on each single SAN disk’s LUN ID is a very daunting task if done manually.

I got asked if I could code a script that would help in getting the task done faster and/or automate it. I thought it would be a good coding exercise. A shell script would have done the job, but perl is more fun. The script’s below, it’s actually pretty short compared to doing it in shell script:


#print out a label
print "DISK#\t DISKNAME\t\t\t LUNID\t\n";

#initially run 'format' so we can get a list of all the disks on the system and store
#its output to something we can referrence later
@i=`echo '' |format `;

#if you know what your local drive's names are you can "grep -v" 
#them e.g. replace the command above with:
#@i=`echo ''|format |grep -v SUN`;
#let's start parsing the output from the format utility command defined above(@a)

foreach (@i)
#only match lines that contain the disk numbers e.g.(2. 3. 4. 5. and so forth)
# 2. c3t50060E8003A8F808d1 <HITACHI-OPEN-E*36-SUN-2106 cyl 65533 alt 2 hd 60 sec 260>
# 3. c3t50060E8003A8F808d2 <HITACHI-OPEN-E*3-SUN-2106 cyl 59275 alt 2 hd 15 sec 96>
	if (/(\d){1,10}\./)
	     	#store the matched value to a variable so we can referrence it later
		$m = $1;                

                #run 'format' then select the disk number then run 'inquiry' against it 
                #to display detailed information about the disk
                #(if you're not being too lazy check the man pages man for format options)
                #the $1 variable below would be the disk number, which is a 'back referrence'
                #of [(\d)] above.
                @b=`echo  '$1\ninq' |format -M -s 2>&1 `;
                #determine the disk name and store to a variable e.g.
                #2. c3t50060E8003A8F808d1 <HITACHI-OPEN-E*36-SUN-2106 cyl 65533 alt 2 hd 60 sec 260>
                #3. c3t50060E8003A8F808d2 <HITACHI-OPEN-E*3-SUN-2106 cyl 59275 alt 2 hd 15 sec 96>      
                #looking from above number 2 would have "HITACHI-OPEN-E*36-SUN-2106" as its disk name
                #and "HITACHI-OPEN-E*3-SUN-2106" for disk 3.
                 /.*\<(.*) cyl.*\>/;
                $n = $1;

                foreach (@b)
                        if (/.*2114.*(\w{3})$/)
                        #this one is for HITACHI SAN luns having 2114 as their revision no.
                        #tries to match and parse this line for example:
                        #32 31 31 34 30 34 35 30 41 38 46 38 30 30 44 37     21140450A8F800D7
                        #the last 3 characters in the matching line above would be the lun id (0D7)
                                #print what was 'back referrenced' by perl [(\w{3}]
                                &printer;#call the printer() subroutine defined below
                        if (/.*3\.91(\w{3}).*/)
                        #this one's for IBM SANs that has 3.91 for their revision version
                        #tries to match and parse this line:
                        #33 2e 39 31 37 30 43 32 34 31 37 35 20 20 20 20     3.9170C24175
                        #the next 3 characters right after 3.91 would be the lun id
                                #print was was 'back referrenced' by perl [(\w{3})]
                        if (/.*\&\.\M\.(\w{4})/)
                        #matches EMC SYMMETRIX with 5670 revision. parsing the LUN ID for this is
                        #a bit different because the ID is on a different line. It tries to match 
                        #a similar line below('&.M.' is the pattern that we're looking for):
                        #26 00 4d 00 30 31 42 45 00 00 00 00 00 00 00 00     &.M.01BE........
                        #the LUN ID above would then be "01BE"
                                #print what was 'back referrenced' by perl [(\w{4})]

sub printer
        #$m = disk number
        #$n = disk name
        #$b = lun id
        $b = $1;
        print "$m\t $n\t $b\t \n";

finally, documented and posted. I spent a hefty amount of time trying to hack css stuff just so it’ll look well with syntax highlighter. this one’s for you Suri ;)


Posted in Uncategorized | Leave a comment


I used to play this game with colleagues back in the day, Hit me up if you wanna play a couple of rounds.


Posted in Uncategorized | Tagged | Leave a comment

done migrating to a new server

i just finished migrating my site to a new server provider and also considered purchasing a new domain for $4 click resources.99(how cheap is that?). i lost most of my old server data because of backup issues.

Posted in Uncategorized | Leave a comment

plesk tricks

supposed you needed to modify the dns information across all your existing domains. let’s say you want to add a nameserver that’ll be used by all your domains, you can do this:

for i in `cat /tmp/domains`;do ./dns -a $i -ns “” -nameserver ns100.domain.com;done

/tmp/domains – list of your domains
ns100.domain.com – dns server to be added
the “./dns” part refers to a php script located in plesk’s install folder, you can use it to modify dns entries for your domain/s.

Posted in Uncategorized | Tagged , , | Leave a comment

compile error while compiling perl module

didn’t get to document this properly, while i was compiling the sybase module for perl on solaris10 i encountered this error:

cc1: error: unrecognized option `-Wdeclaration-after-statement’

it turned out that the the compiler that came with sol10 OR the box had an outdated version of the gcc compiler. i’m so poor at documentation at times boooo. it turned out that the option “-Wdeclaration-after-statement” was only available on later version of gcc.
solution: installed the latest version of gcc for sol from sunfreeware.com

Posted in Uncategorized | Tagged , | Leave a comment

rpm -ql equiv in solaris?

pkgchk -l packagename |grep Pathname |awk ‘{print $2}’

Posted in Uncategorized | Tagged | Leave a comment

note for compiling qpopper

i’m going back to basics, we get pissed off when we’re trying to solve something we think is so easy to figure out. a word of advice on this, remember to go back to basics, read the docs at least more than once. i got used to installing and configuring rpm’d qpopper. I was compiling qpopper a few days ago and found something out the noobish way. I compiled it using the default configure settings, assuming that it would have support for TLS by default. Noob I was, then I got around that and again I found out that qpopper didn’t seem to be authenticating. I checked my pam settings, didn’t see anything there. I recompiled and disabled pam, thinking that it could be the culprit, no dice. And enabled debugging, still no cigar. I tried other things, it was making me look stupid in what I was doing. Then I discovered the holy grail, that fracking config option “–enable-specialauth” which lets you authenticate via /etc/shadow. For noob’s sake, said I have.

Lesson learned: just because you type fast and you already know stuff it doesn’t mean you will never get stumped and feel like a total noob.

update: Randall Gellens from Qualcomm did confirm(oct 5th 2010) this as a bug, here’s his comment from my old site(couldn’t restore all my web content from my old site):

“Turns out there was a bug in the ./configure script that failed to automatically set ‘–enable-specialauth’ even though it found getspnam(). The bug was only in version 4.0, not in 4.1. A fix for 4.0 has now been checked in.”

Posted in Uncategorized | Tagged | Leave a comment