Monday, October 31, 2011

Setup SVN email notification

http://help.joyent.com/index.php?pg=kb.page&id=53

step1:
copy the post-commit.tmpl to file post-commit

step2:
edit post-commit file

comment out
# "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf

add
/usr/local/bin/svnnotify -r $REV -C -d -H HTML::ColorDiff -p $REPOS -t emailList --from emailList --reply-to emailList

step3:
chomod a+x post-commit

Friday, October 28, 2011

PAE

http://en.wikipedia.org/wiki/Physical_Address_Extension

ULK page 51

Thursday, October 27, 2011

Experiments with the Linux Kernel: Process Segments

http://linuxgazette.net/112/krishnakumar.html

Tuesday, October 25, 2011

spell checking on VIM

http://edwinux.blogspot.com/2011/03/vim-usage-spell-checking.html

Monday, October 24, 2011

How to create a SVN repository

This is from my Advanced programming class notes:


Subversion (svn) is a source code version management system.  Such a
system is most useful when you work in a team, but even when you’re
working alone, it’s a very useful tool to keep track of the changes
you have made to your code.
In this class, the use of a version control system is required.  If
you are already familiar with another system such as Perforce or
BitKeeper, you can talk to me about using them instead of svn.  (But
not cvs.  I want cvs users to switch to svn in this class.) You’ll
learn the basics of svn in this part of the lab assignment.
(a) Creating the Subversion source repository
The first thing you need to do is to create a repository under your
home directory so that svn can store revision histroy of your files.
    $ cd ˜
    $ mkdir svnrepos
    $ chmod 700 svnrepos
    $ svnadmin create ˜/svnrepos
(b) Adding a directory to the repository
This process creates a subdirectory in your svn repository.  We create
a subdirectory called "cs3157" which will house all our code in this
class.
    $ cd ˜
    $ svn mkdir file://$HOME/svnrepos/cs3157
svn will start your editor to ask you to say something about what
you’re doing.  Type "create cs3157 subdirectory" on the 1st line, save
and quit the editor.  You do this everytime you "commit" a change to
the svn repository.
You can list the content of your repository using:
    $ svn list file://$HOME/svnrepos
(c) Checking out cs3157 directory into a local working directory
Note that we created the cs3157 "subdirectory" in the repository, not
in your home directory.  In fact, cs3157 is a subdirectory in the
repository in a logical sense; if you look in ˜/svnrepos, you won’t
find any directory named cs3157.
Now we will create a physical "working copy" of the cs3157
subdirectory by "checking it out".
    $ cd ˜
    $ svn checkout file://$HOME/svnrepos/cs3157Now you can see there is a physical directory cs3157 under your home
directory.  Go into it and see what’s in there.
    $ cd ˜/cs3157
    $ ls -alp
Note that the directory contains a subdirectory called ".svn".
Subversion uses that directory to manage your working directory.  This
directory should be included in your submissions so that we can verify
that you’re using svn correctly.
(d) Creating and adding a directory for this lab session
    $ cd ˜/cs3157
    $ mkdir lab1
    $ svn add lab1
Or in one step,
    $ cd ˜/cs3157
    $ svn mkdir lab1
Your action of adding the lab1 directory to the svn repository is now
pending.  Type "svn status" to see what’s pending.
You "commit" your changes by:
    $ svn commit

(e) Adding files
Let’s add part2 directory first:
    $ cd ˜/cs3157/lab1
    $ svn mkdir part2
    $ cd part2
Now you are ready to write code!  Using your editor, write hello.c and
add it to the respository.
    $ vim hello.c
 
        #include <stdio.h>
        int main() {
            puts("hello world!");
            return 0;
        }
    $ svn add hello.c
Try compiling and running:
    $ gcc -g -Wall -o hello hello.c
    $ ./hello
Finally, commit the change you’ve made.    $ svn commit
(f) Other svn commands
To see the status of your files in the current directory in relation
to the repository:
    $ svn status
To see the difference between your working files and the latest
committed versions in the repository:
    $ svn diff
To print out log information:
    $ svn log hello.c
If you want to abandon the changes you made to your working copy, and
revert the file into the version last commited to svn (losing all your
changes!!!):
    $ svn revert hello.c
You can delete a file with "svn rm" command.  Type:
    $ svn rm hello.c
If you do "ls", you’ll see that your local copy of hello.c is gone.
However, the deletion is still pending, since you did not commit your
action yet.  You can get back your hello.c by typing:
    $ svn revert hello.c
You can see a manual page of any svn command using "svn help".  Try:
    $ svn help
    $ svn help status
Lastly, "svn update" command is normally used for collaboration.  For
example if you were working in a team working on a same set of code,
you would typically issue "svn update" in the beginning of your day to
bring in your teammates’ commited changes.

Wednesday, October 12, 2011

How to Extract the disk image from the USB thumb drive

$ mount
you should see the USB thumb drive mounted
/dev/disk3s1 on /Volumes/JIANG-USB

Before you extract the USB disk image, you should unmount the disk. Otherwise, it give you device busy message.
$ sudo umount /dev/disk3s1
For mac:
$ sudo diskutil unmount /dev/disk3s1

Then you could use dd to extract the USB disk image:
$ dd if=/dev/disk3s1 of=~/USB_Image.raw

How to compare two disk RAW images

use tool Autopsy!
here is the couse website:
http://www.cs.gmu.edu/~astavrou/ISA785_F11.html
In week 2, CERT Forensic Tools is an wmare image which has Autopsy inside of the VM.
Analysis of disk images by using Autopsy

convert vmware VMDK disks to RAW format that is used as an input to the forensics programs (including Autopsy).

How to convert vmware VMDK diks to RAW format(used us an input tor forensics including Autopsy)


1) Install QEMU, a program that can covert vmware VMDK disks to RAW format that
is used as an input to the forensics programs (including Autopsy). 
The command for that is: 
$ yum install qemu (remember to enable networking on the CERT virtual machine if it is no on).

2) Execute $ qemu-img convert -O raw linux.vmdk raw-linux.bin 
(from the shared folders directory "linux.vmdk" is the infected VM Disk)

Tuesday, October 11, 2011

Basic Unix Command and VIM tutorial

Source: http://freeengineer.org/learnUNIXin10minutes.html

Tuesday, October 4, 2011

VIM on Mac

Page up and down of
Ctrl + b
Ctrl + f

mouse activate in VIM on Mac
just press the alt key.
http://superuser.com/questions/125102/mac-os-x-terminal-mouse-support

Install QEMU on CentOS 5.5

If you don't want to install it form source, you could simply do:  $ yum install qemu


install it from source:
http://fengweizhang.blogspot.com/2012/03/install-qemu.html

or

Download QEMU version: qemu-0.12.5.tar.gz from wiki.qemu.org/Download
$ tar -xvzf qemu-0.12.5.tar.gz
$ cd qemu-0.12.5
$ ./configure
$ make
$ make install

Note: May have ./configure error saying missing glib-2.0 library. Please go to following website, add the i686 repository to current OS.
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
Download it, and install it
Then do:
$ yum install glib2-devel.i386
$ yum install blid2.i386