October 2009 Archives

iSCSI Initiator for Mac OS X

| 0 Comments

Download globalSAN


Perl Broken Pipe

| 0 Comments

The code was producing "Broken Pipe" errors intermittently. The only workaround I could figure out was to ignore the sigpipe.

$SIG{PIPE} = 'IGNORE';

Removing Whitespace using Perl

| 0 Comments
$whitespace_beginning_of_string =~ ( s/^\s+// );
$whitespace_ending_of_string  =~ ( s/\s+$// );

Sending Complimentary Test Fax

| 0 Comments

If you need to send a test fax to your fax machine. Use faxzero.com to send a complimentary fax.

List Process Bound to a Port

| 0 Comments
lsof -i :
Example:

[root@example ~]# lsof -i :993
COMMAND    PID    USER   FD   TYPE DEVICE SIZE NODE NAME
rpc.statd 1659 rpcuser    7u  IPv4   4691       TCP *:imaps (LISTEN)

Slingbox PRO-HD Slingplayer Encoding Settings

| 0 Comments

Slingbox PRO-HD Slingplayer Encoding Settings

Video bit rate:        4800
Video frames:   Full Rate
i-Frame interval:       5
Audio bit rate: 64
Video resolution:       640x480
Video smoothness:       Sharper

Useful Netbackup Client Commands

| 0 Comments
# LIST ALL CLIENTS
/usr/openv/netbackup/bin/admincmd/bpplclients 

# LIST WHAT IS BACKED UP ON THE CLIENT 
/opt/openv/netbackup/bin/admincmd/bppllist -L -byclient ${1} | grep Include: | awk '{print $2}'

# LIST CLIENT TYPE /opt/openv/netbackup/bin/admincmd/bppllist -L -byclient ${1} | \
        | grep "Client/HW/OS/Pri:" | awk '{print $3"\t"$4}' | uniq

# SHOW BACKUP SCHEDULE FOR ALL CLIENTS BY DATE
/opt/openv/netbackup/bin/admincmd/nbpemreq -predict -date MM/DD/YYYY 

# SHOW BACKUP SCHEDULE FOR SPECIFIC CLIENT BY DATE
/opt/openv/netbackup/bin/admincmd/nbpemreq -predict -date MM/DD/YYYY -client_filter client-hostname


Note: NDMP displays HW/OS       "NDMP NDMP"
Note: Solaris displays HW/OS    "Solaris Solaris10"

Cisco Terminal Output

| 0 Comments

Setting the number of lines for either Cisco ASA/PIX or IOS devices can be done as follows.

ASA/PIX:
Set to 23 lines - pager 23 (default)
Disable/Do not stop - no pager

IOS: Set to 23 lines - length 23 Disable/Do not stop - length 0


Example for IOS:
ios(config)#line console 0 
ios(config-line)#length 0
ios(config-line)#^Z
ios(config)#line vty 0 4
ios(config-line)#length 0
ios(config-line)#^Z

NetApp (Toasters) Mailing List

| 0 Comments

There is a very cool unofficial NetApp Mailing list, its called toasters. Subscribe by sending an email to lists@mathworks.com. Be sure to include "subscribe toasters" in the body of the email.

Updating the password for a MovableType user from MySQL

| 0 Comments

# mysql -u root -p SOMETHING
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| movabletype        | 
| mysql              | 
+--------------------+
2 rows in set (0.01 sec)

mysql> use movabletype
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select author_name, author_id from mt_author;
+-------------+-----------+
| author_name | author_id |
+-------------+-----------+
| admin       |         1 | 
+-------------+-----------+
1 row in set (0.00 sec)

mysql> update mt_author set author_password = encrypt('admin') where author_id = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> quit
Bye

Cable Modem Diagnostic Page

| 0 Comments
Recently discovered a interesting diagnostics page for my cable modem.
http://192.168.100.1

Generating Self Signed Certificate using genkey

| 0 Comments
yum install crypto-utils -y
genkey --days 365 mail.example.com

Generating Self Signed Certificate

| 0 Comments
# mkdir selfcert
# cd selfcert

# openssl genrsa -out ca.key 1024
Generating RSA private key, 1024 bit long modulus
.........................++++++
..................++++++
e is 65537 (0x10001)

# openssl req -new -key ca.key -out ca.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:New York
Locality Name (eg, city) [Newbury]:New York
Organization Name (eg, company) [My Company Ltd]:Example
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:cert.example.com
Email Address []:support@example.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
subject=/C=US/ST=New York/L=New York/O=Example/CN=cert.example.com/emailAddress=support@example.com
Getting Private key

# ls
ca.crt  ca.csr  ca.key

Changing the Title in Terminal on Mac

| 0 Comments
Using the example from Mac OS X for Unix Geeks 4th Edition, I added the following to my .bash_profile.
function title ( )
{
        case $TERM in
                *term | xterm-color | rxvt | vt100 | gnome* )
                echo -n -e "\033]0; $* \007" ;;
                *) ;;
        esac
}
Now, I can set the title on each Terminal via CLI. 
If needed I can always use the GUI by hitting SHIFT-CMD-I.

Using Perl to count the characters of string

| 0 Comments
#!/usr/bin/perl

my $string = "abcdefg";
my $count  = length ( $string );

print "Total characters: $count \n";

Configuring HSRP on Cisco IOS Routers

| 0 Comments
On Router #2
int f0/0
ip address 192.168.0.2 255.255.255.0
standby 1 ip 192.168.0.1
standby 1 preempt
standby 1 priority 110
standby 1 authentication STRING
standby 1 timers 3 10
standby 1 track f0/1
On Router #3
int f0/0
ip address 192.168.0.3 255.255.255.0
standby 1 ip 192.168.0.1
standby 1 preempt
standby 1 priority 100
standby 1 authentication STRING
standby 1 timers 3 10
standby 1 track f0/1

Configuring MAC Filtering for Cisco Access Point

| 0 Comments
access-list 700 permit AAAA.BBBB.CCCC   0000.0000.0000
dot11 association mac-list 700
show dot11 associations all-client

All About Roses

| 0 Comments

Single bloom red Rose – Love at first sight or I still love you
Single Rose, any color – Gratitude or simplicity
2 Roses – Mutual feelings
3 Roses – I love you
7 Roses – I’m infatuated with you
9 Roses – We’ll be together forever
10 Roses – You are perfect
11 Roses – You are my treasured one
12 Roses – Be mine
13 Roses – Friends forever
15 Roses – I’m truly sorry
20 Roses – I’m truly sincere towards you
21 Roses – I’m dedicated to you
24 Roses – Forever yours
25 Roses – Congratulations
50 Roses – Unconditional love
99 Roses – I will love you all the days of my life
108 Roses – Will you marry me?
999 Roses – I love you till the end of time

Downloading the latest firmware from Raidon for Stardom NAS

| 0 Comments

Dig up the following login information for downloading the latest firmware from Raidon.

Site: ftp.raidon.com.tw
Path: /ide4/support/Raidon_Product/SL36xx-2S-LB2/

Username: cust1

Password: 0001

Adding Additional Software on the Raidon NAS

| 0 Comments
Adding additional software on to Raidon NAS.
Syntax:
ar p mypackage.deb data.tar.gz | tar zx
via NFS Client:
mkdir /Volumes/public/new_root
cd /Volumes/public/new_root
ar p ../pkg_for_new_root/working/lsof_4.78.dfsg.1-4_arm.deb data.tar.gz | tar xvz
ar p ../pkg_for_new_root/working/rsync_3.0.3-2_arm.deb data.tar.gz | tar xvz
ar p ../pkg_for_new_root/working/libpopt0_1.14-4_arm.deb data.tar.gz | tar xvz
ar p ../pkg_for_new_root/working/libacl1_2.2.47-2_arm.deb data.tar.gz | tar xvz
ar p ../pkg_for_new_root/working/libattr1_2.4.32-1_arm.deb data.tar.gz | tar xvz
ar p ../pkg_for_new_root/unknown/coreutils_6.10-6_arm.deb data.tar.gz | tar xvz

via root on NAS:
cd /lib
ln -s /mnt/md1/public/new_root/lib/libacl.so.1.1.0 libacl.so.1
ln -s /mnt/md1/public/new_root/lib/libpopt.so.0.0.0 libpopt.so.0
ln -s /mnt/md1/public/new_root/lib/libattr.so.1.1.0 libattr.so.1
# installs via rsync from new_root
/mnt/md1/public/new_root/usr/bin/rsync -av --stats --progress /mnt/md1/public/new_root/* /.

via root on NAS:
cp /mnt/md1/public/new_root/usr/bin/tail /usr/bin/.
cp /mnt/md1/public/new_root/usr/bin/wc /usr/bin/.
cp /mnt/md1/public/new_root/usr/bin/env /usr/bin/.
cp /mnt/md1/public/new_root/usr/bin/sort /usr/bin/.
cp /mnt/md1/public/new_root/usr/bin/who /usr/bin/.

Applications for the Mac

| 0 Comments

Applications on the Mac

  • Billable
  • Quicktime Professional
  • OmniGraffle Professional
  • OmniPlan
  • OmniGraphSketcher
  • OmniOutliner Professional
  • VMware Fusion
  • Windows XP Professional
  • Newsrover
  • Macports
  • Apple iLife
  • Apple iPhoto
  • Apple iMovie
  • Apple iDVD
  • Apple iWeb
  • Apple Xcode
  • Apple iWork
  • Apple Keynote
  • Apple Numbers
  • Apple Pages
  • Apple Remote Desktop
  • Microsoft Remote Desktop Connection
  • Flip4Mac
  • Perian
  • Firefox
  • ecto
  • Little Snitch
  • Adobe Creative Suite
  • X-Lite
  • Skype
  • Handbrake
  • iSquint
  • VideoMonkey
  • Paparazzi
  • Teleport
  • Growl
  • Subversion
  • Hellanzb
  • SuperDuper!
  • Carbon Copy Cloner
  • Chicken of the VNC
  • Coda
  • Textmate
  • xPad
  • OmniDazzle
  • Apple Terminal
  • Chmox
  • Cocoa Cookies
  • Cocalicious
  • Slingplayer
  • Rosetta Stone
  • Oracle SQLDeveloper
  • Oracle sqlplus
  • SQLite Database Browser

Tuning TCP/IP on Mac

| 0 Comments
Some notes on tuning TCP/IP on the Mac.
Hack:
sysctl -w net.inet.tcp.delayed_ack=0
sysctl -w net.inet.tcp.recvspace=65536
sysctl -w net.inet.udp.recvspace=73728

New Hack:
sysctl -w net.inet.tcp.delayed_ack=0
sysctl -w net.inet.tcp.sendspace=32000000
sysctl -w net.inet.tcp.recvspace=32000000
sysctl -w kern.ipc.maxsockbuf=64000000
sysctl -w net.inet.tcp.win_scale_factor=8
# gigabit jumbo frames
sysctl -w net.inet.tcp.mssdflt=8940
# 100 megabit and wifi
sysctl -w net.inet.tcp.mssdflt=1440

Original:
sysctl -w net.inet.tcp.delayed_ack=3
sysctl -w net.inet.tcp.recvspace=48000
sysctl -w net.inet.tcp.sendspace=65536
sysctl -w net.inet.udp.recvspace=42080
sysctl -w kern.ipc.maxsockbuf=8388608
sysctl -w net.inet.tcp.mssdflt=512
sysctl -w net.inet.tcp.win_scale_factor=3

Sun Directory Server Replication Monitoring

| 0 Comments
The following is from the Sun ONE Directory documentation. Syntax examples are below as well.

Sun ONE Directory Server 5.2 provides replication monitoring tools that allow you to monitor replication between servers. B eing able to monitor replication activity assists in identifying the causes of replication problems and troubleshooting. All of the Directory Server replication monitoring tools can be used when LDAPS is turned on.

The three replication monitoring tools are:
• insync
• entrycmp
• repldisc


For more information regarding these replication monitoring tools, refer to the Replication Monitoring Tools section of the Sun ONE Directory Server Reference Manual and for more information on the monitoring possibilities afforded to you by certain replication attributes, see the replication attributes in the Core Server Configuration Attributes chapter of the Sun ONE Directory Server Reference Manual.

entrycmp
The entrycmp tool compares the same entry on two or more different servers. An entry is retrieved from the master and the entry's nsuniqueid is used to retrieve the same entry from a specified consumer. All the attributes and values of the two entries are compared. If they are identical, the entries are considered to be the same.
cd /shared/bin
./entrycmp -s "cn=Directory Manager:PASSWORD@localhost:389" -c "cn=Directory Manager:PASSWORD@slave:389" "ou=people,dc=yada,dc=edu"

insync
The insync tool indicates the synchronization state between a master replica and one or more consumer replicas. insync compares the RUVs of replicas and displays the time difference or delay (in seconds) between the servers. Requesting the date of the last change and restricting the output data to the DN o=example.com:
cd /Sun/shared/bin
./insync -s "cn=Directory Manager:PASSWORD@localhost:389"

Updating Sun T5220 System Controller Firmware

| 0 Comments
Run the flashfirmware utility from Sun to update the system controller firmware. The firmware utility can be downloaded from http://www.sun.com/download/products.xml?id=4705863e Once you have installed the utility and the downloaded the patch. Here's the output of what happens next.
sc> flashupdate -s 127.0.0.1

NOTE: A flashupdate takes about 6 minutes to load a new file.
      Some commands are disabled until the file load is complete.
      The SC must be reset to complete the upgrade.

Are you sure you want to load the specified file (y/n)? y
Using the following information for flash update
        image file:     /coredump/ILOM_flash.pkg
        sector_size:    0x20000
        image_start:    0x0
        flash_start:    0xfe0000
        header_offset:  0x0
        flash_size:     0x1000000

.................................................................................................
Operation succeeded
New firmware images were loaded. Reset the SC to complete the upgrade.

sc> resetsc -y
Performing hard reset on the SC
mount -F nfs HOST:/vol/VOL /mnt
cd /mnt
cp -R /mnt/v1.0.0/Patches/firmware/T5220/139439-05 /var/tmp/.
cd /var/tmp/139439-05
./sysfwdownload Sun_System_Firmware-7_2_4_e-SPARC_Enterprise_T5120+T5220.pkg
(WAIT till 100%...
.......... (6%).......... (13%).......... (20%).......... (27%).......... (34%).......... (41%).......... (48%).......... (55%).......... (62%).......... (69%).......... (76%).......... (83%).......... (90%).......... (97%).... (100%)

Download completed successfully.

cd /var/tmp
rm -rf 139439-05
poweroff

#.

create /SP/users/admin role=Administrator cli_mode=alom
exit
login as admin

showkeyswitch
setkeyswitch -y normal
flashupdate -s 127.0.0.1


NOTE: A flashupdate takes about 6 minutes to load a new file.
      Some commands are disabled until the file load is complete.
      The SC must be reset to complete the upgrade.

Are you sure you want to load the specified file (y/n)? y
Using the following information for flash update
        image file:     /coredump/ILOM_flash.pkg
        sector_size:    0x20000
        image_start:    0x0
        flash_start:    0xfe0000
        header_offset:  0x0
        flash_size:     0x1000000

......

(WAIT...)

resetsc

Useful Debugging Utilities

| 0 Comments

Need to debug some code on a Linux, Mac or Solaris box. Here are some useful debugging utilities.

Linux - strace
MacOS X - ktrace (10.4), dtruss (10.5/10.6), dtruss (10.5/10.6)
Solaris - truss, dtrace

Useful NFS Export Options

| 0 Comments
   • root_squash - Maps the root user to the nobody user. This has the effect of not allowing a root user on a client to gain root file access permissions on the server.
        • no_root_squash - Does not map the root user to the nobody user. The root user on a client has the same rights as the root user on the server.
          no_all_squash - like no_root_squash but applies to users. 
        • all_squash - Maps all the UIDs and GIDs to the nobody user. This is useful if the share is to have anonymous access, much like an anonymous FTP server.
        • anonuid, anongid - If root_squash and all_squash are used, the UIDs and GIDs are mapped to the specified UID and GID instead of the nobody user.
        • ro - Forces all files on the share to be read-only. This is the default behavior.
        • rw - Allows write access to the share.
        • sync - Ensures data is written to disk before another request is serviced.

Useful MLA

| 0 Comments

Book titles are always underlined.


Titles for short stories, poems, articles from newspapers and magazines (including Internet and scientific ones), essays, songs and novellas are shown in quotes.

Minimal Post Configuration for CentOS

| 0 Comments
service yum-updatesd stop
chkconfig yum-updatesd off

service avahi-daemon stop
chkconfig avahi-daemon off

service bluetooth stop
chkconfig bluetooth off

service cups stop
chkconfig cups off

service ip6tables stop
chkconfig ip6tables off

service iptables stop
chkconfig iptables off

yum install screen -y
yum install strace -y
yum install ntp -y
chkconfig ntpd on
mv /etc/ntp.conf /etc/ntp.conf.orig

cat > /etc/ntp.conf << EOF
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
EOF

chkconfig ntpd on
yum update -y
reboot

15 Central Park West

| 0 Comments

The Real Deal details the buyers of the wonderful apartments at 15 CPW.

http://therealdeal.com/newyork/articles/a-unit-by-unit-look-at-15-cpw

http://s3.amazonaws.com/trd_three/images/17726/CPWBinder.pdf

AJAX Toolkits

| 0 Comments
Prototype     	http://prototypejs.org
Scriptaculous     	http://script.aculo.us
Dojo     	         http://dojotoolkit.org
YUI     	         http://developer.yahoo.com
Ext     	         http://extjs.com
Sarissa     	    http://sarissa.sf.net
Mochikit     	    http://mochikit.com
jQuery     	    http://jquery.com
MooTools     	    http://mootools.net
GWT     	         http://code.google.com/webtoolkit/

Resolving dtlogin fc-cache on Solaris

| 0 Comments
dtlogin was unable to start up on an Solaris 10 zone. Noticed the following error message:
Executing start method ("/usr/bin/fc-cache")
Method "start" failed due to signal SEGV

Resolved by running the following:
fc-cache --verbose --force 
svcadm clear application/font/fc-cache
svcadm restart application/graphical-login/cde-login

Sample Test Code for Perl NetApp API

| 0 Comments
#!/usr/bin/perl
use strict;
use warnings;
use English;

use lib "../depends/lib/perl5/site_perl";

use NetApp;

# SSH method
my $hostname_of_nasfiler = "filer01";
my $ssh_identity_file    = "/Users/admin/.ssh/id_dsa";

my $filer = NetApp::Filer->new({
        hostname        => $hostname_of_nasfiler,
        ssh_identity    => $ssh_identity_file,
});

my $na_version = $filer->get_version();
print $na_version . "\n";

Restoring Subversion Repository

| 0 Comments
cd /repos
svnadmin create reponame
chown -R apache:apache reponame
svnadmin load /repos/reponame < /dumps/dumpfile.dump

Compiling rssh on Solaris

| 0 Comments
# DISABLE STATIC LINKING... its BROKEN on Solaris
./configure --prefix=/opt/rssh-2.3.2 MAKE=gmake --disable-static

Useful Perl Commands

| 0 Comments
-------------------------------------------------------------------------------
Test if a Module is installed and can be found...

   perl -Mmodule -e 'print "Ok\n"'

or its version
   perl -Mmodule -le 'print $module::VERSION'

Private Module Installation (in your home directory)
  Replace the first line above with...

    perl Makefile.PL LIB=~/lib/perl5

  The Makefile will then install into    ~/lib/perl5
  and architecture-dependent files into  ~/lib/perl5/$archname/auto

  To use this personal perl library set your t/csh environment,
  by adding to your ".login" file...

    setenv PERL5LIB "$HOME/lib/perl5"

  And if you install architecture-dependent modules (compiled parts)
  append to the above the following extension...

    eval set `perl '-V:archname'`
    setenv PERL5LIB "$PERL5LIB:$PERL5LIB/$archname"
    unset archname

-------------------------------------------------------------------------------
interactive
    perl -MCPAN -e shell

    r            recomendations on what packages to re-install
    b            list all the major software bundles
    readme pkg   print the readme for the package
    instal pkg   install the package


Force upgrade of a module

    perl -MCPAN -e 'force install MIME::Base64'

Personal install
    env LIB=$PERL5LIB  perl -MCPAN -e 'install WWW::Curl'


What upgrade recomendations does CPAN make (non-interactive)
    env PERL5LIB=  perl -MCPAN -e 'CPAN::Shell->r'

upgrade all currently instaled perl packages
    env PERL5LIB=  perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

Basic clean up, keeping metadata for future downloads...
    rm -r ~/.cpan/build/* ~/.cpan/source/authors/id/*
    chown -R anthony.anthony ~/.cpan

-------------------------------------------------------------------------------
RPM Module/Install Creation from CPAN

  Add extra CPAN perl modules as RPM's
    First install the CPAN to RPM converter
      yum install cpan2rpm
    Install modules as RPM packages
      cpan2rpm --force -U WWW::Curl

-------------------------------------------------------------------------------
Module Creation for CPAN (General)

 * First create a raw module source directory with
     h2xs -X -n Foo::Bar
 * Move or rename the directory created appropriately for later tarring
 * Move / Create your module into the source directory
 * ... Module work ...
 * Edit the test.pl and/or other testing scripts as appropriate.
   OPTIONAL: create a "t" sub-directory and move test.pl to t/test.t
   or create other "t/*.t" test files using the same style.
   Numbering the test modules in sequence is a good idea
 * Do final tests
     make test install
 * Prepare the area for taring, creating a new MANIFEST with
     rm -f MANIFEST MANIFEST.bak
     perl Makefile.PL
     make distclean manifest distclean
 * Check MANIFEST and tar the directory for upload to CPAN

------------------------------------------------------------------

Multipoint Polycom

| 0 Comments
You may connect up to 4 sites (including your own). 
If no call is in progress
	•	Select Video Call
	•	Select Multipoint
	•	Select sites to dial from the Address Book or enter them manually
	•	OR select a multipoint call entry from the address book

OR

If a call is already in progress
	•	Select Video Call
	•	Select Add a video call
	•	Enter the number
Speed Note:
	•	Point-to-point calls can run at 768, but multi-point calls must run at slower speeds.
	•	3 sites require dropping the speed to 512
	•	4 sites require dropping the speed to 384.
The quality of the videoconference will decrease as the speed decreases.

Useful Sun ILOM Commands

| 0 Comments
Console:
start /SP/console

Break:
set /HOST send_break_action=break

Power on:
start /SYS

Power off:
stop /SYS

Reset:
reset /SYS

Disable auto-boot:
set /HOST/bootmode script="setenv auto-boot? false"
reset /SYS 

Sending attachments with mailx

| 0 Comments
( cat message; uuencode attachment.txt attachment.txt ) | mailx -s "subject" user@user.com

Useful less commands

| 0 Comments
Key Action Notes q quit / search forward ? search back G end of file home start of file m{a-z} mark position as {a-z}. E.g. ma '{a-z} move to position {a-z}. E.g. 'a h show key bindings v edit file

Solaris File Descriptors

| 0 Comments
# Print current file descriptors
# ulimit -n
256

# Set the maximum to 65535 as required by the application
# ulimit -n 65536

# Verify the limit has been set
# ulimit -n
65536

DBD Oracle on Mac

| 0 Comments
export ORACLE_HOME=/opt/instantclient
export DYLD_LIBRARY_PATH=/opt/instantclient

svn checkout http://svn.perl.org/modules/dbd-oracle/trunk
cd trunk
perl Makefile.PL
make
#rm -rf /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBD/Oracle
make install
cat > test.pl << EOF
#!/usr/bin/perl

use DBI;

my $dbh = DBI->connect( 'dbi:Oracle:host=FQDN;
                         sid=SID;port=1521',
                        'USERNAME', 'PASSWORD',
                        { RaiseError => 1, AutoCommit => 0 } )
                        || die "Database connection failed: $DBI::errstr";

$dbh->disconnect();
EOF
perl test.pl
 

Configure Trunking on Cisco

| 0 Comments
Requirements:
- Two Switches
- Crossover Cable
Execute on both switches: 
int fa0/24
switchport trunk encapsulation dot1q
switchport mode trunk

Snoop on Solaris Containers / Zones

| 0 Comments
# Add privileges to zone
zonecfg -z ZONE
zonecfg:ZONE> set limitpriv=default,net_rawaccess
zonecfg:ZONE> commit

# On global zone locate interface
ls -l /dev/`zonecfg -z ZONE info net | grep physical | awk '{print $2}'` | awk '{print $11}' 

ls -l /devices/pci@780/pci@0/pci@1/network@0:e1000g0
crw-rw-rw-   1 root     root      93,  1 May  8 22:52 /devices/pci@780/pci@0/pci@1/network@0:e1000g0

cd /ZONE/dev
mknod e1000g0 c 93 1

# On the zone
snoop -d e1000g0

Installing & Configuring NTP on Linux CentOS & RHEL

| 0 Comments
yum install ntp -y
mv /etc/ntp.conf /etc/ntp.conf.orig

cat > /etc/ntp.conf << EOF
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1

server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

fudge  127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
EOF

chkconfig ntpd on
service ntpd restart
ntpq -p
Duplicate Disk Layout 
prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 

Configure replicas on both disks 
metadb -afc 3 c1t0d0s7 
metadb -afc 3 c1t1d0s7 

Configure metadevices for root 
metainit -f d10 1 1 c1t0d0s0 
metainit d20 1 1 c1t1d0s0 
metainit d0 -m d10
cp /etc/vfstab /etc/vfstab.preods 
metaroot d0 
lockfs -fa 
init 6 
metattach d0 d20 

Configure metadevices for swap 
metainit -f d11 1 1 c1t0d0s1 
metainit d21 1 1 c1t1d0s1 
metainit d1 -m d11 

Configure metadevices for usr 
metainit -f d16 1 1 c1t0d0s6 
metainit d26 1 1 c1t1d0s6 
metainit d6 -m d16 

Configure metadevices for var 
metainit -f d13 1 1 c1t0d0s3 
metainit d23 1 1 c1t1d0s3 
metainit d3 -m d13 

Configure metadevices for backup 
metainit -f d15 1 1 c1t0d0s5 
metainit d25 1 1 c1t1d0s5 
metainit d5 -m d15 

Configure metadevices for globaldevices 
metainit -f d14 1 1 c1t0d0s4 
metainit d24 1 1 c1t1d0s4 
metainit d4 -m d14 

Update vfstab file 
cp /etc/vfstab /etc/vfstab.preodsmd 
modify entries to reflect /dev/md/[r]dsk/d[0-1] 
update to use logging
init 6 

Attach secondary metadevice 
metattach d1 d21 
metattach d6 d26 
metattach d3 d23 
metattach d5 d25 
metattach d4 d24 

Update Dump Device 
dumpadm -d /dev/md/dsk/d1 

Useful Sun XSCF Commands

| 0 Comments
setprivileges USERNAME platadm domainadm@0-1 platop domainop@0-1 useradm

showhardconf
showstatus
showlogs error

poweron -y -d 0
console -y -d 0

Shared Libraries on Mac

| 0 Comments
In the world of Linux & Solaris, we can use the ldd utility to have a look at shared libraries. On the Mac, we can use otool.
$ otool -L /usr/lib/libc.dylib 
/usr/lib/libc.dylib:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 124.1.1)
        /usr/lib/system/libmathCommon.A.dylib (compatibility version 1.0.0, current version 315.0.0)

Dump the LDAP Schema using Perl

| 0 Comments
Dump the LDAP Schema using Perl
#!/usr/bin/perl

use strict;
use Net::LDAP;
use Net::LDAP::Schema;

my $ldap_host = "ldap-server.example.com";

my $ldap = Net::LDAP->new ( "$ldap_host", port =>389, version => 3 )
or die $!;
my $schema = $ldap->schema ( );

# dump to the screen
my $result = $schema->dump ();

# dump to a file
#my  $result = $schema->dump ( "/tmp/$ldap_host_schema.out" );

$ldap->unbind(  );

Oracle InstantClient on Mac

| 0 Comments
Upon executing sqlplus on you Mac, the display shows...
dyld: Library not loaded: /b/227/sqlplus/lib/libsqlplus.dylib
  Referenced from: /opt/instantclient/sqlplus
  Reason: image not found
Trace/BPT trap

To fix this, you will need to link the library...
cd /opt/instantclient-10.2.0.4/
ln -s libclntsh.dylib.10.1 libclntsh.dylib

Configuring Apache2 htaccess

| 0 Comments
Pre-Req in httpd.conf:

<Directory />
AllowOverride   All
</Directory

Execute (Create the .htaccess file):
cat > /var/www/html/.htaccess << EOF
AuthType Basic 
AuthName "Password Required" 
AuthUserFile /etc/htpasswd 
require valid-user 

<Files config.php>
Order allow,deny
Deny from all
</Files>
EOF

Define username & password entry:
htpasswd -cb /etc/htpasswd username password

Macports Software

| 0 Comments

Macports software I use:

hellanzb
bchunk
bwm-ng
fping
hping2
iftop
lynx
minicom
mtr
nmap
openssl
sqlite3
unrar

Configuring Cisco VLAN on IOS

| 0 Comments
Setup you VLANs and tie your switch port to the specific VLAN.

Setup:
switch#vlan database
switch(vlan)#vtp server
Device mode already VTP SERVER.

switch(vlan)#vlan 10 name VLAN_10
VLAN 10 added:
    Name: VLAN_10
switch(vlan)#vlan 11 name VLAN_11
VLAN 11 added:
    Name: VLAN_11

switch(vlan)#exit
APPLY completed.
Exiting....

Apply:
interface fa0/1
switchport access vlan 10

 

Sun ALOM Network Configuration

| 0 Comments
setsc netsc_ipaddr 10.10.10.20 
setsc netsc_ipnetmask 255.255.255.0 
setsc netsc_ipgateway 10.10.10.1 
setsc sc_cliprompt server
setsc if_network true 
setsc netsc_commit true 

resetsc -y

I just finished upgrading to Movable Type 4!

| 1 Comment
Welcome to my newly upgraded site powered by Movable Type.

New design launched using Movable Type

| 0 Comments

Our web site is sporting a new look and feel thanks to Movable Type and the Professional Template Set. The Professional Template Set makes it possible for just about anyone to get up and running with a new web site using Movable Type. It is literally as easy as just a few clicks. Just pick a new for your web site, select the Professional Template Set and publish. Then viola! a new web site. Thank you Movable Type!