Cheatsheet

共 55 篇文章。

sh与csh中的算符优先顺序

• Cheatsheets

第一个脚本(1.sh):
#!/bin/sh
echo test
exit 1

测试命令:./1.sh | grep test && echo 1

csh:
./1.sh | grep test && echo e
test

sh:
./1.sh | grep test && echo e
test
e

阅读全文… ( 本文约 170 字,阅读大致需要 1 分钟 )

如何复位TP-LINK TL-WR541G无线路由器

• Cheatsheets

注:这篇文章属于作弊条性质,本人不负责其内容所依据理论之正确性。

a. 路由器重置方法:断电,用笔按住背面的RESET按钮,并接上电源,直至路由器提示灯都变成正常的样子为止。
b. 路由器默认IP为192.168.1.1,用户名和口令均为admin。

阅读全文… ( 本文约 158 字,阅读大致需要 1 分钟 )

记录一下如何卸载IE7 beta版本

• Cheatsheets

愈发习惯FreeBSD下的生活之后,用Windows反而时常感觉不爽。例如最近微软推出的Internet Explorer 7的Beta 3,竟然不允许从Beta 2直接覆盖升级,实在让人感觉十分不快。

阅读全文… ( 本文约 176 字,阅读大致需要 1 分钟 )

Tips about writing a manpage

• Cheatsheets

From des@:

groff -Tlatin1 -mdoc strtonum.3 2>&1 | less

A even better version from ru@:

cd /usr/src/lib/libc
make manlint MAN=strtonum.3 # to check stderr
make all-man MAN=strtonum.3 -DMANBUILDCAT # to format

参与评论

My misunderstanding of OpenLDAP API

• Development

I used to think that ldap_unbind() is the opposite of ldap_bind(), however I was wrong. Pierangelo Masarati (ando at openldap) pointed out that it was actually opposite of ldap_init(). So, do NOT expect init() -> bind() -> search() -> unbind() -> bind() would success, it’s simply wrong thing. You do not need to unbind() before you do another bind().

Just make a note.

参与评论

keys of (j),(z), etc. in FreeBSD scheduler related stuff's comments

• Cheatsheets

You can obtain latest list from sys/sys/proc.h:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

 * Below is a key of locks used to protect each member of struct proc.  The
 * lock is indicated by a reference to a specific character in parens in the
 * associated comment.
 *      * - not yet protected
 *      a - only touched by curproc or parent during fork/wait
 *      b - created at fork, never changes
 *              (exception aiods switch vmspaces, but they are also
 *              marked 'P_SYSTEM' so hopefully it will be left alone)
 *      c - locked by proc mtx
 *      d - locked by allproc_lock lock
 *      e - locked by proctree_lock lock
 *      f - session mtx
 *      g - process group mtx       
 *      h - callout_lock mtx
 *      i - by curproc or the master session mtx
 *      j - locked by sched_lock mtx
 *      k - only accessed by curthread
 *      l - the attaching proc or attaching proc parent
 *      m - Giant
 *      n - not locked, lazy
 *      o - ktrace lock
 *      p - select lock (sellock)
 *      q - td_contested lock
 *      r - p_peers lock
 *      x - created at fork, only changes during single threading in exec
 *      z - zombie threads/ksegroup lock
参与评论

Why you should not hide version.bind?

• Security

This article has suggested a way of hiding version.bind string. From a security perceive, this is an overkill and can usually be harmful:

  • While it’s true that you can hide version.bind, the fact that version.bind is can be queried reveals that you are running BIND. It makes little sense to fake a version.
  • The need of hiding information, which is unnecessarily hidden like this, means that the system administrator is neglecting security.
  • Therefore, FOREACH(version.bind is queriable and is hidden) HACKEM :-)

Security can NOT be built on what others are not aware of.

参与评论