22 October 2009

Network Frames

ALL
Ethernet 802.11 ARP
IP ICMP
TCP UDP

















Reference:
http://jennifermadden.com/javascript/window1.html

21 October 2009

Flo Rida n Kesha - Right Round

(Flo Rida)
You spin my head right round, right round
When you go down, when you go down down...
(Kesha)
You spin my head right round, right round
When you go down, when you go down down...

(Flo Rida)
Heyy!
Hopped out of that house with my swagger
Hop in that with girl, I got places to go!
People to see, time is precious
I look at my crowd and they out of control
Just like my mind where I'm going
No women, no shorties, no nothin but clothes
No stoppin now, my parolees on role
I like my jewlrey, that's always on gold
I know the storm is comin
My pockets keep tellin me it's gonna shower
Call up my homies that's home
Then pop in the night cuz it's meant to be ours
We keep a fade away shot cuz we ballin
it's platinum patrone that be ours
Lil mama, I owe you just like the flowers
Girl you to drink with all that and power clubs

(Flo Rida)
You spin my head right round, right round
When you go down, when you go down down...
(Kesha)
You spin my head right round, right round
When you go down, when you go down down...

(Flo Rida)
From the top of the pole I watch her go down
She got me throwin my money around
Ain't nothin more beautiful to be found
It's goin down down...
From the top of the pole I watch her go down
She got me throwin my money around
Ain't nothin more beautiful to be found
It's goin down down...

(Flo Rida)
Heyy!
Shawty must know I'm not playin
My money love her like a numba one fan
Don't look at my mouth, let her talk to my fans
My Benjamin Franklins...
A couple of grands, I got rubberbands
My paper planes makin a dance
Get dirty all night, that's part of my thing
Keep building castles that's made out of sand
She's amazing, the fire blazing
Hotter than cajun
Girl won't you move a lil closer?
Time to get paid, it's maximum wage
That body belong on a poster
I'm in a daze, that bottom is wavin' at me
Like damnit I know you
You wanna show like a gun out of holster
Tell me whatever and I'll be your roper cuz...

(Flo Rida)
You spin my head right round, right round
When you go down, when you go down down...
(Kesha)
You spin my head right round, right round
When you go down, when you go down down...

(Flo Rida)
From the top of the pole I watch her go down
She got me throwin my money around
Ain't nothin more beautiful to be found
It's goin down down...
From the top of the pole I watch her go down
She got me throwin my money around
Ain't nothin more beautiful to be found
It's goin down down...

(Flo Rida)
Yeah!
I'm spendin my money
I'm out of control
Somebody help me
She's takin my bank roll.
But I'm king of the club
And I'm wearin the crown
Poppin these bottles
Touchin these models
Watchin they asses go down down....(echo)

(Flo Rida)
You spin my head right round, right round
When you go down, when you go down down...
(Kesha)
You spin my head right round, right round
When you go down, when you go down down...
(Flo Rida)
You spin my head right round, right round
When you go down, when you go down down...
(Kesha)
You spin my head right round, right round
When you go down, when you go down down...

15 October 2009

Brain Teaser - 2



Reference:
download the executable Extractaflash

View the code

linux module initialisation

1. “module_init” and “__initcall” will be added into a new section called “.initcall6.init”

2. The macro “__initcall” and “module_init” (include/linux/init.h) will group all such functions into a single section called “.initcall6.init” and all these functions get executed on system bootup by the function “do_initcalls” (init/main.c)

3. init() -> do_basic_setup() -> do_initcalls()

4. The functions will be collected between the symbols “__early_initcall_end” and “__initcall_end” in the file (arch/x86/kernel/vmlinux.lds.S -> arch/x86/kernel/vmlinux.lds)

5. All the __initcalls are arranged in kernel the range from 0 to 7. Hence kernel does the initialization in order

14 October 2009

Reverse bits the easy way

typedef unsigned int uint;
uint reverse(uint val)
{
int i;
uint tval=0;

for(i=0; i<sizeof(val)*8; i++)
{
tval <<= 1;
tval |= val&1;
val >>= 1;
}

return tval;
}
typedef unsigned int uint;
uint reverse(uint val)
{
char i;
uint tval=0;

for(i=sizeof(val)*8; val; i--)
{
tval <<= 1;
tval |= val&1;
val >>= 1;
}

return (tval<<i);
}

Reference:
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive

12 October 2009

script remove unwanted folders from linux kernel

----------------------script.sh----------------------
#!/bin/sh

ARCHDIRS="alpha blackfin h8300 m68knommu mn10300 s390 arm \
cris m32r microblaze parisc sh avr32 frv ia64 m68k mips \
powerpc sparc xtensa"

for DIR in $ARCHDIRS; do
echo "deleting $DIR"
rm -rf arch/$DIR
done

rm -rf Documentation

DOCDIRS=" / accounting auxdisplay connector DocBook \
filesystems ia64 networking pcmcia spi video4linux vm \
watchdog"

for DIR in $DOCDIRS; do
echo "creating Documentation/$DIR/Makefile"
mkdir -p Documentation/$DIR
touch Documentation/$DIR/Makefile
done
-----------------------------------------------------

make a mininal linux kernel from Fedora Core 11

1. allocate 12GB of HDD space
2. Install FC11 on VMware
3. Review and modify partitioning layout
4. Delete VolGroup, sda1 and sda2 partitions
5. Create 512MB swap space
6. Create EXT3 file system and mount pount "/"
7. Select "customize now" for software selection
8. Un-select everything in software selection
9. A total of 179 packages will get installed.

mkdir /mnt/cdrom
vi /etc/fstab
>> /dev/cdrom /mnt/cdrom iso9660 defaults 0 0
mount /dev/cdrom
cd /mnt/cdrom/Pakages
rpm -ivh createrepo + DEPENDENCY FILES
rpm -ivh yum + DEPENDENCY FILES
cd /mnt
createrepo .

cd /etc/yum.repos.d/
vi fedora.repo >> enabled=0
vi fedora-updates.repo
>> baseurl=file:///mnt
>> #baseurl
>> #mirrorurl
>> enabled=1
>> gpgcheck=0

yum install ftp make which vim ctags gcc ncur* man-pages
yum install dhclient bzip2 kerenal-devel man ntsysv gpm
yum install openssl* ...

vi /etc/syscofig/network-scripts/ifcfg-eth0
>> DEVICE=eth0
>> BOOTPROTO=dhcp
>> ONBOOT=yes

mv /bin/vi{,.old}
ln -s /usr/bin/vim /bin/vi

vi /sbin/mkinitrd
>> after "mknod /dev/hvc0 c 229 0"
>> mknod /dev/sda b 8 0
>> mknod /dev/sda1 b 8 1
>> mknod /dev/sda2 b 8 2
vi /etc/fstab
>> /dev/sda1 / ext3 defaults 0 0
>> /dev/sda2 swap swap defaults 0 0
Download the config file for 2.6.31 from here.
Download the config file for 2.6.31 (with S/W shutdown) from here
cd /usr/src/kernels
tar xjvf linux-2.6.31.tar.bz2
mv config.31 .config
make oldconfig
make
make modules_install
make install
You can get the sample make log file from here
vi /boot/grub/grub.conf
>> default=0
>> timeout=10
>> #hiddenmenu
>> # ... rghb quiet