Tuesday, January 13, 2009

Minimal GIT guide

1. Create a new branch on the remote git repository

git push origin origin:refs/heads/

e.g git push origin origin:/refs/heads/nemesis-debug

creates a branch called nemesis-debug on the remote repository.

Confirm this by typing git branch -r. Your new respository should appear there.

2. create a local branch to track the newly created remote branch.

git checkout --track -b

e.g git checkout --track -b nemesis-debug origin/nemesis-debug

3. make all necessary changes.

4. commit your changes
a.add files/directories you want to commit
git add
git add .   # adds all the files in the directory recursively

b. commit
git commit -m "commit-message"

c. push all your changes to the repository

git push origin
e.g git push origin nemesis-debug


5. In case you screwed up and want to delete the remote branch 

git push origin :heads/
e.g git push origin :heads/nemesis-debug

Tuesday, January 6, 2009

Memory Optimizations: Kernel Programming

UNLIKE User-space code/data, kernel code/data reside PERMANENTLY in memory. They are NOT swapped Out.

>>> module_init : RUN Time Optimization. Executed when the associated module is loaded. If the module is statically included in the kernel, the kernel can free the module_init routine right at the boot time, after it runs.

>>> module_exit: LINK Time Optimization. It is never executed if the modules are statically included in the kernel. In such cases, it is not needed to include module_exit routines into the kernel image and are discarded at Link Time.


Monday, January 5, 2009

SSH: Logging without Passwords

Here is what to do :-

1. generate a public and private key pair.

ssh-keygen -t rsa -b 4096 -C "comment"

This would generate a 4096 bit long key using RSA encryption mechanism. You can choose to use DSA instead of RSA.

2. When prompted save the key to your home directory.
In my case it would be /home/nemesis/.ssh/id_rsa.pub

3. When prompted for a passphrase, just press enter. Press enter to confirm again. This means a blank password.

4. scp the above generated password file to the remote server.
e.g scp /home/nemesis/.ssh/id_rsa.pub nemesis@remote-server.org:/home/nemesis/

where remote-server.org is the remote machine that I want to login to without using passwords.

5. ON THE Remote machine now.

>Check to see if there is a .ssh folder. If it doesnt exist in your home directory, create it

mkdir -p /home/nemesis/.ssh

Now add your credentials to the authorized lists. Here is how to do it.

cat id_rsa.pub >> .ssh/authorized_keys

6.Logout

7. ssh nemesis@remote-server.org
Voila!!! You are in. No password required.