2013年3月16日 星期六

Build vim environment

remap is an option that makes mappings work recursively. By default it is on and I'd recommend you leave it that way. The rest are mapping commands, described below:
:map and :noremap are recursive and non-recursive versions of the various mapping commands. What that means is that if you do:
:map j gg
:map Q j
:noremap W j
j will be mapped to gg. Q will also be mapped to gg, because j will be expanded for the recursive mapping. W will be mapped to j (and not to gg) because j will not be expanded for the non-recursive mapping.
Now remember that Vim is a modal editor. It has a normal mode, visual mode and other modes.
For each of these sets of mappings, there is a mapping that works in all modes (:map and :noremap), one that works in normal mode (:nmap and :nnoremap), one in visual mode (:vmap and :vnoremap) and so on.
For more guidance on this, see:
:help :map
:help :noremap
:help recursive_mapping
:help :map-modes 
 
This command will triggle "mouse highlight to yy" function
set mouse=a 

2013年3月15日 星期五

IPSec as a default gateway

IPSec will maintain a table as a routing matching policies as Left -- Right pairs.
Assume 192.168.A.0/24 - 192.168.B.0/24 subnets are ipsec as a secured LAN, and
A wish to use gateway B as a default gateway, it must be set :
1.
A sets left = 192.168.A.0/24 right = 0.0.0.0/0
B sets left = 0.0.0.0/0 right = 192.168.A.0/24
2.
A removes "MASQUERADE" chain from NAT table
B adds 192.168.A.0/24 to MASQUERADE rule into NAT table

Then it is done.


2013年3月3日 星期日

USB packet sniffer

1. command / on device board
Make sure build with "CONFIG_DEBUG_FS" ( which generates /sys/kernel/debug ) "CONFIG_USB_MON" and "CONFIG_USB_DEBUG" (which generates /sys/kernel/debug/usbmon)
1.a
mount -t debugfs none_debugs /sys/kernel/debug
modprobe usbmon / insmod usbmon
1.b
cat /sys/kernel/debug/usbmon/1u
1u ==> by the bus number
 
2. With wireshark on PC
3. With USB sniffer tool
4. Test unit ready
sdparm --command=ready /dev/sda1