包含标签 reference articles

comm-用于做文件比较

comm工具

comm工具的主要用途是用来做文件的差集、交集。 工作中,对账是一个频繁的工作项。基本上几十行的数据,人眼就看不过来了。所以使用工具是我们最好的方案。 comm可以为我们很方便的对两个文件做差集、交集。所以我们只要把数据洗成一样的格式后,就可以用comm进行对比了。

……

Continue reading

服务器超时时间和请求队列大小设置

服务器超时时间和请求列表大小关乎程序的健壮性。设置过小,会导致有效的请求被丢掉。 设置过大,严重的情况下会引起雪崩。

超时

很多后台码农对超时时间的设置都没什么概念,特别是刚毕业的后台码农。 一般都是参照前人的代码,设置一个相同的超时,而且一般都是比较大的超时,只要程序能跑就没问题了。

……

Continue reading

pcap-filter手册

网络包过滤语法。tcpdump的expression。

描述

pcap_compile()是用来编译一个字符串到过滤程序的函数。这导致过滤程序可以决定哪些包可以提供给pcap_loop(), pcap_dispatch(), pcap_next(), pcap_next_ex()

……

Continue reading

tcpdump手册

tcpdumpdump网络包。

概要

tcpdump [ -AbdDefhHIJKlLnNOpqRStuUvxX ]
        [ -B buffer_size ] [ -c count ]
        [ -C file_size ] [ -G rotate_seconds ]
        [ -F file ] [ -i interface ]
        [ -j tstamp_type ] [ -m module ]
        [ -M secret ] [ -P in|out|inout ]
        [ -r file ] [ -V file ] [ -s snaplen ]
        [ -T type ] [ -w file ] [ -W filecount ]
        [ -E spi@ipaddr algo:secret,...  ]
        [ -y datalinktype ] [ -z postrotate-command ]
        [ -Z user ]
        [ expression ]

描述

tcpdump打印网络接口上匹配expression网络包的描述内容。另外它可以使用-w参数, 将包数据保存到文件中,以便后期分析,后期可以使用-r参数读文件中取包数据。 它还可以使用-V参数,让它从多个文件中读取。所有情况下,tcpdump只处理匹配expression的包。

……

Continue reading

vim函数feedkeys使用说明

很多人在使用feedkeys函数的时候会得取不预期的输出,怎么折腾也搞不明白为什么会得到 这样的结果。这篇文章来给大家解疑一下。

feedkeys函数文档

feedkeys({string} [, {mode}])				*feedkeys()*
		Characters in {string} are queued for processing as if they
		come from a mapping or were typed by the user.
		By default the string is added to the end of the typeahead
		buffer, thus if a mapping is still being executed the
		characters come after them.  Use the 'i' flag to insert before
		other characters, they will be executed next, before any
		characters from a mapping.
		The function does not wait for processing of keys contained in
		{string}.
		To include special keys into {string}, use double-quotes
		and "\..." notation |expr-quote|. For example,
		feedkeys("\<CR>") simulates pressing of the <Enter> key. But
		feedkeys('\<CR>') pushes 5 characters.
		If {mode} is absent, keys are remapped.
		{mode} is a String, which can contain these character flags:
		'm'	Remap keys. This is default.
		'n'	Do not remap keys.
		't'	Handle keys as if typed; otherwise they are handled as
			if coming from a mapping.  This matters for undo,
			opening folds, etc.
		'i'	Insert the string instead of appending (see above).
		'x'	Execute commands until typeahead is empty.  This is
			similar to using ":normal!".  You can call feedkeys()
			several times without 'x' and then one time with 'x'
			(possibly with an empty {string}) to execute all the
			typeahead.  Note that when Vim ends in Insert mode it
			will behave as if <Esc> is typed, to avoid getting
			stuck, waiting for a character to be typed before the
			script continues.
		'!'	When used with 'x' will not end Insert mode. Can be
			used in a test when a timer is set to exit Insert mode
			a little later.  Useful for testing CursorHoldI.

		Return value is always 0.

说明文档说了这个函数的使用方式,但是对于大部分人,只理解了一部分,帮而会产生很多 不解的行为。这个函数会把参数中的{string}当前是用户输入的。默认的,它会把string 的内容放到预输入的buffer(下面直接引用说明文档中的typeahead buffer)中。 对于不解行为,主要都是由这个typeahead buffer产生了。这个typeahead buffer并不是我 们所熟悉的vim与文档内容关联的buffer,下面会对它进行详细的说明。很多人认为,只要 一调用feedkeys,它就立刻产生作用。例如下面这个例子:

……

Continue reading