12/20/2007

vi setting

This is my vimrc setting on my linux machine. You can copy and save it as .vimrc in your home folder.

" Turn on line numbering. Turn it off with "set nonu"
set nu

" Set syntax on
syntax on

" Indent automatically depending on filetype
filetype indent on
set autoindent

" Case insensitive search
set ic

" Higlhight search
set hls

" Wrap text instead of being on one line
set lbr

" Change colorscheme from default to delek
colorscheme torte

" With both ignorecase and smartcase turned on, a search is case-insensitive if "you enter the search string in ALL lower case.
"However, if your search string has one or more characters in upper case, it will "assume that you want a case-sensitive search.
set ignorecase
set smartcase

incsearch stands for incremental search. It means that you will see what vim matches as you type in each letter of your search string (without having to hit return before search is even attempted).

set incsearch

dircolour setting

dircolors - Set color parameters for ls.
This is my dircolors for my linux machine You can copy and save it .dircolors in your home directory.

# Configuration file for the color ls utility
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.

# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR tty

# Extra command line options for ls go here.
# Basically these ones are:
# -F = show '/' for dirs, '*' for executables, etc.
# -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM rxvt
TERM xterm-color
TERM color-xterm
TERM vt100
TERM dtterm
TERM color_xterm
TERM ansi
TERM screen

# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;37 # directory
LINK 01;36 # symbolic link
FIFO 40;33 # pipe
SOCK 01;35 # socket
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driverBLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 01;05;37;41 # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to

# This is for files with execute permission:
EXEC 01;32

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.sh 01;32
.csh 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z 01;31
.Z 01;31
.gz 01;31
.bz2 01;31
.bz 01;31
.tz 01;31
.rpm 01;31
.cpio 01;31
.jpg 01;35 # image formats
.gif 01;35
.bmp 01;35
.xbm 01;35
.xpm 01;35
.png 01;35
.tif 01;35

11/24/2007

SMTP command

SMTP command
ref: http://www.freesoft.org/CIE/RFC/821/index.htm

HELLO (HELO)
MAIL (MAIL)
RECIPIENT (RCPT)
DATA (DATA)
SEND (SEND)
SEND OR MAIL (SOML)
SEND AND MAIL (SAML)
RESET (RSET)
VERIFY (VRFY)
EXPAND (EXPN)
HELP (HELP)
NOOP (NOOP)
QUIT (QUIT)
TURN (TURN)

11/23/2007

Change Apache Http repose Server header

The purpose of this setting is to hidden apache version

#This setting applies to the entire server, and cannot be enabled or disabled on a virtualhost-by-virtualhost basis.
vi /usr/local/apache/conf/httpd.conf
#I add below ServerName
ServerTokens Prod


More details information
This directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server
as well as information about compiled-in modules.

ServerTokens Prod[uctOnly]
Server sends (e.g.): Server: Apache
ServerTokens Major
Server sends (e.g.): Server: Apache/2
ServerTokens Minor
Server sends (e.g.): Server: Apache/2.0
ServerTokens Min[imal]
Server sends (e.g.): Server: Apache/2.0.41
ServerTokens OS
Server sends (e.g.): Server: Apache/2.0.41 (Unix)
ServerTokens Full (or not specified)
Server sends (e.g.): Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2

9/20/2007

Print out security group

Print out security group

#-----------------------------
# Save the following as sec_grp.vb
#-----------------------------
For Each strGroup In objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN

Select Case strGroupName
Case "Group A"
Case "Group B"
End Select
Next

9/12/2007

Computer(s) that user can log on to the windows domain

Computer(s) that user can log on to the windows domain

#--------------------------------------
#Save the following as user_pc.vb
#--------------------------------------
'This script returns only a list of the computer objects
'found in the Servers OU. How do we know that it returns
'only computer objects? Note the Filter, which specifies
'just one item: Computer.
'Only work for win2k3 and XP because it use ADAM OU

'Set colItems = GetObject ("LDAP://ou=Servers, dc=fabrikam, dc=com")
'colItems.Filter = Array("Computer")

'For Each objItem in colItems
' Wscript.Echo objItem.CN
'Next

'-------------------------------------------------------
Const ForAppending = 8

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\temp\computers.txt", ForAppending, True)

' This one work for win2k enumerate All the Objects in an Active Directory OU
Set colItems = GetObject _
("LDAP://OU=Developers,dc=artificial-life,dc=com")

For Each objItem in colItems
If objItem.class="user" And objItem.AccountDisabled = FALSE Then
Set objUser = GetObject("LDAP://cn=" & objItem.CN &",OU=Developers,dc=artificial-life,dc=com")
'Wscript.Echo objItem.CN
'Wscript.Echo "Log on computer(s): " & objUser.userWorkstations
objTextFile.WriteLine(objItem.CN & vbTab & objUser.userWorkstations)
End If
Next

9/11/2007

Determine the ADsPath for the Logged-On User

Determine the ADsPath for the Logged-On User

#-----------------------
#Save the following as adspath.vb
#-----------------------

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)

Wscript.Echo objUser.AdsPath

#----------------------
#Done
#----------------------
this is an incredibly useful object, one that can return all sorts of information about the logged-on user and the local computer.

The one drawback to this object is the fact that it can only be created locally: you can’t create an instance of ADSystemInfo on a remote computer and then get information about the user logged on to that machine.