Difference between revisions of "TODO"

From PeformIQ Upgrade
Jump to navigation Jump to search
(New page: http://www.kitebird.com/articles/pydbapi.html == Spolaris References -- h1. Links * [http://docs.sun.com/app/docs] * [http://www.princeton.edu/~unix/Solaris/troubleshoot/sysconfig.ht...)
 
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:


   
   
==
=Solaris References=
Spolaris References
 
--
== Links==
h1. Links
   
   
* [http://docs.sun.com/app/docs]
* [http://docs.sun.com/app/docs]
* [http://www.princeton.edu/~unix/Solaris/troubleshoot/sysconfig.html]
* [http://www.princeton.edu/~unix/Solaris/troubleshoot/sysconfig.html]


==
=MQ Series=
MQ Series
 
--
==Links==
h1. Links
   
   
* [http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzae.doc/ic14080_.htm]
* [http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzae.doc/ic14080_.htm]
* [http://middleware.its.state.nc.us/middleware/Documentation/html/csqzae05/csqzae052x.htm]
* [http://middleware.its.state.nc.us/middleware/Documentation/html/csqzae05/csqzae052x.htm]
   
   
=Solaris Command Reference=
   
   
===========
==HD info(vendor, RPM, capacity)==
Solaris Command References
---------------------
   
   
h1. Solaris Command Reference
<pre>
xxx:/home/tse/dxy[9:18pm] iostat -E
 
h2. HD info(vendor, RPM, capacity)
{noformat}
oasis:/home/tse/dxy[9:18pm] iostat -E
   
   
sd0    Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
sd0    Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Line 49: Line 41:
Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0
Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
Illegal Request: 0 Predictive Failure Analysis: 0
{noformat}
</pre>
   
   
h2. Display the number of used and free i-nodes
==Display the number of used and free i-nodes==
   
   
{noformat}
<pre>
impulse:/home/dxy[4:07pm] df -F ufs -o i
xxx:/home/dxy[4:07pm] df -F ufs -o i
Filesystem            iused  ifree  %iused  Mounted on
Filesystem            iused  ifree  %iused  Mounted on
/dev/dsk/c0t3d0s0      38555  403045    9%  /
/dev/dsk/c0t3d0s0      38555  403045    9%  /
Line 65: Line 57:
/dev/md/dsk/d20      149826 1905214    7%  /usr/local
/dev/md/dsk/d20      149826 1905214    7%  /usr/local
impulse:/home/dxy[4:07pm]
impulse:/home/dxy[4:07pm]
{noformat}
</pre>
   
   
h2. Display processes with the highest CPU utilization
==Display processes with the highest CPU utilization==
   
   
{noformat}
<pre>
velocity:/home/dxy[4:54pm] ps -eo pid,pcpu,args | sort +1n
xxx:/home/dxy[4:54pm] ps -eo pid,pcpu,args | sort +1n
{noformat}
</pre>
   
   
h2. Display processes with the highest memory usage
==Display processes with the highest memory usage==
   
   
{noformat}
<pre>
velocity:/home/dxy[4:54pm] ps -eo pid,vsz,args | sort +1n
xxx:/home/dxy[4:54pm] ps -eo pid,vsz,args | sort +1n
{noformat}
</pre>
   
   
h2. Printing disk geometry and partition info
==Printing disk geometry and partition info==
   
   
{noformat}
<pre>
oasis:/home/dxy[4:16pm] prtvtoc /dev/rdsk/c0t0d0s0
xxx:/home/dxy[4:16pm] prtvtoc /dev/rdsk/c0t0d0s0
* /dev/rdsk/c0t0d0s0 partition map
* /dev/rdsk/c0t0d0s0 partition map
*
*
Line 102: Line 94:
       1      3    01    7855920    524880  8380799
       1      3    01    7855920    524880  8380799
       2      5    00          0  8380800  8380799
       2      5    00          0  8380800  8380799
oasis:/home/dxy[4:16pm]
xxx:/home/dxy[4:16pm]
{noformat}
</pre>
   
   
h2. Checking whether it's running in 32-bit mode or 64-bit mode
==Checking whether it's running in 32-bit mode or 64-bit mode==
   
   
<h4>64-bit mode
===64-bit mode===
{h4> {noformat}
 
<pre>
% isalist -v
% isalist -v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
Line 114: Line 107:
64-bit sparcv9 applications
64-bit sparcv9 applications
32-bit sparc applications
32-bit sparc applications
{noformat}
</pre>
32-bit mode{h4>{noformat}
 
}
====32-bit mode====
 
<pre>
% isalist \-v
% isalist \-v
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
% isainfo \-v
% isainfo \-v
32-bit sparc applications
32-bit sparc applications
{noformat}
</pre>
h2. Verifying a route to a specified network
 
==Verifying a route to a specified network==
   
   
{noformat}
<pre>
# route \-n get xxx.yyy.zzz.0
# route \-n get xxx.yyy.zzz.0
route to: xxx.yyy.zzz.0
route to: xxx.yyy.zzz.0
Line 135: Line 131:
0        0        0        0        0        0      1500        0
0        0        0        0        0        0      1500        0
\#
\#
{noformat}
</pre>
h2. print the version of OBP
 
==print the version of OBP==
   
   
{noformat}
<pre>
% prtconf \-V
% prtconf \-V
OBP 3.3.2 1996/06/28 08:43
OBP 3.3.2 1996/06/28 08:43
{noformat}
</pre>
   
   
{noformat}
<pre>
% /usr/platform/`uname \-i`/sbin/prtdiag \-v \| grep OBP
% /usr/platform/`uname \-i`/sbin/prtdiag \-v \| grep OBP
OBP 3.11.1 1997/12/03 15:53  POST 3.11.4 1997/05/27 02:26
OBP 3.11.1 1997/12/03 15:53  POST 3.11.4 1997/05/27 02:26
%
%
{noformat}
</pre>
   
   
{noformat}
<pre>
{2} ok .version
{2} ok .version
Release 3.23 Version 1 created 1999/07/16 12:08
Release 3.23 Version 1 created 1999/07/16 12:08
Line 156: Line 153:
{2}
{2}
ok
ok
{noformat}
</pre>
h2. print the version of Open Windows
 
==print the version of Open Windows==
   
   
{noformat}
<pre>
% showrev \-w
% showrev \-w
   
   
Line 166: Line 164:
   
   
%
%
{noformat}
</pre>
h2. To determine which monitor resolution is available
 
==To determine which monitor resolution is available==
   
   
{noformat}
<pre>
% /usr/sbin/ffbconfig \-res ?
% /usr/sbin/ffbconfig \-res ?
Valid values for \-res option are:
Valid values for \-res option are:
Line 209: Line 208:
[2] this version of FFB (FFB1) does not support this resolution.
[2] this version of FFB (FFB1) does not support this resolution.
%
%
{noformat}
</pre>
h2. system configuration
 
==system configuration==
   
   
<pre>
% sysdef
% sysdef
</pre>
==Display the device list (and drivers attached to devices)==
   
   
h2. Display the device list (and drivers attached to devices)
<pre>
{noformat}
% prtconf \-D
% prtconf \-D
System Configuration:  Sun Microsystems  sun4u
System Configuration:  Sun Microsystems  sun4u
Line 270: Line 273:
SUNW,ffb, instance #0 (driver name: ffb)
SUNW,ffb, instance #0 (driver name: ffb)
pseudo, instance #0 (driver name: pseudo)
pseudo, instance #0 (driver name: pseudo)
{noformat}
</pre>
h2. processor type, speed
 
==processor type, speed==
   
   
{noformat}
<pre>
% psrinfo \-v
% psrinfo \-v
Status of processor 0 as of: 06/16/99 12:38:51
Status of processor 0 as of: 06/16/99 12:38:51
Line 279: Line 283:
The sparcv9 processor operates at 200 MHz,
The sparcv9 processor operates at 200 MHz,
and has a sparcv9 floating point processor.
and has a sparcv9 floating point processor.
{noformat}
</pre>
h2. patch applied on the system
 
==patch applied on the system==
   
   
<pre>
% showrev \-p
% showrev \-p
</pre>
   
   
h2. exported file system on NFS server
==exported file system on NFS server==
   
   
<pre>
% showmount \-e NFS_SERVER
% showmount \-e NFS_SERVER
</pre>
==display current run level==
   
   
h2. display current run level
<pre>
% who \-r
% who \-r
</pre>
   
   
h2. Find out a package which a file belongs to
==Find out a package which a file belongs to==
   
   
{noformat}
<pre>
% pkgchk \-l \-p /usr/lib/sendmail
% pkgchk \-l \-p /usr/lib/sendmail
Pathname: /usr/lib/sendmail
Pathname: /usr/lib/sendmail
Line 309: Line 320:
   
   
%
%
{noformat}
</pre>
h2. Examining gcc behavior
 
==Examining gcc behavior==
   
   
<pre>
% gcc \-v \-x c /dev/null
% gcc \-v \-x c /dev/null
</pre>
==Display the version of CDE==
   
   
h2. Display the version of CDE
<pre>
{noformat}
% /usr/ccs/bin/what /usr/dt/bin/dtmail
% /usr/ccs/bin/what /usr/dt/bin/dtmail
/usr/dt/bin/dtmail:
/usr/dt/bin/dtmail:
CDE Version 1.3.4
CDE Version 1.3.4
CDEVersion1.3.4
CDEVersion1.3.4
{noformat}
</pre>
h2. Display the version of BIND
 
==Display the version of BIND==
   
   
{noformat}
<pre>
% nslookup \-class=chaos \-q=txt version.bind ns0.optix.org
% nslookup \-class=chaos \-q=txt version.bind ns0.optix.org
Server:  impulse.optix.org
Server:  impulse.optix.org
Line 350: Line 365:
   
   
%
%
{noformat}
</pre>
h3. system configuration
 
==system configuration==
   
   
{noformat}
<pre>
% /usr/platform/`uname \-i`/sbin/prtdiag
% /usr/platform/`uname \-i`/sbin/prtdiag
System Configuration:  Sun Microsystems  sun4u 8-slot Sun Enterprise 4000/5000
System Configuration:  Sun Microsystems  sun4u 8-slot Sun Enterprise 4000/5000
Line 403: Line 419:
   
   
%
%
{noformat}
</pre>
   
   
{noformat}
<pre>
===========
=Network Time Protocol - ntpd=
Network Time Protocol - ntpd
 
---------------------
 
h1. References
=References=
   
   
* [http://linux.die.net/man/1/ntpd]
* [http://linux.die.net/man/1/ntpd]
* [http://wylie.summerhill.org/ntp/ntpd.html]
* [http://wylie.summerhill.org/ntp/ntpd.html]
    
    
===========
=UNIX - Useful References=
UNIX - Useful References
 
---------------------
 
h1. Command Translation Matrix
=Command Translation Matrix=
   
   
* [http://bhami.com/rosetta.html]
* [http://bhami.com/rosetta.html]
* [http://www.opennet.ru/soft/linux2unix.html]
* [http://www.opennet.ru/soft/linux2unix.html]
8 [http://www.gnu.org/software/automake/manual/autoconf/Systemology.html#Systemology]
* [http://www.gnu.org/software/automake/manual/autoconf/Systemology.html#Systemology]
   
   
   
   
===========
=Object Relational Mapping - ORM=
Object Relational Mapping - ORM
 
---------------------
   
   
h1. References
==References==
   
   
* [http://www.simpleorm.org/whitepaper.html]
* [http://www.simpleorm.org/whitepaper.html]
* [http://www.simpleorm.org/]
* [http://www.simpleorm.org/]
=Python - MySQL=
   
   
==References==
===========
 
Python - MySQL
---------------------
h1. References
\\
* [http://dev.mysql.com/downloads/python.html]
* [http://dev.mysql.com/downloads/python.html]
* [http://sourceforge.net/projects/mysql-python]
* [http://sourceforge.net/projects/mysql-python]
Line 448: Line 459:
* [http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/]
* [http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/]
   
   
h1. General References
=General References=
 
\\
* [http://www.python.org/dev/peps/pep-0249/]
* [http://www.python.org/dev/peps/pep-0249/]
   
   
===========
=Python - Sqlite=
Python - Sqlite
---------------------
   
   
==References==
   
   
h1. References
 
\\
* [http://www.hwaci.com/sw/sqlite/]
* [http://www.hwaci.com/sw/sqlite/]
* [http://en.wikipedia.org/wiki/SQLite]
* [http://en.wikipedia.org/wiki/SQLite]
Line 467: Line 474:
* [http://del.icio.us/pauldwaite/sqlite]
* [http://del.icio.us/pauldwaite/sqlite]
   
   
h1. Examples
==Examples==
   
   
\\
* [http://www.mail-archive.com/sqlite-users@sqlite.org/msg28608.html]
* [http://www.mail-archive.com/sqlite-users@sqlite.org/msg28608.html]
* [http://www.freenetpages.co.uk/hp/alan.gauld/tutdbms.htm]
* [http://www.freenetpages.co.uk/hp/alan.gauld/tutdbms.htm]
   
   
h2. GeoLite
==GeoLite==
\\
   
   
h3. Tables
===Tables===
   
   
\\
<pre>
{noformat}
CREATE TABLE locations(
CREATE TABLE locations(
                 locid    INTEGER PRIMARY KEY,
                 locid    INTEGER PRIMARY KEY,
Line 496: Line 499:
                 endIpNum INTEGER,
                 endIpNum INTEGER,
                 locId INTEGER)
                 locId INTEGER)
{noformat}
</pre>
   
   
h3. Data
===Data===
   
   
* [http://www.maxmind.com/app/geolitecity]
* [http://www.maxmind.com/app/geolitecity]
Line 508: Line 511:
Locations table has 159,488 rows
Locations table has 159,488 rows
   
   
h4. Instructions
====Instructions====
   
   
GeoIP Country CSV Text Files
GeoIP Country CSV Text Files
Line 515: Line 518:
   
   
Due to the large size of geolocation databases, we generally recommend using our binary format with one of our APIs, since they are highly optimized for speed and disk space. On the other hand, if you have a requirement to import the data into a SQL database, the CSV format is recommended. We have listed some guidelines for importing and querying the data with a SQL database.
Due to the large size of geolocation databases, we generally recommend using our binary format with one of our APIs, since they are highly optimized for speed and disk space. On the other hand, if you have a requirement to import the data into a SQL database, the CSV format is recommended. We have listed some guidelines for importing and querying the data with a SQL database.
CSV Format
CSV Format.
 
The CSV File contains six fields:
The CSV File contains six fields:
{noformat}
 
<pre>
     * Beginning IP Address
     * Beginning IP Address
     * Ending IP Address
     * Ending IP Address
Line 524: Line 529:
     * ISO 3166 Country Code
     * ISO 3166 Country Code
     * Country Name
     * Country Name
{noformat}
</pre>
 
This is an sample of how the CSV file is structured:
This is an sample of how the CSV file is structured:
{noformat}
 
<pre>
"begin_ip","end_ip","begin_num","end_num","country","name"
"begin_ip","end_ip","begin_num","end_num","country","name"
"61.88.0.0","61.91.255.255","1029177344","1029439487","AU","Australia"
"61.88.0.0","61.91.255.255","1029177344","1029439487","AU","Australia"
"61.92.0.0","61.93.255.255","1029439488","1029570559","HK","Hong Kong"
"61.92.0.0","61.93.255.255","1029439488","1029570559","HK","Hong Kong"
"61.94.0.0","61.94.7.255","1029570560","1029572607","ID","Indonesia"
"61.94.0.0","61.94.7.255","1029570560","1029572607","ID","Indonesia"
{noformat}
</pre>
 
* Beginning IP Number and Ending IP Number are calculated as follows:
* Beginning IP Number and Ending IP Number are calculated as follows:
   
   
{noformat}
<pre>
ipnum = 16777216*w + 65536*x + 256*y + z  (1)
ipnum = 16777216*w + 65536*x + 256*y + z  (1)
{noformat}
</pre>
 
where
where
{noformat}
 
<pre>
IP Address = w.x.y.z
IP Address = w.x.y.z
{noformat}
</pre>
 
The reverse of this formula is
The reverse of this formula is
{noformat}
 
<pre>
w = int ( ipnum / 16777216 ) % 256;
w = int ( ipnum / 16777216 ) % 256;
x = int ( ipnum / 65536    ) % 256;
x = int ( ipnum / 65536    ) % 256;
y = int ( ipnum / 256      ) % 256;
y = int ( ipnum / 256      ) % 256;
z = int ( ipnum            ) % 256;
z = int ( ipnum            ) % 256;
{noformat}
</pre>
 
Where % is the mod operator.
Where % is the mod operator.
   
   
Here is sample Perl code to convert the IP number to a IP address:
Here is sample Perl code to convert the IP number to a IP address:
{noformat}
 
<pre>
sub numToStr {
sub numToStr {
   my ($ipnum) = @_;
   my ($ipnum) = @_;
Line 563: Line 577:
   return "$w.$x.$y.$z";
   return "$w.$x.$y.$z";
}
}
{noformat}
</pre>
 
It is useful to have the IP Number if you are performing IP Address lookups using a database. For example the following queries will find the country based on IP Address 24.24.24.24:
It is useful to have the IP Number if you are performing IP Address lookups using a database. For example the following queries will find the country based on IP Address 24.24.24.24:
   
   
SQL Query
===SQL Query===
{noformat}
 
<pre>
SELECT ip_country FROM geoip WHERE 404232216 BETWEEN begin_ip_num AND end_ip_num
SELECT ip_country FROM geoip WHERE 404232216 BETWEEN begin_ip_num AND end_ip_num
{noformat}
</pre>
MySQL Query
 
{noformat}
===MySQL Query===
 
<pre>
SELECT ip_country FROM geoip WHERE 404232216 >= begin_ip_num AND
SELECT ip_country FROM geoip WHERE 404232216 >= begin_ip_num AND
  404232216 <= end_ip_num
  404232216 <= end_ip_num
{noformat}
</pre>
 
Here we used the formula (1) to compute the IP Number based on 24.24.24.24
Here we used the formula (1) to compute the IP Number based on 24.24.24.24
{noformat}
 
<pre>
404232216 = 16777216*24 + 65536*24 + 256*24 + 24
404232216 = 16777216*24 + 65536*24 + 256*24 + 24
{noformat}
</pre>
 
Guides For more information on importing GeoIP CSV files into MySQL, see HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.
Guides For more information on importing GeoIP CSV files into MySQL, see HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.
 
For more information on importing GeoIP CSV files into Oracle 8i\+ with PL/SQL and SQL*Loader files included, see GeoIP01.zip on Sascha Pfalz's download page.
For more information on importing GeoIP CSV files into Oracle 8i\+ with PL/SQL and SQL*Loader files included, see GeoIP01.zip on Sascha Pfalz's download page.
 
For more information on importing GeoIP CSV files into MS Access, see How to install the MaxMind GeoIP CSV databases into an MS Access Database.
For more information on importing GeoIP CSV files into MS Access, see How to install the MaxMind GeoIP CSV databases into an MS Access Database.
 
h3. Script
===Script===
 
\\
<pre>
{noformat}
'''geolite
'''geolite
GeoLite City is a free IP to city database provided by MaxMind.
GeoLite City is a free IP to city database provided by MaxMind.
Line 773: Line 793:


getch = _Getch()
getch = _Getch()
{noformat}
</pre>
 
[[Category:TODO]]
[[Category:Systems Admin]]

Latest revision as of 13:53, 2 April 2009

http://www.kitebird.com/articles/pydbapi.html


Solaris References

Links

MQ Series

Links

Solaris Command Reference

HD info(vendor, RPM, capacity)

xxx:/home/tse/dxy[9:18pm] iostat -E
 
sd0     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: SEAGATE  Product: ST34371W SUN4.2G Revision: 7462 Serial No: 9742K71685
RPM: 7200 Heads: 16 Size: 4.29GB <4292075520 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
 
sd1     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: SEAGATE  Product: ST32171W SUN2.1G Revision: 7462 Serial No: 9736T74649
RPM: 5400 Heads: 19 Size: 2.13GB <2127708160 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
 
sd6     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: TOSHIBA  Product: XM5701TASUN12XCD Revision: 0997 Serial No: 04/09/97
RPM: 0 Heads: 0 Size: 18446744073.71GB <-8589934591 bytes>
Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

Display the number of used and free i-nodes

xxx:/home/dxy[4:07pm] df -F ufs -o i
Filesystem             iused   ifree  %iused  Mounted on
/dev/dsk/c0t3d0s0      38555  403045     9%   /
/dev/dsk/c0t1d0s0     160761  345607    32%   /export/home
/dev/md/dsk/d20       149826 1905214     7%   /usr/local
impulse:/home/dxy[4:07pm] /usr/ucb/df -i
Filesystem             iused   ifree  %iused  Mounted on
/dev/dsk/c0t3d0s0      38555  403045     9%   /
/dev/dsk/c0t1d0s0     160761  345607    32%   /export/home
/dev/md/dsk/d20       149826 1905214     7%   /usr/local
impulse:/home/dxy[4:07pm]

Display processes with the highest CPU utilization

xxx:/home/dxy[4:54pm] ps -eo pid,pcpu,args | sort +1n

Display processes with the highest memory usage

xxx:/home/dxy[4:54pm] ps -eo pid,vsz,args | sort +1n

Printing disk geometry and partition info

xxx:/home/dxy[4:16pm] prtvtoc /dev/rdsk/c0t0d0s0
* /dev/rdsk/c0t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     135 sectors/track
*      16 tracks/cylinder
*    2160 sectors/cylinder
*    3882 cylinders
*    3880 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0   7855920   7855919   /usr/local
       1      3    01    7855920    524880   8380799
       2      5    00          0   8380800   8380799
xxx:/home/dxy[4:16pm]

Checking whether it's running in 32-bit mode or 64-bit mode

64-bit mode

% isalist -v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
% isainfo -v
64-bit sparcv9 applications
32-bit sparc applications

32-bit mode

% isalist \-v
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
% isainfo \-v
32-bit sparc applications

Verifying a route to a specified network

# route \-n get xxx.yyy.zzz.0
route to: xxx.yyy.zzz.0
destination: default
mask: default
gateway: xxx.yyy.aaa.254
interface: hme0
flags: <UP,GATEWAY,DONE>
recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
0         0         0         0         0         0      1500         0
\#

print the version of OBP

% prtconf \-V
OBP 3.3.2 1996/06/28 08:43
% /usr/platform/`uname \-i`/sbin/prtdiag \-v \| grep OBP
OBP 3.11.1 1997/12/03 15:53   POST 3.11.4 1997/05/27 02:26
%
{2} ok .version
Release 3.23 Version 1 created 1999/07/16 12:08
OBP 3.23.1 1999/07/16 12:08
POST 2.0.2 1998/10/19 10:46
{2}
ok

print the version of Open Windows

% showrev \-w
 
OpenWindows version:
OpenWindows Version 3.6.1 25 January 1999
 
%

To determine which monitor resolution is available

% /usr/sbin/ffbconfig \-res ?
Valid values for \-res option are:
1024x768x60 [1]
1024x768x70 [1]
1024x768x75 [1] [2]
1024x768x77
1024x800x84
1152x900x66
1152x900x76
1280x800x76 [1] [2]
1280x1024x60 [1] [2]
1280x1024x67
1280x1024x76
1280x1024x85 [1] [2]
960x680x112s
960x680x108s
640x480x60 [1] [2]
640x480x60i [1]
768x575x50i [1]
1440x900x76 [1] [2]
1600x1000x66 [1] [2]
1600x1000x76 [1] [2]
1600x1280x76 [1] [2]
1920x1080x72 [1] [2]
1920x1080x76 [1] [2]
1920x1200x70 [1] [2]
1920x1200x75 [1] [2]
svga [1]
1152
1280
stereo
vga [1] [2]
ntsc [1]
pal [1]
none
Notes:
[1] monitor does not support this resolution.
[2] this version of FFB (FFB1) does not support this resolution.
%

system configuration

% sysdef


Display the device list (and drivers attached to devices)

% prtconf \-D
System Configuration:  Sun Microsystems  sun4u
Memory size: 256 Megabytes
System Peripherals (Software Nodes):
 
SUNW,Ultra-1
packages
terminal-emulator
deblocker
obp-tftp
disk-label
ufs-file-system
chosen
openprom
client-services
options, instance #0 (driver name: options)
aliases
memory
virtual-memory
counter-timer
sbus, instance #0 (driver name: sbus)
SUNW,CS4231 (driver name: audiocs)
auxio
flashprom
SUNW,fdtwo, instance #0 (driver name: fd)
eeprom (driver name: eeprom)
zs, instance #0 (driver name: zs)
zs, instance #1 (driver name: zs)
sc
SUNW,pll
SUNW,fas, instance #0 (driver name: fas)
sd (driver name: sd)
st (driver name: st)
sd, instance #0 (driver name: sd)
sd, instance #1 (driver name: sd)
sd, instance #2 (driver name: sd)
sd, instance #3 (driver name: sd)
sd, instance #4 (driver name: sd)
sd, instance #5 (driver name: sd)
sd, instance #6 (driver name: sd)
sd, instance #7 (driver name: sd)
sd, instance #8 (driver name: sd)
sd, instance #9 (driver name: sd)
sd, instance #10 (driver name: sd)
sd, instance #11 (driver name: sd)
sd, instance #12 (driver name: sd)
sd, instance #13 (driver name: sd)
sd, instance #14 (driver name: sd)
SUNW,hme, instance #0 (driver name: hme)
SUNW,bpp (driver name: bpp)
SUNW,UltraSPARC
SUNW,ffb, instance #0 (driver name: ffb)
pseudo, instance #0 (driver name: pseudo)

processor type, speed

% psrinfo \-v
Status of processor 0 as of: 06/16/99 12:38:51
Processor has been on-line since 02/07/99 01:47:11.
The sparcv9 processor operates at 200 MHz,
and has a sparcv9 floating point processor.

patch applied on the system

% showrev \-p

exported file system on NFS server

% showmount \-e NFS_SERVER

display current run level

% who \-r

Find out a package which a file belongs to

% pkgchk \-l \-p /usr/lib/sendmail
Pathname: /usr/lib/sendmail
Type: regular file
Expected mode: 4555
Expected owner: root
Expected group: bin
Expected file size (bytes): 650720
Expected sum(1) of contents: 22626
Expected last modification: Apr 07 04:13:53 1999
Referenced by the following packages:
SUNWsndmu
Current status: installed
 
%

Examining gcc behavior

% gcc \-v \-x c /dev/null

Display the version of CDE

% /usr/ccs/bin/what /usr/dt/bin/dtmail
/usr/dt/bin/dtmail:
CDE Version 1.3.4
CDEVersion1.3.4

Display the version of BIND

% nslookup \-class=chaos \-q=txt version.bind ns0.optix.org
Server:  impulse.optix.org
Address:  210.164.85.210
Aliases:  210.85.164.210.in-addr.arpa
 
VERSION.BIND    text = "8.2.2-P5"
% dig @ns-tk021.ocn.ad.jp version.bind chaos txt
; <<>> DiG 8.2 <<>> @ns-tk021.ocn.ad.jp version.bind chaos txt
; (1 server found)
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;;      version.bind, type = TXT, class = CHAOS
 
;; ANSWER SECTION:
VERSION.BIND.           0S CHAOS TXT    "4.9.7-REL"
 
;; Total query time: 81 msec
;; FROM: velocity to SERVER: ns-tk021.ocn.ad.jp  203.139.160.103
;; WHEN: Tue May  9 17:26:23 2000
;; MSG SIZE  sent: 30  rcvd: 64
 
%

system configuration

% /usr/platform/`uname \-i`/sbin/prtdiag
System Configuration:  Sun Microsystems  sun4u 8-slot Sun Enterprise 4000/5000
System clock frequency: 82 MHz
Memory size:  512Mb
 
========================= CPUs =========================
 
Run   Ecache   CPU    CPU
Brd  CPU   Module   MHz     MB    Impl.   Mask
---  ---  \------\-  \----\-  \-----\-  \-----\-  \---\-
0     0     0      248     2.0   US-II    1.1
0     1     1      248     2.0   US-II    1.1
2     4     0      248     2.0   US-II    1.1
2     5     1      248     2.0   US-II    1.1
 
========================= Memory =========================
 
Intrlv.  Intrlv.
Brd   Bank   MB    Status   Condition  Speed   Factor   With
---  \----\-  \---\-  \------\-  \---------\-  \----\-  \------\-  \------\-
0     0     256   Active      OK       60ns    2-way     A
2     0     256   Active      OK       60ns    2-way     A
 
========================= IO Cards =========================
 
Bus   Freq
Brd  Type  MHz   Slot  Name                              Model
---  \---\-  \---\-  \---\-  \-------------------------------\-  \---------------------\-
1   SBus   25     3   SUNW,hme
1   SBus   25     3   SUNW,fas/sd (block)
1   SBus   25    13   SUNW,soc/SUNW,pln                 501-2069
5   SBus   25     3   SUNW,hme
5   SBus   25     3   SUNW,fas/sd (block)
5   SBus   25    13   SUNW,soc/SUNW,pln                 501-2069
 
Detached Boards
===============
Slot  State       Type           Info
\---\-  \--------\-   \-----\-         \----------------------------------------\-
3    disabled   disk           Disk 0: Target: 10   Disk 1: Target: 11
7    disabled   disk           Disk 0: Target: 14   Disk 1: Target: 15
 
No failures found in System
===========================
 
No System Faults found
======================
 
%
=Network Time Protocol - ntpd=


=References=
 
* [http://linux.die.net/man/1/ntpd]
* [http://wylie.summerhill.org/ntp/ntpd.html]
  
=UNIX - Useful References=


=Command Translation Matrix=
 
* [http://bhami.com/rosetta.html]
* [http://www.opennet.ru/soft/linux2unix.html]
* [http://www.gnu.org/software/automake/manual/autoconf/Systemology.html#Systemology]
 
 
=Object Relational Mapping - ORM=

 
==References==
 
* [http://www.simpleorm.org/whitepaper.html]
* [http://www.simpleorm.org/]

=Python - MySQL=
 
==References==

* [http://dev.mysql.com/downloads/python.html]
* [http://sourceforge.net/projects/mysql-python]
* [http://mysql-python.sourceforge.net/]
* [http://www.kitebird.com/articles/pydbapi.html]
* [http://dustman.net/andy/python/python-and-mysql]
* [http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/]
 
=General References=

* [http://www.python.org/dev/peps/pep-0249/]
 
=Python - Sqlite=
 
==References==
 

* [http://www.hwaci.com/sw/sqlite/]
* [http://en.wikipedia.org/wiki/SQLite]
* [http://www.sqlite.org/cvstrac/wiki]
* [http://snippets.dzone.com/posts/show/653]
* [http://del.icio.us/pauldwaite/sqlite]
 
==Examples==
 
* [http://www.mail-archive.com/sqlite-users@sqlite.org/msg28608.html]
* [http://www.freenetpages.co.uk/hp/alan.gauld/tutdbms.htm]
 
==GeoLite==
 
===Tables===
 
<pre>
CREATE TABLE locations(
                locid    INTEGER PRIMARY KEY,
                country TEXT,
                region    TEXT,
                city    TEXT,
                postalCode TEXT,
                latitude REAL,
                longitude REAL,
                dmaCode INTEGER,
                areaCode INTEGER)
 
CREATE TABLE blocks(
                startIpNum INTEGER,
                endIpNum INTEGER,
                locId INTEGER)

Data

Blocks table has 2,776,436 rows Locations table has 159,488 rows

Instructions

GeoIP Country CSV Text Files

MaxMind GeoIP databases are available in a Comma Separated Value (CSV) format, in addition to the binary format. These CSV files generally contain IP Address range and geographical data for all publicly assigned IPv4 addresses.

Due to the large size of geolocation databases, we generally recommend using our binary format with one of our APIs, since they are highly optimized for speed and disk space. On the other hand, if you have a requirement to import the data into a SQL database, the CSV format is recommended. We have listed some guidelines for importing and querying the data with a SQL database. CSV Format.

The CSV File contains six fields:

    * Beginning IP Address
    * Ending IP Address
    * Beginning IP Number*
    * Ending IP Number*
    * ISO 3166 Country Code
    * Country Name

This is an sample of how the CSV file is structured:

"begin_ip","end_ip","begin_num","end_num","country","name"
"61.88.0.0","61.91.255.255","1029177344","1029439487","AU","Australia"
"61.92.0.0","61.93.255.255","1029439488","1029570559","HK","Hong Kong"
"61.94.0.0","61.94.7.255","1029570560","1029572607","ID","Indonesia"
  • Beginning IP Number and Ending IP Number are calculated as follows:
ipnum = 16777216*w + 65536*x + 256*y + z   (1)

where

IP Address = w.x.y.z

The reverse of this formula is

w = int ( ipnum / 16777216 ) % 256;
x = int ( ipnum / 65536    ) % 256;
y = int ( ipnum / 256      ) % 256;
z = int ( ipnum            ) % 256;

Where % is the mod operator.

Here is sample Perl code to convert the IP number to a IP address:

sub numToStr {
  my ($ipnum) = @_;
  my $z = $ipnum % 256;
  $ipnum >>= 8;
  my $y = $ipnum % 256;
  $ipnum >>= 8;
  my $x = $ipnum % 256;
  $ipnum >>= 8;
  my $w = $ipnum % 256;
  return "$w.$x.$y.$z";
}

It is useful to have the IP Number if you are performing IP Address lookups using a database. For example the following queries will find the country based on IP Address 24.24.24.24:

SQL Query

SELECT ip_country FROM geoip WHERE 404232216 BETWEEN begin_ip_num AND end_ip_num

MySQL Query

SELECT ip_country FROM geoip WHERE 404232216 >= begin_ip_num AND
 404232216 <= end_ip_num

Here we used the formula (1) to compute the IP Number based on 24.24.24.24

404232216 = 16777216*24 + 65536*24 + 256*24 + 24

Guides For more information on importing GeoIP CSV files into MySQL, see HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.

For more information on importing GeoIP CSV files into Oracle 8i\+ with PL/SQL and SQL*Loader files included, see GeoIP01.zip on Sascha Pfalz's download page.

For more information on importing GeoIP CSV files into MS Access, see How to install the MaxMind GeoIP CSV databases into an MS Access Database.

Script

'''geolite
GeoLite City is a free IP to city database provided by MaxMind.
They provide a C API (and a python wrapper) for the database.
If you can't compile the C sources on your server (or get a binary
version), this script might be helpful for you.
The script puts the geoip data in a sqllite database, and provides
interfaces for updating and searching the database.
 
To use this script, get the database in CSV format:
http://www.maxmind.com/app/geolitecity
 
You also need to have python 2.5 for this script (sqlite3 is used)
'''
 
import sqlite3 as sqlite
import os
 
def dottedQuadToNum(ip):
    "convert decimal dotted quad string to long integer"
 
    hexn = ''.join(["%02X" % long(i) for i in ip.split('.')])
    return long(hexn, 16)
 

def cursorToDict(cursor):
    val = cursor.next()
    return dict([(cursor.description[i][0],val[i]) for i in xrange(len(cursor.description))])
 
def test():
    import sqlite3
    from time import clock
    x = sqlite3.connect('geolite.db')
    y = x.cursor()
    ip = dottedQuadToNum("84.108.189.94")
    res = y.execute('select * from blocks,locations where locations.locid = blocks.locid AND ? >= blocks.startIpNum AND ? <= blocks.endIpNum', [ip,ip])
    begin = clock()
    f = res.next()
    end = clock()
    y.close()
    x.close()
    return end-begin, f
 
def test2():
    from time import clock
    x = GeoLiteDB()
    x.connect();
    begin = clock()
    x.ipLocation("84.108.189.94");
    end = clock()
    x.close()
    return end - begin
 

def createDB(dbPath = 'geolite.db', locationsPath='GeoLiteCity-Location.csv', blocksPath='GeoLiteCity-Blocks.csv', warnOnDelete = True):
    if os.path.exists(dbPath):
        if warnOnDelete:
     print "file %s will be deleted. Press any key to continue, or 'n' to abort..." % (os.path.abspath(dbPath))
     if getch() == 'n':
         print 'aborted.'
         return None
 os.remove(os.path.abspath(dbPath))
    conn = sqlite.connect(dbPath)
    cursor = conn.cursor()
    try:
        cursor.execute('''CREATE TABLE locations(
    locid INTEGER PRIMARY KEY,
    country TEXT,
    region TEXT,
    city TEXT,
    postalCode TEXT,
    latitude REAL,
    longitude REAL,
    dmaCode INTEGER,
    areaCode INTEGER)''')
 
 cursor.execute('''CREATE TABLE blocks(
    startIpNum INTEGER,
    endIpNum INTEGER,
    locId INTEGER)''')
 
 locations = file(locationsPath,'r')
 print ('parsing locations. This will a while.')
 print locations.readline().strip() #should print copyright note
        print locations.readline().strip() #should print column names
        lines = ([x.strip('"') for x in line.strip().split(',')] for line in locations.xreadlines())
        cursor.executemany('insert into locations values (?,?,?,?,?,?,?,?,?)', lines)
 locations.close()
 
 blocks = file(blocksPath,'r')
 print ('parsing blocks. This will take longer.')
 print blocks.readline().strip() #should print copyright note
        print blocks.readline().strip() #should print column names
        lines = ([x.strip('"') for x in line.strip().split(',')] for line in blocks.xreadlines())
 cursor.executemany('insert into blocks values (?,?,?)', lines)
 blocks.close()
 
#        cursor.execute('''CREATE UNIQUE INDEX startIpNumIx ON blocks(startIpNum);''')
# cursor.execute('''CREATE UNIQUE INDEX endIpNumIx ON blocks(endIpNum);''')
 
        conn.commit()
 
 print 'analyze'
 cursor.execute('''ANALYZE;''')
 
        numBlocks = cursor.execute('select count(*) from blocks').fetchone()[0]
 numLocations = cursor.execute('select count(*) from locations').fetchone()[0]
 
 return numBlocks, numLocations
 
    finally:
 cursor.close()
        conn.close()
 

class GeoLiteDB:
    def __init__(self, dbPath = 'geolite.db'):
        self.dbPath = dbPath
 self._conn = None
 self._cursor = None
 
    def connect(self):
        if self._conn:
            raise 'database already opened'
        self._conn = sqlite.connect(self.dbPath)
 self._cursor = self._conn.cursor()
    def close(self):
         if not self._conn:
       raise 'databse was not opened'
  self._cursor.close()
         self._conn.close()
    def autoConnect(self):
        if not self._conn:
     self.connect()
    def countBlocks(self):
        self.autoConnect()
        return self._cursor.execute('select count(*) from blocks').next()[0]
    def countLocations(self):
        self.autoConnect()
        return self._cursor.execute('select count(*) from locations').next()[0]
    def ipLocation(self, ip):
        self.autoConnect()
        if isinstance(ip,str):
            ip = dottedQuadToNum(ip)
        return cursorToDict(self._cursor.execute('select * from blocks,locations where locations.locid = blocks.locid AND ? >= blocks.startIpNum AND ? <= blocks.endIpNum', [ip,ip]))
 
#cross platform getch, from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
class _Getch:
    """Gets a single character from standard input.  Does not echo to the
screen."""
    def __init__(self):
        try:
            self.impl = _GetchWindows()
        except ImportError:
            self.impl = _GetchUnix()
 
    def __call__(self): return self.impl()
 

class _GetchUnix:
    def __init__(self):
        import tty, sys
 
    def __call__(self):
        import sys, tty, termios
        fd = sys.stdin.fileno()
        old_settings = termios.tcgetattr(fd)
        try:
            tty.setraw(sys.stdin.fileno())
            ch = sys.stdin.read(1)
        finally:
            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
        return ch
 

class _GetchWindows:
    def __init__(self):
        import msvcrt
 
    def __call__(self):
        import msvcrt
        return msvcrt.getch()
 

getch = _Getch()