<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reference on tenfy's blog</title><link>https://tenfy.cn/tags/reference/</link><description>Recent content in Reference on tenfy's blog</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Thu, 30 May 2024 11:41:05 +0800</lastBuildDate><atom:link href="https://tenfy.cn/tags/reference/index.xml" rel="self" type="application/rss+xml"/><item><title>comm-用于做文件比较</title><link>https://tenfy.cn/posts/gnu-comm/</link><pubDate>Thu, 30 May 2024 11:41:05 +0800</pubDate><guid>https://tenfy.cn/posts/gnu-comm/</guid><description>&lt;h1 id="comm工具">comm工具&lt;/h1>
&lt;p>comm工具的主要用途是用来做文件的差集、交集。
工作中，对账是一个频繁的工作项。基本上几十行的数据，人眼就看不过来了。所以使用工具是我们最好的方案。
comm可以为我们很方便的对两个文件做差集、交集。所以我们只要把数据洗成一样的格式后，就可以用comm进行对比了。&lt;/p></description></item><item><title>服务器超时时间和请求队列大小设置</title><link>https://tenfy.cn/posts/server-timeout-queue-size/</link><pubDate>Sat, 09 Mar 2019 12:17:31 +0000</pubDate><guid>https://tenfy.cn/posts/server-timeout-queue-size/</guid><description>&lt;p>服务器超时时间和请求列表大小关乎程序的健壮性。设置过小，会导致有效的请求被丢掉。
设置过大，严重的情况下会引起雪崩。&lt;/p>
&lt;h1 id="超时">超时&lt;/h1>
&lt;p>很多后台码农对超时时间的设置都没什么概念，特别是刚毕业的后台码农。
一般都是参照前人的代码，设置一个相同的超时，而且一般都是比较大的超时，只要程序能跑就没问题了。&lt;/p></description></item><item><title>pcap-filter手册</title><link>https://tenfy.cn/posts/man-pcap-filter/</link><pubDate>Wed, 25 Oct 2017 18:37:48 +0000</pubDate><guid>https://tenfy.cn/posts/man-pcap-filter/</guid><description>&lt;p>网络包过滤语法。&lt;code>tcpdump&lt;/code>的expression。&lt;/p>
&lt;h1 id="描述">描述&lt;/h1>
&lt;p>&lt;code>pcap_compile()&lt;/code>是用来编译一个字符串到过滤程序的函数。这导致过滤程序可以决定哪些包可以提供给&lt;code>pcap_loop()&lt;/code>,
&lt;code>pcap_dispatch()&lt;/code>, &lt;code>pcap_next()&lt;/code>, &lt;code>pcap_next_ex()&lt;/code>。&lt;/p></description></item><item><title>tcpdump手册</title><link>https://tenfy.cn/posts/man-tcpdump/</link><pubDate>Tue, 24 Oct 2017 18:48:09 +0000</pubDate><guid>https://tenfy.cn/posts/man-tcpdump/</guid><description>&lt;p>&lt;code>tcpdump&lt;/code>dump网络包。&lt;/p>
&lt;h1 id="概要">概要&lt;/h1>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>tcpdump &lt;span style="color:#f92672">[&lt;/span> -AbdDefhHIJKlLnNOpqRStuUvxX &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -B buffer_size &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -c count &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -C file_size &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -G rotate_seconds &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -F file &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -i interface &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -j tstamp_type &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -m module &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -M secret &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -P in|out|inout &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -r file &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -V file &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -s snaplen &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -T type &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -w file &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -W filecount &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -E spi@ipaddr algo:secret,... &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -y datalinktype &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -z postrotate-command &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> -Z user &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">[&lt;/span> expression &lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h1 id="描述">描述&lt;/h1>
&lt;p>&lt;code>tcpdump&lt;/code>打印网络接口上匹配expression网络包的描述内容。另外它可以使用&lt;code>-w&lt;/code>参数，
将包数据保存到文件中，以便后期分析，后期可以使用&lt;code>-r&lt;/code>参数读文件中取包数据。
它还可以使用&lt;code>-V&lt;/code>参数，让它从多个文件中读取。所有情况下，&lt;code>tcpdump&lt;/code>只处理匹配expression的包。&lt;/p></description></item><item><title>vim函数feedkeys使用说明</title><link>https://tenfy.cn/posts/vim-feedkeys/</link><pubDate>Sat, 02 Sep 2017 17:42:23 +0000</pubDate><guid>https://tenfy.cn/posts/vim-feedkeys/</guid><description>&lt;p>很多人在使用feedkeys函数的时候会得取不预期的输出，怎么折腾也搞不明白为什么会得到
这样的结果。这篇文章来给大家解疑一下。&lt;/p>
&lt;h1 id="feedkeys函数文档">feedkeys函数文档&lt;/h1>
&lt;pre tabindex="0">&lt;code>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 &amp;#39;i&amp;#39; 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 &amp;#34;\...&amp;#34; notation |expr-quote|. For example,
		feedkeys(&amp;#34;\&amp;lt;CR&amp;gt;&amp;#34;) simulates pressing of the &amp;lt;Enter&amp;gt; key. But
		feedkeys(&amp;#39;\&amp;lt;CR&amp;gt;&amp;#39;) pushes 5 characters.
		If {mode} is absent, keys are remapped.
		{mode} is a String, which can contain these character flags:
		&amp;#39;m&amp;#39;	Remap keys. This is default.
		&amp;#39;n&amp;#39;	Do not remap keys.
		&amp;#39;t&amp;#39;	Handle keys as if typed; otherwise they are handled as
			if coming from a mapping. This matters for undo,
			opening folds, etc.
		&amp;#39;i&amp;#39;	Insert the string instead of appending (see above).
		&amp;#39;x&amp;#39;	Execute commands until typeahead is empty. This is
			similar to using &amp;#34;:normal!&amp;#34;. You can call feedkeys()
			several times without &amp;#39;x&amp;#39; and then one time with &amp;#39;x&amp;#39;
			(possibly with an empty {string}) to execute all the
			typeahead. Note that when Vim ends in Insert mode it
			will behave as if &amp;lt;Esc&amp;gt; is typed, to avoid getting
			stuck, waiting for a character to be typed before the
			script continues.
		&amp;#39;!&amp;#39;	When used with &amp;#39;x&amp;#39; 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.
&lt;/code>&lt;/pre>&lt;p>说明文档说了这个函数的使用方式，但是对于大部分人，只理解了一部分，帮而会产生很多
不解的行为。这个函数会把参数中的&lt;code>{string}&lt;/code>当前是用户输入的。默认的，它会把string
的内容放到预输入的buffer(下面直接引用说明文档中的typeahead buffer)中。
对于不解行为，主要都是由这个typeahead buffer产生了。这个typeahead buffer并不是我
们所熟悉的vim与文档内容关联的buffer，下面会对它进行详细的说明。很多人认为，只要
一调用feedkeys，它就立刻产生作用。例如下面这个例子：&lt;/p></description></item></channel></rss>