2007-06-29

the fun continues

/* Convert users input into ascii, hex and decimal. */
I may actually be getting this programming thing down. It started life as a perl script, moved to python, and now its redone in glorious C.
$ cfun 
Usage: cfun [string] [hex] [decimal]
$ cfun syndrowm.com
ascii: syndrowm.com
hex: 73 79 6e 64 72 6f 77 6d 2e 63 6f 6d
dec: 115 121 110 100 114 111 119 109 46 99 111 109
oct: 163 171 156 144 162 157 167 155 56 143 157 155
$ cfun 0x73796e64726f776d2e636f6d
ascii: syndrowm.com
hex: 73 79 6e 64 72 6f 77 6d 2e 63 6f 6d
dec: 115 121 110 100 114 111 119 109 46 99 111 109
oct: 163 171 156 144 162 157 167 155 56 143 157 155

2007-06-22

fedora 7 encrypt a partition

# Encrypt /home
umount /home
$ cryptsetup --verbose --verify-passphrase luksFormat /dev/sda3

WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
$ cryptsetup luksOpen /dev/sda3 /home
$ mkfs.ext3 -j /dev/mapper/home
$ cat /etc/cryptab
home /dev/sda3 none
$ grep home /etc/fstab
#LABEL=/home        /home      ext3    defaults     1 2
/dev/mapper/home /home ext3 defaults 1 2

fedora 7 and sucky ATI drivers

******* Resolution issues/ATI driver issues **************

ati-fglrx driver has issues with xorg reporting version 1.6
Can't we all just get along?

1) downgrade xorg here
$ rpm -U --oldversion xorg-x11-server-Xorg-1.2.0-6.fc7.i386.rpm
2) tell yum not to upgrade xorg
$ exclude=xorg-x11-server-Xorg*
3) create xorg.conf
$ aticonfig --initial
4) update /etc/X11/xorg.conf
...................
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "LCD Panel 1600x1200"
HorizSync 31.5 - 90.0
VertRefresh 60.0 - 60.0
Option "dpms"
EndSection

Section "Monitor"
Identifier "aticonfig-Monitor[0]"
ModeLine "1920x1200" 154.0 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
Option "IgnoreEDID" "true"
EndSection

Section "Device"
Identifier "aticonfig-Device[0]"
Driver "fglrx"
Option "MonitorLayout" "LVDS,AUTO"
Option "VideoOverlay" "off"
Option "OpenGLOverlay" "on"
Option "mtrr" "off"
EndSection

Section "Screen"
Identifier "aticonfig-Screen[0]"
Device "aticonfig-Device[0]"
Monitor "aticonfig-Monitor[0]"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1920x1200" "1680x1050" "1280x1024"
EndSubSection
EndSection

simple python stuff

$ ./maps.py -h
Usage: ./maps.py [-h --help] [-s --specify=arg] [-t --automatic]
Mandatory arguments to long options are mandatory for short options too.
-s --specify=ARGUMENT print specified argument
-a --automatic print predefined
-h --help display this help and exit
$ ./maps.py -a
I like Yahoo maps
$ ./maps.py --automatic
I like Yahoo maps
$ ./maps.py -s amazon
I like amazon maps
$ ./maps.py -s google
Google maps is the BEST!
True that, DOUBLE TRUE!

2007-06-05

objdasm.vim

(objdump syntax highlighting)

8049b5a:   f2 ae                   repnz scas %es:(%edi),%l
8049b5c: 89 c8 mov %ecx,%eax
8049b5e: f7 d0 not %eax
**8049b60: 48 dec %eax ; two *'s will highlight whatver
8049b61: 83 f8 20 cmp $0x20,%eax
8049b64: 74 0a je 8049b70 <__gmon_start__@plt+0xcd0>
8049b66: e8 50 fc ff ff call 80497bb <__gmon_start__@plt+0x91b>
8049b6b: e9 f3 01 00 00 jmp 8049d63 <__gmon_start__@plt+0xec3>
8049b70: 8b 45 cc mov 0xffffffcc(%ebp),%eax
8049b73: 40 inc %eax
8049b74: 0f b6 00 movzbl (%eax),%eax
8049b77: 0f be c0 movsbl %al,%eax
8049b7a: 89 44 24 08 mov %eax,0x8(%esp)
8049b7e: c7 44 24 04 1a a9 04 movl $0x804a91a,0x4(%esp)

$HOME/.vim/filetype.vim
$HOME/.vim/syntax/objdasm.vim
You will need to name the objdump -D output [something].objd