Wednesday, November 18, 2009

utc date time

to get the utc date and time of the current system enter "date -u" on the command line.

ascii character code

found this little tidbit to help out a friend.

to find the ascii representation of a character in vim, place the cursor over the character and enter ":ascii".

for more info on this vim feature, enter ":help ascii" in vim.


to accomplish the same thing from the command line, "echo" the character and pipe to "od" (read the man page).

Tuesday, September 22, 2009

Burn cd iso to disk

reference: Burning ISO images

### update 2010-10-01 ###

find cd burning device
>wodim --devices

burn iso to device
>cdrecord -v -eject speed=4 dev=/dev/scd0 /path/to/file.iso

###################

find cd burning device
>cdrecord -scanbus
then
>cdrecord -scanbus dev=ATA

burn iso to device
>cdrecord -v -eject speed=4 dev=ATA:0,2,0 /path/to/file.iso

Thursday, August 27, 2009

Vim RegEx Search and Replace

I have the following text:

obj.getHost()
obj.getYourHost()
obj.setHost()
obj.setYourHost()

I want to change getHost() and setHost() to getMyHost() and setMyHost(). However, I do NOT want to change getYourHost() nor setYourHost().

Following is the regex I constructed to make the change:

:1,4s/\.[sg]et\(Your\)\@!/&My/g

\.[sg]et is the part of the expression that matches either .get or .set
\(Your\)\@! is the part of the expression that is key to matching getHost() but not getYourHost()
& is the part of the expression that takes what is matched and places that match in the replacement
g means to apply the search and replace to all matches on each line


links: Vim Help
Positive and Negative Lookahead

Thursday, July 16, 2009

mount windows network share on linux using cifs

below is the command i used to mount a windows network share on a centos linux system. this is work on any linux distro


> mount -t cifs //nas/share /mnt/point -o user=username,uid=some_user,gid=some_group,rw

Wednesday, July 1, 2009

vimrc customizations

below are the vim customizations I place in my vimrc file

set foldmethod=marker
set nobackup
set nowritebackup
set background=dark
set number

Build Python 2.6 on CentOS 5.3

Build Python 2.6 on CentOS 5.3

download python 2.6.2 tarball
extract python 2.6.2 tarball to /usr/src
E.g., tar -xvjf /share/download/Python-2.6.2.tar.bz2 -C /usr/src

> cd /usr/src/Python-2.6.2
> ./configure
> make

make a symbolic link in /usr/bin for the python 2.6.2 interpreter
> ln -s /usr/src/Python-2.6.2/python /usr/bin/python26

verify that the correct python interpreter is executed
> python26

verify that python 2.6.2 appears in the heading