Install html2markdown in Ubuntu(12.10)

###Edit source.list
ensure the universe components is enabled.
martin@PC:~/git/blog/_posts$ cat /etc/apt/sources.list
deb http://ubuntu.cn99.com/ubuntu/ quantal main
deb-src http://ubuntu.cn99.com/ubuntu/ quantal main

deb http://ubuntu.cn99.com/ubuntu/ quantal universe
deb-src http://ubuntu.cn99.com/ubuntu/ quantal universe

###update apt
martin@PC:~/git/blog/_posts$ sudo apt-get update

###install
martin@PC:~/git/blog/_posts$ sudo apt-get install python-html2text^C

html2markdown ready

martin@PC:~/git/blog/_posts$ html2markdown –version
html2markdown 3.200.3

Get or Delete Xfrm Policy

##summary
xfrm_get_policy first locate the xfrm policy by policy index(from user space) or policy selector.

  1. if get_policy, alloc a new skb, and encapsulate the xfrm policy to it, then sent it.
  2. if delete policy, call xfrm_audit_policy_delete to delete the plolicy, and call km_policy_notify to notify.

xfrm policy del/get 使用的是同一个函数 xfrm_get_policy.

Read More

Add a Ip Address on a Interface(todo)

##summary
When a ip addr is added, two unicat route entries are added to route table.

  1. a host route entry is added to local table.
    The packet to local host will be routed by this route entry. The route still is valid, even the related interface is shut down.
  2. a connected route is added to main table.
    It is used to forward the packet to the hosts in the same sub network, it will disappear when interface down
  3. two broad cast routes entry also added.

Read More

通过git reflog 找回的commit

Prepare

1
2
3
4
[martin@fc17 git_study]$ git log --oneline 
83e7d89 add lineb in readme <== this commit will be reset hardly
4fd6367 add line1 in readme
bfd590e touch readme
1
2
3
4
5
[martin@fc17 git_study]$ git reset HEAD^ --hard 
HEAD is now at 4fd6367 add line1 in readme
[martin@fc17 git_study]$ git log --oneline
4fd6367 add line1 in readme
bfd590e touch readme
1
2
3
[martin@fc17 git_study]$  cat readme 
line a
通过git reflog 我们可以得到误删除的commit对应的ID

git reflog

1
2
3
4
5
[martin@fc17 git_study]$ git reflog 
4fd6367 HEAD@{0}: reset: moving to HEAD^
83e7d89 HEAD@{1}: commit: add lineb in readme
4fd6367 HEAD@{2}: commit: add line1 in readme
bfd590e HEAD@{3}: commit (initial): touch readme

有了commit ID, 一切就OK了。想干啥都行了 cherry-pick, checkout …

1
2
3
4
5
6
7
8
9
[martin@fc17 git_study]$ git checkout -b try_recover 83e7d89 
Switched to a new branch ‘try_recover’
[martin@fc17 git_study]$ git log —oneline
83e7d89 add lineb in readme
4fd6367 add line1 in readme
bfd590e touch readm
[martin@fc17 git_study]$ cat readme
line a
line b

Get netdevice stat

##call trace

the ‘.show’ method in device_attribute will call the netstat_show,
some of the driver read the part of stat from NIC register,
but most count the stat by software in dev->stat

1
2
3
4
5
> dev_get_stats
> > dev_get_stats
> > > ops = dev->netdev_ops;
> > > > ops->ndo_get_stats64
> > > > > ixgbe_get_stats64,

Read More