<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>cheatsheet on Bad Fd</title>
    <link>/tags/cheatsheet/</link>
    <description>Recent content in cheatsheet on Bad Fd</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language><atom:link href="/tags/cheatsheet/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>笔记：一些日常cheatsheet</title>
      <link>/posts/db_dailywork_cheatsheet/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/posts/db_dailywork_cheatsheet/</guid>
      <description>&lt;p&gt;日常cheatsheet～&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;run valgrind for a program&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;valgrind --tool=memcheck --leak-check=full --log-file=leak.log --soname-synonyms=somalloc=NONE &amp;lt;some_exe&amp;gt; [&amp;lt;some_exe_args&amp;gt;]
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;run tcpdump to capture mysql queries:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;tcpdump -r /tmp/a.cap -A -S -n -nn  | grep -i -E &amp;quot;select|insert|update|delete|replace&amp;quot; | sed &#39;s%\(.*\)\([.]\{4\}\)\(.*\)%\3%&#39; | less
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;python scripts:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;python -m SimpleHTTPServer 8123
wget -c -r -nH -m --limit-rate=400m &amp;quot;http://ip:8123/xxxx&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;python -c &#39;from zlib import crc32; print crc32(&amp;quot;1476777&amp;quot;) % 1024&#39;
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import json
data = &amp;quot;&amp;quot;
for line in sys.stdin:
        data += line
text = json.loads(data)
print(text)
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tee&lt;/code&gt; with a pipe output to screen and a file&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;echo &amp;quot;hello&amp;quot; | tee abc.txt
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;ps&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;top&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;tasr&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;sar&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    
  </channel>
</rss>
