<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

    <channel>
        <title>AppleLin的博客</title>
        <link>https://applelin8.github.io/</link>
        <description>基于 jekyll 的 Github Pages 个人博客网站，技术的学习、总结、分享与提升
</description>
        <lastBuildDate>Fri, 19 Mar 2021 16:24:13 +0800</lastBuildDate>
        
        <item>
            <title>ida demo</title>
            <link>
                https://applelin8.github.io//2021/02/11/ida-demo
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;问题&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;分析&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;解决方案&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#3.1&quot;&gt;方法一&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;问题-&quot;&gt;问题 &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;用 ida 修改 demo.exe, 改变 demo.exe的运行。&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//demo.exe&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//#define _CRT_SECURE_NO_WARNINGS&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;scanf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a &amp;gt; 0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//IDA把&#39;a&#39;改成&#39;n&#39;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;n &amp;lt; 0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;反汇编修改a--0为n0-&quot;&gt;反汇编修改a &amp;gt; 0为n&amp;gt;0 &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;用ida打开demoexe&quot;&gt;用ida打开demo.exe.&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/1_new.png&quot; alt=&quot;image-20210211134817737&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/pe_32.png&quot; alt=&quot;image-20210211163045476&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Graph view&lt;/p&gt;

&lt;h2 id=&quot;ida-view-a&quot;&gt;IDA View-A&lt;/h2&gt;

&lt;p&gt;看到 aA0是 “a &amp;gt; 0”&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/aA0.png&quot; alt=&quot;image-20210211163253964&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/ida_view.png&quot; alt=&quot;image-20210211163431524&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Hex view&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/hex_view.png&quot; alt=&quot;image-20210211163456000&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/hex.png&quot; alt=&quot;image-20210211163633880&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;查看哪里调用-了a--0&quot;&gt;查看哪里调用 了”a &amp;gt; 0”&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/2_pe.png&quot; alt=&quot;image-20210211135555604&quot; /&gt;&lt;/p&gt;

&lt;p&gt;string view&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/string.png&quot; alt=&quot;image-20210211160226746&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/str1.png&quot; alt=&quot;image-20210211160344163&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ctrl + f ,  find a &amp;gt; 0&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/find.png&quot; alt=&quot;image-20210211160440641&quot; /&gt;&lt;/p&gt;

&lt;p&gt;g + 00403003&lt;/p&gt;

&lt;p&gt;ctrl+x&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/ref.png&quot; alt=&quot;image-20210211160714787&quot; /&gt;&lt;/p&gt;

&lt;p&gt;view -&amp;gt; Open subviews -&amp;gt; Hex dump&lt;/p&gt;

&lt;p&gt;F5&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/ida/Pseudocode-A.png&quot; alt=&quot;image-20210211171330526&quot; /&gt;&lt;/p&gt;

&lt;p&gt;新年快乐&lt;/p&gt;


            </description>
            <pubDate>Thu, 11 Feb 2021 17:27:45 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2021/02/11/ida-demo
            </guid>
        </item>
        
        <item>
            <title>shuffle string</title>
            <link>
                https://applelin8.github.io//2021/01/26/shuffle-string
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;问题&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;分析&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;解决方案&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#3.1&quot;&gt;方法一&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;问题-&quot;&gt;问题 &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://leetcode-cn.com/problems/shuffle-string&quot; title=&quot;https://leetcode-cn.com/problems/shuffle-string&quot;&gt;shuffle-string&lt;/a&gt;
给你一个字符串 s 和一个 长度相同 的整数数组 indices 。
请你重新排列字符串 s ，其中第 i 个字符需要移动到 indices[i] 指示的位置。
返回重新排列后的字符串。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;示例 1：&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;输入：s = &quot;codeleet&quot;, indices = {4,5,6,7,0,2,1,3}
输出：&quot;leetcode&quot;
解释：如图所示，&quot;codeleet&quot; 重新排列后变为 &quot;leetcode&quot; 。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;示例 2：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;输入：s = &quot;abc&quot;, indices = {0,1,2}
输出：&quot;abc&quot;
解释：重新排列后，每个字符都还留在原来的位置上。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;示例 3：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;输入：s = &quot;aiohn&quot;, indices = {4,1,3,0,2}
输出：&quot;nihao&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;示例 4：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;输入：s = &quot;aaiougrt&quot;, indices = {4,0,2,6,7,3,1,5}
输出：&quot;uairtoag&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;示例 5：&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;输入：s = &quot;art&quot;, indices = {1,0,2}
输出：&quot;rat&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;分析-&quot;&gt;分析 &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;You can create an auxiliary string t of length n.&lt;/p&gt;

&lt;p&gt;Assign t[i] to s[indexes[i]] for each i from 0 to n-1.&lt;/p&gt;

&lt;h1 id=&quot;解决方案-&quot;&gt;解决方案 &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;方法一-&quot;&gt;方法一 &lt;span id=&quot;3.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;private:&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/* data */&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;public:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;cm&quot;&gt;/* args */&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;test0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;test1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;test4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;codeleet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;aiohn&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;abc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;aaiougrt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;art&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;cm&quot;&gt;/* args */&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::~&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;restoreString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;cout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;error: s: %lu != %lu vector&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;argc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[])&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Solution&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

            </description>
            <pubDate>Tue, 26 Jan 2021 12:30:08 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2021/01/26/shuffle-string
            </guid>
        </item>
        
        <item>
            <title>Fuzzing Embedded Linux Devices</title>
            <link>
                https://applelin8.github.io//2020/12/20/fuzz-embed-device
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;This article is from a personal blog,Reprint please affirm&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;highlight&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;highlight-&quot;&gt;highlight &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;hello&lt;/p&gt;


            </description>
            <pubDate>Sun, 20 Dec 2020 18:30:08 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/20/fuzz-embed-device
            </guid>
        </item>
        
        <item>
            <title>git cherry-pick</title>
            <link>
                https://applelin8.github.io//2020/12/16/git-cherry-pick
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;This article is from a personal blog &lt;a href=&quot;https://applelin8.github.io/2020/12/16/git-cherry-pick&quot;&gt;https://applelin8.github.io/2020/12/16/git-cherry-pick&lt;/a&gt;，Reprint please affirm&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;highlight&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;highlight-&quot;&gt;highlight &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;创建一个新分支,&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#基于当前分支创建新分支&lt;/span&gt;
git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; &amp;lt;new-branch-name&amp;gt;
&lt;span class=&quot;c&quot;&gt;#基于历史commit id创建分支&lt;/span&gt;
git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; &amp;lt;new-branch-name&amp;gt; &amp;lt;SHA1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;checkout之前的一个commit并开一个branch指向它了.&lt;/p&gt;

&lt;p&gt;在Git中创建分支，是必须有一个父节点的.默认是HEAd节点.
git 场景 ：从一个分支cherry-pick多个commit&lt;/p&gt;

&lt;h1 id=&quot;example-&quot;&gt;example &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;场景&quot;&gt;场景：&lt;/h2&gt;

&lt;p&gt;在branch1开发，进行多个提交，这时切换到branch2，想把之前branch1分支提交的commit都【复制】过来，怎么办？&lt;/p&gt;

&lt;h2 id=&quot;创建分支branch2-&quot;&gt;创建分支branch2 &lt;span id=&quot;2.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;查看所有分支&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; branch1
  remotes/origin/HEAD -&amp;gt; origin/branch1
  remotes/origin/branch1
  remotes/origin/branch2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;创建分支&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;## 切换分支 &amp;lt;span id=&quot;2.2&quot;&amp;gt;&lt;/span&gt;
git checkout remotes/origin/branch2

&lt;span class=&quot;c&quot;&gt;#创建新分支&lt;/span&gt;
git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; branch2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看分支&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; branch2
  branch1
  remotes/origin/HEAD -&amp;gt; origin/branch1
  remotes/origin/branch1
  remotes/origin/branch2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;首先切换到分支-branch1-然后查看提交历史记录-&quot;&gt;首先切换到分支 branch1, 然后查看提交历史记录 &lt;span id=&quot;2.3&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 切换分支&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout branch1
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch 
&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; branch1
  branch2

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;git log&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$find&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-size&lt;/span&gt; +100M |grep &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; git|xargs &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; % &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sh&lt;/span&gt; %
2.9G ./out/apple.iso
816M ./apple.tar

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git  log &lt;span class=&quot;nt&quot;&gt;--oneline&lt;/span&gt;  ./apple.tar
02a7492 add apple
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git  log &lt;span class=&quot;nt&quot;&gt;--oneline&lt;/span&gt;  ./out/apple.iso
8c3c7e0 apple iso
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git log &lt;span class=&quot;nt&quot;&gt;--oneline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; log_sha.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;切换到分支branch2-&quot;&gt;切换到分支branch2 &lt;span id=&quot;2.4&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git checkout branch2

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;复制指定提交-&quot;&gt;复制指定提交 &lt;span id=&quot;2.5&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;cherry-pick用法&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#复制单个commit&lt;/span&gt;
git cherry-pick &amp;lt;commitHash&amp;gt;
&lt;span class=&quot;c&quot;&gt;#复制多个commit&lt;/span&gt;
git cherry-pick &amp;lt;commitA_Hash&amp;gt; &amp;lt;commitB_Hash&amp;gt;
&lt;span class=&quot;c&quot;&gt;#复制多个连续commit 注意，不包含第一个commit0_Hash ， 即  git cherry-pick (commit0_Hash..commit100_Hash]&lt;/span&gt;
git cherry-pick &amp;lt;commit0_Hash&amp;gt;..&amp;lt;commit100_Hash&amp;gt;
&lt;span class=&quot;c&quot;&gt;#包含第一个commit0_Hash方法&lt;/span&gt;
git cherry-pick &amp;lt;commit0_Hash&amp;gt;^..&amp;lt;commit100_Hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;用git cherry-pick复制&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git cherry-pick 5396bf8^..8c3c7e0
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; ./out/apple.iso
git add &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt;
git status
git commit &lt;span class=&quot;nt&quot;&gt;--amend&lt;/span&gt;
git log &lt;span class=&quot;nt&quot;&gt;--oneline&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;demo-&quot;&gt;demo &lt;span id=&quot;2.6&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#set -vx&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;SCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;readlink&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dirname&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/hash_git_log.txt
&lt;span class=&quot;nv&quot;&gt;GIT_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SCRIPT_PATH&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/demo

check_ret&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;ret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$?&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ne&lt;/span&gt; 0 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;error] ret &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

is_stop_hash&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;8c3c7e0&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;error] &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;: 8c3c7e0
        &lt;span class=&quot;nb&quot;&gt;exit
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

get_line_no&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;ret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;/&#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;/{print NR}&#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ret&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

get_hash&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt;|awk &lt;span class=&quot;s1&quot;&gt;&#39;{print $1}&#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

show_hash_line_no&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;get_line_no &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;info] &lt;span class=&quot;nv&quot;&gt;$number&lt;/span&gt; : &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

parse_line&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt;|awk &lt;span class=&quot;s1&quot;&gt;&#39;{print $1}&#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;#discard &quot;add linux 4.20 kernel&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;add linux 4.20 kernel&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;warn] &lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return
    fi

    &lt;/span&gt;show_hash_line_no &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
    is_stop_hash &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;Merge&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;git cherry-pick &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 1 &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
        git cherry-pick &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 1 &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$?&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ne&lt;/span&gt; 0 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;then
            &lt;/span&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt;
            git clean &lt;span class=&quot;nt&quot;&gt;-df&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;fi
    else
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;git cherry-pick &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
        git cherry-pick &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;
        check_ret
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

read_file&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;number_from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;get_line_no &lt;span class=&quot;nv&quot;&gt;$from&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;number_to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;get_line_no &lt;span class=&quot;nv&quot;&gt;$to&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$number_from&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;,&#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$number_to&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;&#39;&lt;/span&gt;p &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;|while &lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;line
    &lt;span class=&quot;k&quot;&gt;do
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
        parse_line &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

main&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$GIT_PATH&lt;/span&gt;
    read_file
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

main

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Wed, 16 Dec 2020 08:30:38 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/16/git-cherry-pick
            </guid>
        </item>
        
        <item>
            <title>template blog</title>
            <link>
                https://applelin8.github.io//2020/12/16/template-blog
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;This article is from a personal blog &lt;a href=&quot;https://applelin8.github.io/2020/12/16/template-blog&quot;&gt;https://applelin8.github.io/2020/12/16/template-blog&lt;/a&gt;，Reprint please affirm&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;highlight&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;highlight-&quot;&gt;highlight &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;hello&lt;/p&gt;


            </description>
            <pubDate>Wed, 16 Dec 2020 08:30:08 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/16/template-blog
            </guid>
        </item>
        
        <item>
            <title>find by size</title>
            <link>
                https://applelin8.github.io//2020/12/16/find-by-size
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;This article is from a personal blog &lt;a href=&quot;https://applelin8.github.io/2020/12/16/find-by-size&quot;&gt;https://applelin8.github.io/2020/12/16/find-by-size&lt;/a&gt;，Reprint please affirm&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;highlight&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;highlight-&quot;&gt;highlight &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Olevel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;help&lt;/span&gt;|tree|search|stat|rates|opt|exec|time] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;path...] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;expression]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查找当前目录下文件大小大于1M的文件&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find ./ &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;nt&quot;&gt;-size&lt;/span&gt; +1M
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查找当前目录下文件大小大于10M的文件,并显示它们的详细信息.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-size&lt;/span&gt; +10M &lt;span class=&quot;nt&quot;&gt;-ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;搜索当前目录中，所有过去10分钟中更新过的普通文件。如果不加-type f参数，则搜索普通文件+特殊文件+目录。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; find &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-type&lt;/span&gt; f &lt;span class=&quot;nt&quot;&gt;-mmin&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;搜索当前目录中大于10M的文件,并显示详细信息.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-size&lt;/span&gt; +10M |xargs &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; % &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ahl&lt;/span&gt; %
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Wed, 16 Dec 2020 07:30:08 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/16/find-by-size
            </guid>
        </item>
        
        <item>
            <title>linux ko</title>
            <link>
                https://applelin8.github.io//2020/12/15/linux-ko
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/15/linux-ko&quot;&gt;https://applelin8.github.io/2020/12/15/linux-ko&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;highlight&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;make&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;highlight-&quot;&gt;highlight &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;linux 系统ko模块编译。
note:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;kernel dir&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Makefile
 Kbuild Makefile 的一个最主要功能就是指定编译什么，这个功能是通过下面两个对象指定的obj-? 和$(module_name)-objs 
    例如：&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-makefile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   &lt;span class=&quot;nv&quot;&gt;obj-y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; example.o &lt;span class=&quot;c&quot;&gt;#编译o&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;obj-m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(module_name)&lt;/span&gt;.o &lt;span class=&quot;c&quot;&gt;#编译ko&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;$(module_name)-objs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; a.o b.o c.o &lt;span class=&quot;c&quot;&gt;#编译基于的目标文件a.o b.o c.o&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;makefile的关键&lt;/strong&gt;：&lt;/p&gt;

&lt;p&gt;首先 obj-m指定模块名 $(module_name)，&lt;/p&gt;

&lt;div class=&quot;language-makefile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   &lt;span class=&quot;nv&quot;&gt;obj-m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(module_name)&lt;/span&gt;.o 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后,&lt;/p&gt;

&lt;p&gt;如果内核模块是通过几个源文件编译而成的,&lt;/p&gt;

&lt;p&gt;再根据模块名$(name)-objs:=依赖的文件。&lt;/p&gt;

&lt;div class=&quot;language-makefile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   &lt;span class=&quot;nv&quot;&gt;$(module_name)-objs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; a.o b.o c.o
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Makefile example&lt;/p&gt;

&lt;div class=&quot;language-makefile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   &lt;span class=&quot;nl&quot;&gt;.PHONY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;clean all&lt;/span&gt;

   &lt;span class=&quot;c&quot;&gt;#variable
&lt;/span&gt;   &lt;span class=&quot;nv&quot;&gt;KDIR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;~/apple/kernel-4.15.4
   &lt;span class=&quot;nv&quot;&gt;MAKE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;make
   &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;demo
   &lt;span class=&quot;c&quot;&gt;#$(info name=$(name))
&lt;/span&gt;   
   &lt;span class=&quot;k&quot;&gt;ifneq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;($(KERNELRELEASE),)&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;obj-m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$(name)&lt;/span&gt;.o
   &lt;span class=&quot;nv&quot;&gt;$(name)-objs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; main.o hello.o
   &lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt;
   
   &lt;span class=&quot;c&quot;&gt;#target
&lt;/span&gt;   &lt;span class=&quot;nl&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;demo&lt;/span&gt;
   
   &lt;span class=&quot;nl&quot;&gt;demo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
   	&lt;span class=&quot;c&quot;&gt;#$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
&lt;/span&gt;   	&lt;span class=&quot;err&quot;&gt;$(MAKE)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$(KDIR)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$(PWD)&lt;/span&gt; modules
   	&lt;span class=&quot;c&quot;&gt;#sudo $(KDIR)/scripts/sign-file sha512 $(KDIR)/certs/signing_key.pem $(KDIR)/certs/signing_key.x509 $(name).ko
&lt;/span&gt;   	
   &lt;span class=&quot;nl&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
   	&lt;span class=&quot;err&quot;&gt;@echo&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;hello&lt;/span&gt;
   
   &lt;span class=&quot;nl&quot;&gt;clean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
   	&lt;span class=&quot;err&quot;&gt;$(MAKE)&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;$(KDIR)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$(PWD)&lt;/span&gt; clean
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;查看输出&lt;/p&gt;

    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dmesg | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;keywords&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;code-&quot;&gt;code &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#ls demo&lt;/span&gt;
hello.c  hello.h  main.c  Makefile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;hello.h&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#ifndef _LINUX_HELLO_H_
#define _LINUX_HELLO_H_
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;#endif
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;hello.c&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include &quot;hello.h&quot;
#include &amp;lt;linux/kernel.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;demo: hello&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;demo: happy day!&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;main.c&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include &amp;lt;linux/init.h&amp;gt;  
#include &amp;lt;linux/kernel.h&amp;gt;  
#include &amp;lt;linux/module.h&amp;gt; 
#include &quot;hello.h&quot;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;demo_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
    &lt;span class=&quot;n&quot;&gt;printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;demo: init module&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  

&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;demo_exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
    &lt;span class=&quot;n&quot;&gt;printk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;demo: exit module&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  

&lt;span class=&quot;n&quot;&gt;module_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;demo_init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;module_exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;demo_exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;MODULE_LICENSE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;GPL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;MODULE_AUTHOR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h1 id=&quot;make-&quot;&gt;make &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#cd demo&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#make&lt;/span&gt;
make &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; ~/apple/kernel-4.15.4 &lt;span class=&quot;nv&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~/apple/project/module/demo modules
make[1]: Entering directory &lt;span class=&quot;s1&quot;&gt;&#39;~/apple/kernel-4.15.4&#39;&lt;/span&gt;
  CC &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;M]  ~/apple/project/module/demo/main.o
  CC &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;M]  ~/apple/project/module/demo/hello.o
  LD &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;M]  ~/apple/project/module/demo/demo.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      ~/apple/project/module/demo/demo.mod.o
  LD &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;M]  ~/apple/project/module/demo/demo.ko
make[1]: Leaving directory &lt;span class=&quot;s1&quot;&gt;&#39;~/apple/kernel-4.15.4&#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#ls ../demo&lt;/span&gt;
demo.ko  demo.mod.c  demo.mod.o  demo.o  hello.c  hello.h  hello.o  main.c  main.o  Makefile  modules.order  Module.symvers
&lt;span class=&quot;c&quot;&gt;#lsmod|grep demo&lt;/span&gt;
demo                   16384  0
&lt;span class=&quot;c&quot;&gt;#sudo rmmod demo&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#sudo insmod demo.ko&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#dmesg|grep demo&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 2109.050790] demo: init module
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 2109.050792] demo: hello
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 2109.050793] demo: happy day!
&lt;span class=&quot;c&quot;&gt;#sudo rmmod demo&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#dmesg|grep demo&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 2123.678684] demo: &lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;module
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;make clean&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#make clean&lt;/span&gt;
make &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; ~/apple/kernel-4.15.4 &lt;span class=&quot;nv&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~/apple/project/module/demo clean
make[1]: Entering directory &lt;span class=&quot;s1&quot;&gt;&#39;~/apple/kernel-4.15.4&#39;&lt;/span&gt;
  CLEAN   ~/apple/project/module/demo/.tmp_versions
  CLEAN   ~/apple/project/module/demo/Module.symvers
make[1]: Leaving directory &lt;span class=&quot;s1&quot;&gt;&#39;~/apple/kernel-4.15.4&#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

            </description>
            <pubDate>Tue, 15 Dec 2020 08:20:22 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/15/linux-ko
            </guid>
        </item>
        
        <item>
            <title>makefile</title>
            <link>
                https://applelin8.github.io//2020/12/14/makefile
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/14/makefile&quot;&gt;https://applelin8.github.io/2020/12/14/makefile&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;makefile&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;make&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;makefile-&quot;&gt;makefile &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;PARAMETER&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;make PARAMETER=parameter&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;variable&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;var_a=a&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;target&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;target : depends&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-makefile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nl&quot;&gt;.PHONY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;clean all&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#PARAMETER ?= DBG
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PARAMETER&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?=&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;$(info&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;PARAMETER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$(PARAMETER)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ifeq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;($(PARAMETER), DBG)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;CFLAGS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-DDBG_DEMO&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;SRC_DIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ./src
&lt;span class=&quot;nv&quot;&gt;INC_DIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ./include

&lt;span class=&quot;nv&quot;&gt;DBG_DIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ./debug

&lt;span class=&quot;nv&quot;&gt;debug&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; demo_dbg
&lt;span class=&quot;nv&quot;&gt;fuzzer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; demo
&lt;span class=&quot;nv&quot;&gt;CFLAGS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$(INC_DIR)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt;./lib &lt;span class=&quot;nv&quot;&gt;${CFLAG}&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;all &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$(fuzzer)&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;clean &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(fuzzer)&lt;/span&gt; demo_dbg &lt;span class=&quot;nv&quot;&gt;$(SRC_DIR)&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.o &lt;span class=&quot;nv&quot;&gt;$(DBG_DIR)&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.o

&lt;span class=&quot;nv&quot;&gt;SRCS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;wildcard&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(SRC_DIR)&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.c&lt;span class=&quot;nf&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;OBJS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(SRCS:.c=.o)&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;DBG_SRCS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;wildcard&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(DBG_DIR)&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.c&lt;span class=&quot;nf&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(SRC_DIR)&lt;/span&gt;/abc.c
&lt;span class=&quot;nv&quot;&gt;DBG_OBJS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(DBG_SRCS:.c=.o)&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;$(OBJS) &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;lib/example.h&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;.c.o&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$(CC) -c ./$(SRC_DIR)/$^ $(DBG_DIR)/$^ ${CFLAGS}&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;demo &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$(OBJS)&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$(CC)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(CFLAGS)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$^&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;demo_dbg &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$(DBG_OBJS)&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$(CC)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$(CFLAGS)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$^&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;dbg &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;clean demo_dbg&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;make-&quot;&gt;make &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;make&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make all

make

make dbg &lt;span class=&quot;nv&quot;&gt;PARAMETER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;DBG

make clean

make demo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Mon, 14 Dec 2020 18:20:22 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/14/makefile
            </guid>
        </item>
        
        <item>
            <title>valist</title>
            <link>
                https://applelin8.github.io//2020/12/14/valist
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/14/valist&quot;&gt;https://applelin8.github.io/2020/12/14/valist&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;valist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;valist-&quot;&gt;valist &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;如何获取函数的变长参数(va_list, va_start, va_arg, va_end)
primer中讲得比较浅，提到了怎么声明怎么调用，但是没有写明在函数内部是如何获取变长参数。
1）省略号（ellipsis）&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;void fun1(int a, double b, …); //给出确定的几个参数，其他用省略号
void fun2(int a …) //省略号前有没有逗号都可以
void fun3(…) //也可以不确定任何参数，但与没参数是不一样的。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;典型应用 printf:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;int pritnf(const char *format, [, argument] …); //官方声明
printf(“My name is %s, age %d.”, “Apple”, 24); //调用&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2）通用工作原理
使用步骤：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;a) 定义 va_list 变量ap
b) va_start 初始化ap
c) va_arg返回变长参数值。
d) va_end重置ap为NULLset &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;example-&quot;&gt;example &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdarg.h&amp;gt;
&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#define __printf(a, b)	__attribute__((format(printf, a, b)))
&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#if 1
#define CHECK_FMT(a, b) __attribute__((format(printf, a, b)))
#else
#define CHECK_FMT(a, b)
#endif
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;TRACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHECK_FMT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;TRACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;va_list&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;va_start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//va_start&lt;/span&gt;

    &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Iterate over the format string&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;&#39;%&#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&#39;s&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;va_arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//va_arg&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&#39;d&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;va_arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//va_arg&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;va_end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TRACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;iValue = %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TRACE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;iValue = %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Mon, 14 Dec 2020 12:20:22 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/14/valist
            </guid>
        </item>
        
        <item>
            <title>grub</title>
            <link>
                https://applelin8.github.io//2020/12/13/grub
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/13/grub&quot;&gt;https://applelin8.github.io/2020/12/13/grub&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;format&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;set&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;p&gt;前置知识：你必须知道grub的启动过程以及bios和uefi的相关基础知识，可以参考：&lt;a href=&quot;https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface&quot;&gt;《Unified Extensible Firmware Interface Wikipedia》&lt;/a&gt;、&lt;a href=&quot;https://opensource.com/article/17/2/linux-boot-and-startup&quot;&gt;《linux启动过程简介》&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;format-&quot;&gt;format &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /boot/grub/
fonts  grub.cfg  grubenv  locale  unicode.pf2  x86_64-efi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;grub.cfg&lt;/p&gt;

&lt;p&gt;grub.cfg:这是grub的启动shell脚本，对于用户来说，是最重要的文件，几乎是用户配置grub的唯一的配置文件。通过这个文件用户可以控制grub加载操作系统的行为，比如添加一个menuentry就是添加一个操作系统启动选项，每个选项中可以指定操作系统内核镜像和initramfs镜像等等。&lt;/p&gt;

&lt;p&gt;grub.cfg一般都不会手动编辑的，而是用过grub-mkconfig -o /boot/grub/grub.cfg去生成。&lt;/p&gt;

&lt;p&gt;grubenv:预设的一些环境变量可以放到这，是一个文本文件.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-wn&lt;/span&gt; menuentry grub.cfg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;/etc/default/grub&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /etc/grub.d/
00_header  05_debian_theme  10_linux  20_linux_xen  20_memtest86+  30_os-prober  30_uefi-firmware  40_custom  41_custom  README
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;set-&quot;&gt;set &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;/etc/default/grub&lt;/p&gt;

&lt;h2 id=&quot;grub_default&quot;&gt;&lt;strong&gt;GRUB_DEFAULT&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;设定预设的menu entry,可以是数字，或者是menu entry的标头，或是『saved』。&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;GRUB_DEFAULT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt; entry id&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;example&quot;&gt;example&lt;/h2&gt;

&lt;p&gt;to set&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;GRUB_DEFAULT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&amp;gt;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;set&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;s/GRUB_DEFAULT/#GRUB_DEFAULT/g&#39;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;/GRUB_DEFAULT/i\GRUB_DEFAULT=0&#39;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; /etc/default/grub
&lt;span class=&quot;nb&quot;&gt;sudo sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;/GRUB_DEFAULT/d&#39;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; /etc/default/grub

&lt;span class=&quot;nb&quot;&gt;sudo sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;6i\GRUB_DEFAULT=&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&amp;gt;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&#39;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; /etc/default/grub

&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; GRUB_DEFAULT /etc/default/grub
6:GRUB_DEFAULT&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&amp;gt;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;update-grub
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;reboot
&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;
4.9.151abc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;submenu&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt; /boot/grub/grub.cfg 
19:   &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&amp;gt;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt;
130:submenu &lt;span class=&quot;s1&quot;&gt;&#39;Advanced options for Ubuntu&#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$menuentry_id_option&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;menu entry&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt; /boot/grub/grub.cfg 
19:   &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gnulinux-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&amp;gt;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&quot;&lt;/span&gt;
635:	menuentry &lt;span class=&quot;s1&quot;&gt;&#39;Ubuntu, with Linux 4.9.151abc&#39;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--class&lt;/span&gt; ubuntu &lt;span class=&quot;nt&quot;&gt;--class&lt;/span&gt; gnu-linux &lt;span class=&quot;nt&quot;&gt;--class&lt;/span&gt; gnu &lt;span class=&quot;nt&quot;&gt;--class&lt;/span&gt; os &lt;span class=&quot;nv&quot;&gt;$menuentry_id_option&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;gnulinux-4.9.151abc-advanced-c635a47d-c750-40a1-b647-54f27cacbb87&#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Sun, 13 Dec 2020 12:30:16 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/13/grub
            </guid>
        </item>
        
        <item>
            <title>vscode remote</title>
            <link>
                https://applelin8.github.io//2020/12/10/vscode-remote
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/10/vscode-remote&quot;&gt;https://applelin8.github.io/2020/12/10/vscode-remote&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;how to use vscode&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;extension&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;gdb&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#4&quot;&gt;shell&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;how-to-use-vscode-&quot;&gt;how to use vscode &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;how to use vscode
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/vscode_extension.png&quot; alt=&quot;how to use vscode&quot; /&gt;&lt;/p&gt;

&lt;p&gt;remote-ssh
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/remote_ssh.png&quot; alt=&quot;architecture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;C/C++ IntelliSense, debugging, and code browsing.
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/remote-ssh_c_cpp_intellisense.png&quot; alt=&quot;architecture&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;extension-&quot;&gt;extension &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/extension.png&quot; alt=&quot;architecture&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;gdb-&quot;&gt;gdb &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/gdb.png&quot; alt=&quot;architecture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;${workspace}/.vscode/launch.json&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;version&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;0.2.0&quot;&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;configurations&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;gcc - 生成和调试活动文件&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;type&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;cppdbg&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;request&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;launch&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;program&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fileDirname&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fileBasenameNoExtension&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;args&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ls&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;stopAtEntry&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;cwd&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;workspaceFolder&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;environment&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;externalConsole&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;MIMode&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;gdb&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;setupCommands&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;s2&quot;&gt;&quot;description&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;为 gdb 启用整齐打印&quot;&lt;/span&gt;,
                    &lt;span class=&quot;s2&quot;&gt;&quot;text&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;-enable-pretty-printing&quot;&lt;/span&gt;,
                    &lt;span class=&quot;s2&quot;&gt;&quot;ignoreFailures&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;preLaunchTask&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;C/C++: gcc build active file&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;miDebuggerPath&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/bin/gdb&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;${workspace}/.vscode/tasks.json&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;tasks&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;type&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;shell&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;label&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;C/C++: gcc build active file&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;command&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;/usr/bin/gcc&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;args&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;-g&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;-o&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fileDirname&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fileBasenameNoExtension&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;options&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;cwd&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;workspaceFolder&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;problemMatcher&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$gcc&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;group&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;s2&quot;&gt;&quot;kind&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;build&quot;&lt;/span&gt;,
                &lt;span class=&quot;s2&quot;&gt;&quot;isDefault&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
    &lt;span class=&quot;s2&quot;&gt;&quot;version&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;2.0.0&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;shell-&quot;&gt;shell &lt;span id=&quot;4&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/vscode/log_sh.png&quot; alt=&quot;architecture&quot; /&gt;&lt;/p&gt;

            </description>
            <pubDate>Thu, 10 Dec 2020 08:06:16 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/10/vscode-remote
            </guid>
        </item>
        
        <item>
            <title>git alias</title>
            <link>
                https://applelin8.github.io//2020/12/09/git-alias
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/9/git-alias&quot;&gt;https://applelin8.github.io/2020/12/9/git-alias&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;git cp = git cherry-pick&lt;/p&gt;

&lt;p&gt;it.&lt;/p&gt;

&lt;p&gt;it’s fine.&lt;/p&gt;

&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;git alias&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;git-alias-&quot;&gt;git-alias &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
    co &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; checkout
    cob &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt;
    coo &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git fetch &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout
    br &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; branch
    brd &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; branch &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt;
    brD &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; branch &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt;
    merged &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; branch &lt;span class=&quot;nt&quot;&gt;--merged&lt;/span&gt;
    st &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; status
    aa &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; add &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
    cm &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt;
    aacm &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git add &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; cherry-pick
    amend &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; commit &lt;span class=&quot;nt&quot;&gt;--amend&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt;
    dev &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git checkout dev &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull origin dev 
    staging &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git checkout staging &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull origin staging
    master &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git checkout master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull origin
    po &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; push origin
    pod &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; push origin dev 
    pos &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; push origin staging
    pom &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; push origin master
    poh &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; push origin HEAD
    pogm &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git push origin gh-pages &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull origin master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git rebase gh-pages &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout gh-pages
    pomg &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;git push origin master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout gh-pages &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull origin gh-pages &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git rebase master &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git push origin gh-pages &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout master
    plo &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; pull origin
    plod &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; pull origin dev 
    plos &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; pull origin staging
    plom &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; pull origin master
    ploh &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; pull origin HEAD
    unstage &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; reset &lt;span class=&quot;nt&quot;&gt;--soft&lt;/span&gt; HEAD^
    &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; log &lt;span class=&quot;nt&quot;&gt;--pretty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;format:&lt;span class=&quot;s2&quot;&gt;&quot;%C(yellow)%h%Cred%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; %Creset%s%Cblue&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; [%cn]&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; %Creset%ad&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--date&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;short  &lt;span class=&quot;nt&quot;&gt;--decorate&lt;/span&gt;
    ll &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; log &lt;span class=&quot;nt&quot;&gt;--pretty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;format:&lt;span class=&quot;s2&quot;&gt;&quot;%C(yellow)%h%Cred%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; %Creset%s%Cblue&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; [%cn]&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--decorate&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--numstat&lt;/span&gt;
    f &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;!git ls-files | grep -i&quot;&lt;/span&gt; 
    gr &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-Ii&lt;/span&gt; 
    la &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;!git config -l | grep alias | cut -c 7-&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Wed, 09 Dec 2020 12:06:28 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/09/git-alias
            </guid>
        </item>
        
        <item>
            <title>pc of two net</title>
            <link>
                https://applelin8.github.io//2020/12/07/pc-of-two-net
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;question&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;windows&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;linux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;question-&quot;&gt;question &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;机器有两个网卡，一个是有线，另一个是无线。&lt;/p&gt;

&lt;p&gt;pc1 ping  pc2 有线不通。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ping 192.168.1.3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/2net_wifi_and_wire.png&quot; alt=&quot;net&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;windows-&quot;&gt;windows &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;route PRINT &lt;span class=&quot;nt&quot;&gt;-4&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;===========================================================================&lt;/span&gt;
接口列表
4...66 66 66 66 66 66 ......Realtek PCIe GBE Family Controller
5...88 88 88 88 88 88 ......Qualcomm Atheros QCA9377 Wireless Network Adapter
&lt;span class=&quot;o&quot;&gt;===========================================================================&lt;/span&gt;

IPv4 路由表
&lt;span class=&quot;o&quot;&gt;===========================================================================&lt;/span&gt;
活动路由:
网络目标        网络掩码          网关       接口         跃点数
0.0.0.0       0.0.0.0  10.61.40.254   10.61.40.174    10
0.0.0.0       0.0.0.0  192.168.1.1    192.168.1.152   25
&lt;span class=&quot;o&quot;&gt;===========================================================================&lt;/span&gt;
永久路由:
  无
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;因为pc1的route设置无线的default route的跃点比有线的高，
且没有192.168.1.3的路由，所以pc1 ping pc2的有线网卡不通。&lt;/p&gt;

&lt;p&gt;增加路由：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#添加路由&lt;/span&gt;
route add 192.168.1.3 MASK 255.255.255.255  192.168.1.254 metric 30 &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;4
&lt;span class=&quot;c&quot;&gt;#修改gateway和metric&lt;/span&gt;
route change 192.168.1.3 MASK 255.255.255.255  192.168.1.254 metric 5 &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;设置规则(metric 越小，优先级越高)：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;192.168.1.3的metric&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &amp;lt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;default 0.0.0.0  192.168.1.1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &amp;lt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;default 0.0.0.0 10.10.1.1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;linux-&quot;&gt;linux &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;have nice day&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# show route&lt;/span&gt;
ip r
route &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# add route&lt;/span&gt;
route &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; add 192.168.1.2 255.255.255.0 192.168.1.3

&lt;span class=&quot;c&quot;&gt;# ip route&lt;/span&gt;
ip route add default via 192.168.1.1 table 1
ip route add 192.168.0.0/24 via 192.168.1.2 table 1
&lt;span class=&quot;c&quot;&gt;#注:各路由表中应当指明默认路由,尽量不回查路由表.路由添加完毕,即可在路由规则中应用..&lt;/span&gt;

ip route add 192.168.1.0/24 dev eth0 via 192.168.1.66 realm 4

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Mon, 07 Dec 2020 12:06:28 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/07/pc-of-two-net
            </guid>
        </item>
        
        <item>
            <title>python main</title>
            <link>
                https://applelin8.github.io//2020/12/02/python-main
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/12/2/python-main&quot;&gt;https://applelin8.github.io/2020/12/2/python-main&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;&lt;strong&gt;main&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;read&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;numpy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;main-&quot;&gt;main &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;Calculate the area of a circle&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#const.py
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PI&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.14&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;PI:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#area.py
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PI&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calc_circle_area&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;radius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PI&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;radius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;circle area: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;calc_circle_area&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    
&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;read-&quot;&gt;read &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# File: read.py
&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;re&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;read_cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;,&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;#print(line,end=&#39;&#39;)
&lt;/span&gt;                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;=| |,&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;cmd count is %d&#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;__main__&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;read_cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;numpy-&quot;&gt;numpy &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;安装&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;numpy scipy matplotlib &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; https://pypi.tuna.tsinghua.edu.cn/simple

python &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;pandas seaborn &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; https://pypi.tuna.tsinghua.edu.cn/simple

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;画直方图v1&quot;&gt;画直方图v1&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;seaborn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                                   &lt;span class=&quot;c1&quot;&gt;#设置seaborn默认格式
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                           &lt;span class=&quot;c1&quot;&gt;#设置随机种子数
&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.font_manager&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FontProperties&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;#显示中文，并指定字体
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myfont&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FontProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;C:/Windows/Fonts/simhei.ttf&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;font&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myfont&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rcParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;axes.unicode_minus&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;#显示负号
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#print(a);
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rcParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;figure.figsize&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#设定图片大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                            &lt;span class=&quot;c1&quot;&gt;#确定画布
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;distplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kde&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;#绘制频数直方图
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#sns.distplot(a, kde=True,hist=True)                 #绘制频数直方图
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ylabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;频数&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                    &lt;span class=&quot;c1&quot;&gt;#设置x轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;#设置y轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;(&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;个32位随机数分布图)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;             &lt;span class=&quot;c1&quot;&gt;#设置子图标题
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;distplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                           &lt;span class=&quot;c1&quot;&gt;#绘制密度直方图
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ylabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;密度&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;#设置x轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;#设置y轴刻度值的字体大小
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplots_adjust&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wspace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;#调整两幅子图的间距
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_1000_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_demo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#x = (1, 2 ,3 , 3, 4, 5 ,1)
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#x = (1, 2 ,3 , 3, 4, 5 ,1, 1, 1, 1, 1)
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#x = list(range(1,10))
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asarray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a is : &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asarray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()))&lt;/span&gt;
   
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;number count=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#print(a)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;__main__&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;画直方图v2&quot;&gt;画直方图v2&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;seaborn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                                   &lt;span class=&quot;c1&quot;&gt;#设置seaborn默认格式
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                           &lt;span class=&quot;c1&quot;&gt;#设置随机种子数
&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.font_manager&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FontProperties&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;#显示中文，并指定字体
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myfont&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FontProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;C:/Windows/Fonts/simhei.ttf&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;font&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myfont&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rcParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;axes.unicode_minus&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;#显示负号
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rcParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;figure.figsize&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#设定图片大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                            &lt;span class=&quot;c1&quot;&gt;#确定画布
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;distplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kde&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;#绘制频数直方图
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#sns.distplot(a, kde=True,hist=True)                 #绘制频数直方图
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ylabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;频数&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                    &lt;span class=&quot;c1&quot;&gt;#设置x轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;#设置y轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;(&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;个32位随机数分布图)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;             &lt;span class=&quot;c1&quot;&gt;#设置子图标题
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;distplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                           &lt;span class=&quot;c1&quot;&gt;#绘制密度直方图
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ylabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;密度&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;#设置x轴刻度值的字体大小
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yticks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;#设置y轴刻度值的字体大小
&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplots_adjust&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wspace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;#调整两幅子图的间距
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;delta_minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;startTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;total_seconds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endTime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;startTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;total_seconds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_seconds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_diff_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;str1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;&#39;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;str1&lt;/span&gt;
        
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;show_delta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;newtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;global&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;用时：&#39;&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_diff_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;delta_minute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;newtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39; 分钟 &#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_diff_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;newtime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39; 秒 &#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_diff_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;newtime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;microseconds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39; 毫秒 &#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;newtime&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;show_array_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;数据类型&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;#打印数组数据类型  
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;数组元素数据类型：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#打印数组元素数据类型  
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;数组元素总数：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;#打印数组尺寸，即数组元素总数  
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;数组形状：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;#打印数组形状  
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;数组的维度数目&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ndim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;#打印数组的维度数目  
&lt;/span&gt;    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;iter_loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;delimiter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;,&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;skiprows&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;len1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;iter_func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;r&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;infile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;skiprows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;infile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rstrip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;delimiter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;len1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
                
        &lt;span class=&quot;n&quot;&gt;iter_loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rowlength&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fromiter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iter_func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reshape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iter_loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rowlength&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_data1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_data2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;global&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;-----------1 loadtxt --------------&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;oldtime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;show_delta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;-----------2 show array --------------&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;show_array_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;show_delta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;-----------3 draw --------------&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;show_delta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;draw_data3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iter_loadtxt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max_min_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;0&#39;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;0xFFFFFFFF&#39;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;r&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
            
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
        
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;max  : &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;min  : &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;count：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&#39;__main__&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;draw_data2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;结果&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;-----------1&lt;/span&gt; loadtxt &lt;span class=&quot;nt&quot;&gt;--------------&lt;/span&gt;
用时：0.999 毫秒 
&lt;span class=&quot;nt&quot;&gt;-----------2&lt;/span&gt; show array &lt;span class=&quot;nt&quot;&gt;--------------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1.81397318e+09 4.51097333e+08 7.47925723e+08 1.57521411e+09
 6.28680555e+08 2.98246167e+08 1.64331751e+09 2.06213070e+09]
数据类型 &amp;lt;class &lt;span class=&quot;s1&quot;&gt;&#39;numpy.ndarray&#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
数组元素数据类型： float64
数组元素总数： 8
数组形状： &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;8,&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
数组的维度数目 1
用时：0.97 毫秒 
&lt;span class=&quot;nt&quot;&gt;-----------3&lt;/span&gt; draw &lt;span class=&quot;nt&quot;&gt;--------------&lt;/span&gt;
用时：4 秒 549.668 毫秒 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/draw_plot_2.png&quot; alt=&quot;draw_plot.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/draw_plot_1.png&quot; alt=&quot;draw_plot.png&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;说明：
这里有list a=[1,1,1, …1, 10, 10,…，10]，list a有10个1和5个10，画了两幅直方图。其中左图是频数图，即纵坐标是频数，表示落在相应区间的样本数；右图是频率图，即纵坐标是概率，表示落在某区间的概率。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/draw_plot.png&quot; alt=&quot;draw_plot.png&quot; /&gt;&lt;/p&gt;


            </description>
            <pubDate>Wed, 02 Dec 2020 12:06:28 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/12/02/python-main
            </guid>
        </item>
        
        <item>
            <title>mount lvm</title>
            <link>
                https://applelin8.github.io//2020/11/27/mount-lvm
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/27/mount-lvm&quot;&gt;https://applelin8.github.io/2020/11/27/mount-lvm&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;mount lvm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;p&gt;vgscan&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vgscan
  Reading all physical volumes.  This may take a &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;...
  Found volume group &lt;span class=&quot;s2&quot;&gt;&quot;centos&quot;&lt;/span&gt; using metadata &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;lvm2
  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vgchange&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vgchange &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; y centos
  3 logical volume&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;volume group &lt;span class=&quot;s2&quot;&gt;&quot;centos&quot;&lt;/span&gt; now active
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ls /dev/centos&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ahl&lt;/span&gt;  /dev/centos/
总用量 0
drwxr-xr-x  2 root root  100 11月 27 10:55 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxr-xr-x 20 root root 4.9K 11月 27 16:46 ..
lrwxrwxrwx  1 root root    7 11月 27 10:55 home -&amp;gt; ../dm-1
lrwxrwxrwx  1 root root    7 11月 27 10:55 root -&amp;gt; ../dm-2
lrwxrwxrwx  1 root root    7 11月 27 10:55 swap -&amp;gt; ../dm-0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;mount-lvm-&quot;&gt;mount lvm &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;mount_lvm.sh&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash                                                                                                                               &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#set -xve&lt;/span&gt;
 
&lt;span class=&quot;nb&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; volume_groups
 
&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;get_volume_groups&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
    &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0 
    &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;line &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vgscan&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;do  
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval &lt;/span&gt;result[&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;$line&#39;&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;let &lt;/span&gt;i++ 
    &lt;span class=&quot;k&quot;&gt;done
 
    &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${#&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[@]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i&amp;lt;&lt;span class=&quot;nv&quot;&gt;$len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i++&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;do  
        if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Found&#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;then
            &lt;/span&gt;volume_groups[&lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;+3]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;|sed &lt;span class=&quot;s1&quot;&gt;&#39;s/\&quot;//g&#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;let id&lt;/span&gt;++
            &lt;span class=&quot;nb&quot;&gt;let &lt;/span&gt;i+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;3
        &lt;span class=&quot;k&quot;&gt;fi  
    done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 
&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;mount_dir&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;volume_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;NR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;
 
    &lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /dev/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/|awk &lt;span class=&quot;s2&quot;&gt;&quot;NR==&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NR&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;mount &lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt; : /opt/mnt/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /opt/mnt/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mount /dev/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt; /opt/mnt/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;umount_dir&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;   
    &lt;span class=&quot;nv&quot;&gt;volume_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;NR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;
    
    &lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /dev/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/|awk &lt;span class=&quot;s2&quot;&gt;&quot;NR==&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NR&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;umount &lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt; : /opt/mnt/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;umount /opt/mnt/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;/&lt;span class=&quot;nv&quot;&gt;$dir&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;   
    
&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;mount_volume_groups&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;   
    &lt;span class=&quot;nv&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i&amp;lt;&lt;span class=&quot;k&quot;&gt;${#&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;volume_groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[@]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;i++ &lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;do
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;: &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;volume_groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;volume_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;volume_groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vgchange &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; y &lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;
    
        &lt;span class=&quot;nv&quot;&gt;dir_count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /dev/&lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt;|sed &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;$=&#39;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;j&amp;lt;&lt;span class=&quot;nv&quot;&gt;$dir_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;j++&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;do
            if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;y&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
                &lt;/span&gt;mount_dir &lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$j&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;else
                &lt;/span&gt;umount_dir &lt;span class=&quot;nv&quot;&gt;$volume_group&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$j&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;fi
        done
    done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;   

&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;main&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;    
    get_volume_groups
    mount_volume_groups &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;    
     
main &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;mount&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mount_lvm.sh y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ls&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /opt/mnt/centos/home/
apple
:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /opt/mnt/centos/root/
bin  boot  dev	etc  home  lib	lib64  media  mnt  opt	proc  root  run  sbin  srv  sys  tmp  usr  var
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;tree&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;tree &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; 2 /opt/mnt/centos/
/opt/mnt/centos/
├── home
│   └── apple
└── root
    ├── bin -&amp;gt; usr/bin
    ├── boot
    ├── dev
    ├── etc
    ├── home
    ├── lib -&amp;gt; usr/lib
    ├── lib64 -&amp;gt; usr/lib64
    ├── media
    ├── mnt
    ├── opt
    ├── proc
    ├── root
    ├── run
    ├── sbin -&amp;gt; usr/sbin
    ├── srv
    ├── sys
    ├── tmp
    ├── usr
    └── var

22 directories, 0 files

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;umount&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mount_lvm.sh n
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ls&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /opt/mnt/centos/home
:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /opt/mnt/centos/root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;tree&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;tree &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; 2 /opt/mnt/centos/
/opt/mnt/centos/
├── home
└── root

2 directories, 0 files
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Fri, 27 Nov 2020 17:57:58 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/27/mount-lvm
            </guid>
        </item>
        
        <item>
            <title>os process</title>
            <link>
                https://applelin8.github.io//2020/11/26/os-process
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/26/os-process&quot;&gt;https://applelin8.github.io/2020/11/26/os-process&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;os process&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;what is process&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;Virtual memory&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;chosing an operation system&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#4&quot;&gt;Virtual machine(VM)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;os-process-&quot;&gt;os process &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;install Windows&lt;/p&gt;

&lt;p&gt;install Linux&lt;/p&gt;

&lt;h2 id=&quot;whats-process-span-id11&quot;&gt;What’s process? &amp;lt;span id=”1.1&amp;gt;”&lt;/h2&gt;

&lt;p&gt;Process A program that’s executing,like our internet browser or text editor.&lt;/p&gt;

&lt;p&gt;Program An application that we can run,like Chrome&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Kernel Creates processes,efficiently schedules them,and manages how processes are terminated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/process_slice.png&quot; alt=&quot;process&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time slice&lt;/strong&gt;
A very short interval of time that gets
allocated to a process for CPU execution&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shell&lt;/strong&gt;
A program that interprets text commands
and sends them to the OS to execute&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Files that record system events on our computer,just like a system’s diary&lt;/p&gt;

&lt;p&gt;The Boot Process&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BIOS/UEFI&lt;/strong&gt;
A low-level software that initializes our
computer’s hardware to makesure
everything is good to go&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bootloader&lt;/strong&gt;
A small program that loads the operating
system&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/boot.png&quot; alt=&quot;process&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As an IT Support Specialist, you’ ll install an operating system many times, so using one single disk won’t be time efficient or scalable.&lt;/p&gt;

&lt;h1 id=&quot;virtual-memory-&quot;&gt;Virtual memory &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;The combination of hard drive space and
RAM that acts like memory that our
processes can use&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;choosing-an-operation-system-&quot;&gt;choosing an operation system &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h1 id=&quot;virtual-machinevm-&quot;&gt;Virtual machine(VM) &lt;span id=&quot;4&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;Just a copy of a real machine
virtual box&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Memory&lt;/li&gt;
  &lt;li&gt;CPU&lt;/li&gt;
  &lt;li&gt;Storage&lt;/li&gt;
&lt;/ul&gt;

            </description>
            <pubDate>Thu, 26 Nov 2020 12:30:28 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/26/os-process
            </guid>
        </item>
        
        <item>
            <title>linux patch</title>
            <link>
                https://applelin8.github.io//2020/11/25/linux-patch
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/25/linux-patch&quot;&gt;https://applelin8.github.io/2020/11/25/linux-patch&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;contents-&quot;&gt;Contents &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;What is patch?&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;简介&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;patch文件格式&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;how to make patch&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#2.1&quot;&gt;diff命令&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#2.2&quot;&gt;单文件补丁&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#2.3&quot;&gt;文件夹补丁&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;how to apply patch&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#3.1&quot;&gt;patch命令&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#3.2&quot;&gt;应用&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;p&gt;Introduce how to make and apply patch on linux?&lt;/p&gt;

&lt;h1 id=&quot;what-is-patch-&quot;&gt;What is patch? &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;简介-&quot;&gt;简介 &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;在linux下，修改了代码，为了方便分享（new feature）或者自己备份使用，一般需要制作一个补丁（patch）。&lt;/p&gt;

&lt;p&gt;patch是一个文件两个版本之间的差异。&lt;/p&gt;

&lt;p&gt;diff file.version1 file.version2 &amp;gt; file.patch&lt;/p&gt;

&lt;p&gt;patch的作用是方便，组合灵活，体积小。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;场景1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;比如两个开发者A和B都有一project,&lt;/p&gt;

&lt;p&gt;现在A在project中增加了新featureA,&lt;/p&gt;

&lt;p&gt;如果B要用featureA，就不要整个把A的project的拿过来，如果project很大，这个会很花费拷贝时间和存储空间。&lt;/p&gt;

&lt;p&gt;只要制作 featureA.patch, 然后B把featureA.patch的差异打到自己的project，就可以跟A的project的一样使用freatureA了。&lt;/p&gt;

&lt;p&gt;freatureA.patch比project的体积小多了，方便分享和备份。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;场景2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;如果同一project, 多个开发人员A、B、C,&lt;/p&gt;

&lt;p&gt;它们分别开发了 feature_A 、feature_B 、feature_C，&lt;/p&gt;

&lt;p&gt;现在开发人员D，它也有project，他的需求可以是多样的，&lt;/p&gt;

&lt;p&gt;D会只使用feature_A，&lt;/p&gt;

&lt;p&gt;也许D会使用feature_B和feature_C而不要feature_A。&lt;/p&gt;

&lt;p&gt;方便使用者根据需要组合使用patch。&lt;/p&gt;

&lt;h2 id=&quot;patch文件格式-&quot;&gt;patch文件格式 &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;补丁文件内容到底是什么样子的？&lt;/p&gt;

&lt;p&gt;例子&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-file.patch 
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-file	2020-11-25 17:47:49.335233371 +0800
+++ to-file	2020-11-25 17:48:39.955230582 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;,5 +1,6 @@
+aaa
 000
 111
&lt;span class=&quot;nt&quot;&gt;-222&lt;/span&gt;
+bbb
 333
 444
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;补丁头&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;补丁头分别由---和+++开头的两行，用来表示要打补丁的文件名。&lt;/p&gt;

  &lt;p&gt;---开头表示旧文件，&lt;/p&gt;

  &lt;p&gt;+++开头表示新文件&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;一个补丁文件中的多个补丁&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;一个补丁文件中可能包含以---和+++开头的很多节，每一节用来打一个补丁。所以一个patch文件中可以包含多个补丁。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;块&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;块是补丁中要修改的地方。它通常由一部分不需要修改的内容开始和结束。他们只是表示用来修改的位置。他们通常以@@开始，结束于另一个块的开始或者一个新的补丁头。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;块的缩进&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;块会缩进一列，并且这一列用来表示是要增加还是要删除的。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;块的第一列&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;+号表示这一行是要加上的。-号表示这一行是要删除的。没有加号（+）也没有减号(-)表示这里只是引用的并不需要修改。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;how-to-make-patch-&quot;&gt;how to make patch? &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;diff-命令-&quot;&gt;diff 命令 &lt;span id=&quot;2.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;制作补丁(patch)用到命令行比较工具 &lt;strong&gt;diff&lt;/strong&gt; 。&lt;/p&gt;

&lt;p&gt;diff 可以比较两个对象，并输出两者的区别。&lt;/p&gt;

&lt;p&gt;diff 的用法：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;diff &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;options] soure dest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;-r&lt;/strong&gt; 递归，比较目录下面（包含子目录）所有文件&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-N&lt;/strong&gt; 确保patch正确处理已经创建或删除文件的情况&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-u&lt;/strong&gt; 输出每个修改前后3行，也可以用-u5指定输出5行&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-E, -b, -w, -B, –strip-trailing-cr&lt;/strong&gt; 忽略各种空白，参考帮助，按需选用。&lt;/p&gt;

&lt;h2 id=&quot;单文件补丁-&quot;&gt;单文件补丁 &lt;span id=&quot;2.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;产生单文件补丁&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;diff &lt;span class=&quot;nt&quot;&gt;-uN&lt;/span&gt; from-file to-file &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;to-file.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;因为是单个文件，所以不需要 -r 选项。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;例子：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls
&lt;/span&gt;from-file  to-file
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;from-file 
000
111
222
333
444
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-file 
aaa
000
111
bbb
333
444
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;diff &lt;span class=&quot;nt&quot;&gt;-uN&lt;/span&gt; from-file to-file &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; to-file.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;得到如下补丁&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-file.patch 
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-file	2020-11-25 17:47:49.335233371 +0800
+++ to-file	2020-11-25 17:48:39.955230582 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;,5 +1,6 @@
+aaa
 000
 111
&lt;span class=&quot;nt&quot;&gt;-222&lt;/span&gt;
+bbb
 333
 444
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;patch_demo] &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;文件夹补丁-&quot;&gt;文件夹补丁 &lt;span id=&quot;2.3&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir to-dir &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; to-dir.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;例子&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;tree
&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
├── from-dir
│   ├── a.txt
│   └── from.txt
└── to-dir
    ├── b.txt
    └── to.txt

2 directories, 4 files
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;from-dir/a.txt 
111
222
333111
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;from-dir/from.txt 
from
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-dir/b.txt 
aaa
b
c
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-dir/to.txt 
to
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir to-dir &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; to-dir.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;得到如下补丁&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;to-dir.patch 
diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir/a.txt to-dir/a.txt
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-dir/a.txt	2020-11-25 17:55:39.717207451 +0800
+++ to-dir/a.txt	1970-01-01 08:00:00.000000000 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;,3 +0,0 @@
&lt;span class=&quot;nt&quot;&gt;-111&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-222&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-333111&lt;/span&gt;
diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir/b.txt to-dir/b.txt
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-dir/b.txt	1970-01-01 08:00:00.000000000 +0800
+++ to-dir/b.txt	2020-11-25 17:56:27.089204841 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-0&lt;/span&gt;,0 +1,3 @@
+aaa
+b
+c
diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir/from.txt to-dir/from.txt
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-dir/from.txt	2020-11-25 17:56:07.124205941 +0800
+++ to-dir/from.txt	1970-01-01 08:00:00.000000000 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt; +0,0 @@
&lt;span class=&quot;nt&quot;&gt;-from&lt;/span&gt;
diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt; from-dir/to.txt to-dir/to.txt
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; from-dir/to.txt	1970-01-01 08:00:00.000000000 +0800
+++ to-dir/to.txt	2020-11-25 17:56:38.532204210 +0800
@@ &lt;span class=&quot;nt&quot;&gt;-0&lt;/span&gt;,0 +1 @@
+to
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;how-to-apply-patch-&quot;&gt;how to apply patch? &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;patch命令-&quot;&gt;patch命令 &lt;span id=&quot;3.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;patch的作用是将diff输出的结果(补丁)应用到对就文件(夹)上。最常见的用法是：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;patch &lt;span class=&quot;nt&quot;&gt;-pNUM&lt;/span&gt; &amp;lt;patchfile&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;-p NUM&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;忽略几层文件夹，随后详解。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;-E&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;这个选项作用是如果发现空文件，就删除。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;-R&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;取消打过的补丁。它是打补丁动作的逆操作。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;为了解释-p参数，需要看一下如下patch文件片段：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; old/modules/demo       2020-11-25 17:56:07.124205941 +0800
+++ new/modules/demo       2020-11-25 17:56:38.532204210 +0800
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果使用参数-p0,就表示从当前目录找一个叫做old的文件夹，再在它下面找&lt;strong&gt;modules/demo&lt;/strong&gt;文件来执行patch操作。&lt;/p&gt;

&lt;p&gt;而如果使用参数-p1，就表示忽略第一层目录(即不管old),从当前目录寻找&lt;strong&gt;modules&lt;/strong&gt;的文件夹，再在它下面找demo。&lt;/p&gt;

&lt;h2 id=&quot;应用-&quot;&gt;应用 &lt;span id=&quot;3.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;处理单个文件补丁的方法&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 产生补丁&lt;/span&gt;
diff &lt;span class=&quot;nt&quot;&gt;-uN&lt;/span&gt; from-file to-file &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; to-file.patch

&lt;span class=&quot;c&quot;&gt;# 打补丁&lt;/span&gt;
patch &lt;span class=&quot;nt&quot;&gt;-p0&lt;/span&gt; &amp;lt; to-file.patch

&lt;span class=&quot;c&quot;&gt;# 取消补丁&lt;/span&gt;
patch &lt;span class=&quot;nt&quot;&gt;-RE&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p0&lt;/span&gt; &amp;lt; to-file.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;处理整个文件夹补丁的情况&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 产生补丁&lt;/span&gt;
diff &lt;span class=&quot;nt&quot;&gt;-uNr&lt;/span&gt;  from-dir  to-dir  &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;to-dir.patch
 
&lt;span class=&quot;c&quot;&gt;# 打补丁&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;to-dir
patch &lt;span class=&quot;nt&quot;&gt;-p1&lt;/span&gt; &amp;lt; to-dir.patch
 
&lt;span class=&quot;c&quot;&gt;# 取消补丁&lt;/span&gt;
patch &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p1&lt;/span&gt; &amp;lt;to-dir.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;


            </description>
            <pubDate>Wed, 25 Nov 2020 16:44:52 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/25/linux-patch
            </guid>
        </item>
        
        <item>
            <title>Operation system</title>
            <link>
                https://applelin8.github.io//2020/11/25/Operation-system
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/25/Operation-system&quot;&gt;https://applelin8.github.io/2020/11/25/Operation-system&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;Operation system&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;synopsis&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;glossary&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;operation-system-&quot;&gt;Operation system &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;What’s an operating system?
Files and File Systems&lt;/p&gt;

&lt;h2 id=&quot;synopsis-&quot;&gt;synopsis &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Operating system&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The whole package that manages our
computer’s resources and lets us interact
with it&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/os_20201125133514.png&quot; alt=&quot;os&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;glossary-&quot;&gt;glossary &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;file system&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/file_system.png&quot; alt=&quot;file system&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/file.png&quot; alt=&quot;file system&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Process management&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Memory management&lt;/p&gt;

    &lt;p&gt;Our kernel optimizes memory usage and makes sure our applications have enough memory to run.&lt;/p&gt;

    &lt;p&gt;Host Machine&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I/O management&lt;/p&gt;

    &lt;p&gt;input / output&lt;/p&gt;

    &lt;blockquote&gt;
      &lt;p&gt;Anything that can give us input,or that we can use for output of data&lt;/p&gt;
    &lt;/blockquote&gt;

    &lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/io.png&quot; alt=&quot;file system&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;


            </description>
            <pubDate>Wed, 25 Nov 2020 13:32:57 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/25/Operation-system
            </guid>
        </item>
        
        <item>
            <title>virtualization</title>
            <link>
                https://applelin8.github.io//2020/11/24/virtualization
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/24/virtualization&quot;&gt;https://applelin8.github.io/2020/11/24/virtualization&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;virtualization&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;synopsis&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;glossary&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;virtualization-&quot;&gt;virtualization &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;synopsis-&quot;&gt;synopsis &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;虚拟化技术的含义很广泛。
&lt;strong&gt;将任何一种形式的资源抽象成另一种形式的技术都是虚拟化。&lt;/strong&gt;
在常用的操作系统中就存在某种意义上的“虚拟化技术”，例如虚拟内存空间和进程。&lt;/p&gt;

&lt;p&gt;系统虚拟化是一门跨领域的学科，涉及操作系统、编译和体系结构等学科知识，并延展到资源管理、性能和系统安全等问题。&lt;/p&gt;

&lt;p&gt;虚拟化技术分类。&lt;/p&gt;

&lt;p&gt;典型系统级虚拟化的技术以及VMM的组成和分类。&lt;/p&gt;

&lt;p&gt;基于软件的完全虚拟化技术。&lt;/p&gt;

&lt;p&gt;硬件辅助的完全虚拟化技术。&lt;/p&gt;

&lt;p&gt;类虚拟化技术的实现原理。&lt;/p&gt;

&lt;p&gt;虚拟机的性能评测和调试技术。&lt;/p&gt;

&lt;p&gt;系统虚拟化的应用实例。&lt;/p&gt;

&lt;p&gt;对虚拟机和系统虚拟化技术的发展作一个展望。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/system_abstruct_layer.png&quot; alt=&quot;hello world&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;glossary-&quot;&gt;glossary &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Host&lt;/p&gt;

    &lt;p&gt;在虚拟化中，物理资源通常有一个定语称为宿主(Host)。&lt;/p&gt;

    &lt;p&gt;Host Machine&lt;/p&gt;

    &lt;p&gt;Host OS&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Guest&lt;/p&gt;

    &lt;p&gt;虚拟出来的资源通常有一个定语称为客户（Guest）。&lt;/p&gt;

    &lt;p&gt;Guest Machine&lt;/p&gt;

    &lt;p&gt;Guest OS&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;硬件抽象层上的虚拟化&lt;/p&gt;

    &lt;p&gt;通常来说，宿主机和客户机的ISA（Instruction Set Architecture，指令集架构）是相同的,客户机的大部分指令可以在宿主处理器上直接运行。只有那些需要虚拟化的指令才会由虚拟化软件进行处理，&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;操作系统层上的虚拟化&lt;/p&gt;

    &lt;p&gt;操作系统层上的虚拟化是指操作系统的内核可以提供多个互相隔离的用户态实例。这些用户态实例（经常被称为容器）对于它的用户来说就像是一台真实的计算机，有自己独立的文件系统、网络、系统设置和库函数等。从某种意义上说，这种技术可以被认为是UNIX系统chroot命令的一种延伸。因为这是操作系统内核主动提供的虚拟化，因此操作系统层上的虚拟化通常非常高效，它的虚拟化资源和性能开销非常小，也不需要有硬件的特殊支持。但它的灵活性相对较小，每个容器中的操作系统通常必须是同一种操作系统。另外，操作系统层上的虚拟化虽然为用户态实例间提供了比较强的隔离性，但其粒度是比较粗的。因为操作系统层上虚拟化的高效性，它被大量应用在虚拟主机服务环境中。比较有名的操作系统级虚拟化解决方案有Paralles的Virtuozo，Solaris的Zone和Linux的VServer等。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;


            </description>
            <pubDate>Tue, 24 Nov 2020 20:59:49 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/24/virtualization
            </guid>
        </item>
        
        <item>
            <title>IT</title>
            <link>
                https://applelin8.github.io//2020/11/22/IT
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/22/it&quot;&gt;https://applelin8.github.io/2020/11/22/it&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;content-&quot;&gt;content &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;IT&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;Information technology&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;Cryptography&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#4&quot;&gt;GNU&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#4.1&quot;&gt;Open source&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#5&quot;&gt;software&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#5.1&quot;&gt;computer language&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#5.2&quot;&gt;Character encoding&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#5.3&quot;&gt;Logic gates&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#5.4&quot;&gt;Computer Architecture Layer&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#6&quot;&gt;hardware&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#6.1&quot;&gt;Memory Controller Chip&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#6.2&quot;&gt;Motherboards&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;todo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/channel/UCKXx22vOENUyHrVAADq7Z_g&quot;&gt;Geek’s Lesson&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=awLnur5Yt9o&quot;&gt;you will learn the most basic of Information technology. No matter you are complete beginner or want to be IT professional, then this IT fundamental course is the right  course for you to start. You will learn everything you need to know about IT. You will learn each and every basic of IT and develop strong skill and understanding of information technology. &lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;it-&quot;&gt;IT &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;information-technology-&quot;&gt;Information technology &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;What is information technology?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Information Technology(IT)
The use of digital technology,like computers and the Internet,to store and process data into useful information&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/hello_world_20201122163342.png&quot; alt=&quot;hello world&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;algorithm-&quot;&gt;Algorithm &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;A series of steps that solve specific problems.&lt;/p&gt;

&lt;h1 id=&quot;cryptography-&quot;&gt;Cryptography &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;The art of writing and solving codes.&lt;/p&gt;

&lt;h1 id=&quot;gnu-&quot;&gt;GNU &lt;span id=&quot;4&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;open-source-&quot;&gt;Open source &lt;span id=&quot;4.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Anyone could modify and share it.&lt;/p&gt;

&lt;p&gt;Operation System.&lt;/p&gt;

&lt;h1 id=&quot;software-&quot;&gt;software &lt;span id=&quot;5&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;compiler was invented by Admiral Grace.
Hopper compilers made it possible to translate human language via a program language into machine code in case you didn’t totally catch that we’ll talk more about compilers later.
now learning programming languages is accessible for almost anyone anywhere.
that scares you don’t worry we’ll help you every step of the way but for now let’s get back to the evolution of computers.&lt;/p&gt;

&lt;p&gt;who knows what the future holds&lt;/p&gt;

&lt;h2 id=&quot;computer-language-&quot;&gt;computer language &lt;span id=&quot;5.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;0 + 1 = ?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;simple math problem 0 plus 1 equals what?&lt;/p&gt;

&lt;p&gt;Binary system The communication that a computer uses, also known as a base-2 numeral system.
We group binary into 8 numbers or bits. 
Technically,a bit is a binary digit.&lt;/p&gt;

&lt;p&gt;A group of 8 bits is referred to as a byte.&lt;/p&gt;

&lt;p&gt;Each byte can store one character, and we can have 256 possible values thanks to the base-2 system(2^8).&lt;/p&gt;

&lt;p&gt;01101000-h
01100101-e
01101100-I
01101111-o&lt;/p&gt;

&lt;p&gt;computer talk this byte can mean something like the letter C and this is how a computer language is born&lt;/p&gt;

&lt;p&gt;What does the following translate to?&lt;/p&gt;

&lt;p&gt;01101000 01100101 01101100 01101100 01101111&lt;/p&gt;

&lt;p&gt;something we’d be able to recognize what does the following translate.&lt;/p&gt;

&lt;p&gt;make sure you understand the concept before moving on.&lt;/p&gt;

&lt;h2 id=&quot;character-encoding-&quot;&gt;Character encoding &lt;span id=&quot;5.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;you can think of character encoding as a dictionary it’s a way for your computer’s to look up which human character should be represented by a given binary value.&lt;/p&gt;

&lt;p&gt;The first character in the ASCll to binary table–a lowercase a
-maps to 01100001
in binary.&lt;/p&gt;

&lt;p&gt;RGB&lt;/p&gt;

&lt;p&gt;that’s used in a lot of computers RGB or red green and blue model.&lt;/p&gt;

&lt;p&gt;very cool&lt;/p&gt;

&lt;p&gt;with just eight combinations of zeros and ones were able to represent everything that you see on your computer from a simple letter A to the very video that you’re watching right now.&lt;/p&gt;

&lt;h2 id=&quot;logic-gates-&quot;&gt;Logic gates &lt;span id=&quot;5.3&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;we’ll discuss how we actually generate the zeros and ones.&lt;/p&gt;

&lt;p&gt;Allow our transistors to do more complex tasks,like decide where to send electrical signals depending on logical conditions.&lt;/p&gt;

&lt;p&gt;Digital Logic
How to Count in Binary?&lt;/p&gt;

&lt;p&gt;that you understand how computers count in binary we’ve shown you simple look-up tables that you can use like the ASCll to binary table.&lt;/p&gt;

&lt;p&gt;you’ll need to know how binary works.&lt;/p&gt;

&lt;p&gt;Decimal form : Base-10 system 0123456789&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/decimal_to_bit_20201122174712.png&quot; alt=&quot;Decimal to bit&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;computer-architecture-layer-&quot;&gt;Computer Architecture Layer &lt;span id=&quot;5.4&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Abstraction&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To take a relatively complex system and
simplify it for our use&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/abstract_20201122175229.png&quot; alt=&quot;Decimal to bit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/abstract_20201122175323.png&quot; alt=&quot;Decimal to bit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;error messages&lt;/p&gt;

&lt;h1 id=&quot;hardware-&quot;&gt;hardware &lt;span id=&quot;6&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;The Modern Computer
Intro to Computer Hardware&lt;/p&gt;

&lt;p&gt;desktop&lt;/p&gt;

&lt;p&gt;components&lt;/p&gt;

&lt;p&gt;Ports
Connection points that we can connect
devices to that extend the functionality of
our computer&lt;/p&gt;

&lt;p&gt;CPU
(Central Processing Unit)
The brain of our computer,it does all the calculations and data processing&lt;/p&gt;

&lt;p&gt;RAM
(Random Access Memory)
Our computer’s short-term memory&lt;/p&gt;

&lt;p&gt;Hard drive Holds all of our data,which includes all of our music,pictures,applications&lt;/p&gt;

&lt;p&gt;Motherboard
The body or circulatory system of the
computer that connects all the pieces
together&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;computer can only communicate in binary using ones and zeros our computers&lt;/p&gt;

  &lt;p&gt;our computers speak in machine language but we of course speak in human languages like English Spanish Mandarin Hindi you get the idea if we want to communicate with our machines we have to have some sort of translation dictionary just like if I wanted to say something in Spanish.&lt;/p&gt;

  &lt;p&gt;well our computers have a built-in translation book.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Programs&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Instructions that tell the computer what
to do&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.Get two slices of bread.
2.Put peanut butter on one slice.
3.Put jelly on another slice.
4.Combine the two slices of bread.&lt;/p&gt;

&lt;p&gt;on 1&lt;/p&gt;

&lt;p&gt;off 0&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/cpu_register_20201122181456.png&quot; alt=&quot;Decimal to bit&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;memory-controller-chip-&quot;&gt;Memory Controller Chip &lt;span id=&quot;6.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;MCC&lt;/p&gt;

&lt;p&gt;Address bus&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/address_bus_20201122181927.png&quot; alt=&quot;Address bus&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/mcc_20201122182034.png&quot; alt=&quot;mcc&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/mcc_look_for_data_20201122182138.png&quot; alt=&quot;mcc look for data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Cache&lt;/p&gt;

&lt;p&gt;There are 3 different cache levels in a CPU: L1,L2, andL3.&lt;/p&gt;

&lt;p&gt;L1is the smallest and fastest cache.&lt;/p&gt;

&lt;p&gt;Clock wire&lt;/p&gt;

&lt;p&gt;Calculations&lt;/p&gt;

&lt;p&gt;Clock cycle&lt;/p&gt;

&lt;p&gt;Clock speed&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Clock speed
The maximum number of clock cycles that
it can handle in a certain time period&lt;/p&gt;

  &lt;p&gt;3.40 gigahertz is 3.4 billion cycles per second.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Overclocking&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/cpu_clock_20201122182802.png&quot; alt=&quot;cpu clock&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/cpu_instruction_set_20201122183023.png&quot; alt=&quot;instruction set&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Adding
Subtracting
Copying data&lt;/p&gt;

&lt;p&gt;instruction sets are hard-coded into out CPU.&lt;/p&gt;

&lt;p&gt;Replacing failed hard disks
Upgrading RAM modules
Installing video cards&lt;/p&gt;

&lt;p&gt;Intel
AMD
Qualcomm&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Intel Corei7
AMD Athlon
Snapdragon 810
AppleA8&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When you select your CPU, you’ ll need to make sure it’s compatible with yourmotherboard–the circuit board that connects all your components together.&lt;/p&gt;

&lt;p&gt;cpu socket&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Land grid array(LGA)
Pin grid array(PGA)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/ram_20201122183922.png&quot; alt=&quot;ram&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There are lots of types of RAM, and the one that’s commonly found in computers is DRAM, or dynamic random-access memory.&lt;/p&gt;

&lt;p&gt;There are also different types of memorysticks that DRAM chips can be put on. The more modern DIMM sticks, which usuallystands for Dual Inline Memory Module, have different sizes of pins on them.&lt;/p&gt;

&lt;p&gt;SDRAM&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Synchronous
DRAM&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In today’s system, we use another type of RAM, called double data rate SDRAM or DDR SDRAM for short.&lt;/p&gt;

&lt;p&gt;DDR1
DDR2
DDR3
DDR4&lt;/p&gt;

&lt;h2 id=&quot;motherboards-&quot;&gt;Motherboards &lt;span id=&quot;6.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;total boss&lt;/p&gt;

&lt;p&gt;chipset&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Northbridge&lt;/p&gt;

  &lt;p&gt;Southbridge&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Peripherals&lt;/p&gt;

&lt;p&gt;External devices we connect to ourcomputer,like a mouse,keyboard,and monitor&lt;/p&gt;

&lt;p&gt;Expansion slots
Give us the ability to increase the functionality
of our computer&lt;/p&gt;

&lt;p&gt;PCI Express&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Peripheral Component
Interconnect Express&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Form factor&lt;/p&gt;

&lt;p&gt;ATX&lt;/p&gt;

&lt;p&gt;Advanced Technology
eXtended&lt;/p&gt;

&lt;p&gt;ITX&lt;/p&gt;

&lt;p&gt;Information Technology
eXtended&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/computer_20201122185850.png&quot; alt=&quot;computer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Storage&lt;/p&gt;

&lt;p&gt;Data sizes&lt;/p&gt;

&lt;p&gt;8bits 1 byte&lt;/p&gt;

&lt;p&gt;1,024 bytes&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/data_sizes_20201122190201.png&quot; alt=&quot;data sizes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Hard drive&lt;/p&gt;

&lt;p&gt;Hard disk
dives&lt;/p&gt;

&lt;p&gt;HDD&lt;/p&gt;

&lt;p&gt;RPM&lt;/p&gt;

&lt;p&gt;Revolution
per minute&lt;/p&gt;

&lt;p&gt;Solid state
drive&lt;/p&gt;

&lt;p&gt;SSD&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/HDD_SSD_20201122190639.png&quot; alt=&quot;data sizes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ATA&lt;/p&gt;

&lt;p&gt;Serial ATA&lt;/p&gt;

&lt;p&gt;SATA&lt;/p&gt;

&lt;p&gt;NVM Express&lt;/p&gt;

&lt;p&gt;NMe&lt;/p&gt;

&lt;p&gt;Power Supplies&lt;/p&gt;

&lt;p&gt;DC direct current&lt;/p&gt;

&lt;p&gt;AC  AC or alternating current&lt;/p&gt;

&lt;p&gt;Information which is normally listed underneath or on the side.&lt;/p&gt;

&lt;p&gt;cables&lt;/p&gt;

&lt;p&gt;power cable&lt;/p&gt;

&lt;p&gt;to understand electricy let’s use the example of water pipes.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/water_pipes_20201122191554.png&quot; alt=&quot;water pipes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/water_pipe_20201122191652.png&quot; alt=&quot;water pipes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;the higher the pressure the more water there will be when it comes electricity we refer to the pressure as Voltage.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/voltage_20201122191909.png&quot; alt=&quot;valtage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/voltage_20201122192053.png&quot; alt=&quot;valtage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/voltage_20201122192155.png&quot; alt=&quot;valtage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As a general rule, be sure to use the proper voltage for your electronics.&lt;/p&gt;

&lt;p&gt;Amperage&lt;/p&gt;

&lt;p&gt;AMPs&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/it/amps_20201122192405.png&quot; alt=&quot;Amperage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Wattage
The amount of volts and amps that a device
needs&lt;/p&gt;

&lt;p&gt;You can power most basic desktops with a 500W power supply.&lt;/p&gt;

&lt;p&gt;Peripherals&lt;/p&gt;

&lt;h1 id=&quot;todo-&quot;&gt;todo &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;Education
Medicine
Journalism
Construction
Transportation
Entertainment
Any industry&lt;/p&gt;

            </description>
            <pubDate>Sun, 22 Nov 2020 16:04:30 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/22/IT
            </guid>
        </item>
        
        <item>
            <title>cpu knowledge</title>
            <link>
                https://applelin8.github.io//2020/11/22/cpu
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/22/cpu&quot;&gt;https://applelin8.github.io/2020/11/22/cpu&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;information&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;name&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;power on&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.3&quot;&gt;power off&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.4&quot;&gt;power reset&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;p&gt;The Basic Principles of Computers for Everyone.&lt;/p&gt;

&lt;h1 id=&quot;information-&quot;&gt;information &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;name-&quot;&gt;name &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_20201122114631.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;cpu is short of Central Processing Unit.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_full_name_20201122112948.png&quot; alt=&quot;cpu full name&quot; /&gt;&lt;/p&gt;

&lt;p&gt;let’s remove the cover&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\remove_the_cover_20201122114737.png&quot; alt=&quot;remove cover&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_no_cover_20201122114845.png&quot; alt=&quot;cpu no cover&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_work_20201122114945.png&quot; alt=&quot;cpu work&quot; /&gt;&lt;/p&gt;

&lt;p&gt;cpu clock,&lt;/p&gt;

&lt;p&gt;cpu do very complicate things very quick.&lt;/p&gt;

&lt;p&gt;Intel cpu&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\intel_20201122115221.png&quot; alt=&quot;intel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\amd_20201122115309.png&quot; alt=&quot;amd&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\scott_20201122115400.png&quot; alt=&quot;scott&quot; /&gt;&lt;/p&gt;

&lt;p&gt;But how do it know?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\how_do_it_know_20201122115442.png&quot; alt=&quot;how do it know&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;www.ButHowDoItKnow.com&quot; title=&quot;www.But How Do It Know.com&quot;&gt;Book But How Do It Know&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;look under knees&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\look_under_knees_20201122120707.png&quot; alt=&quot;look under knees&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Motherboad&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\mother_board_20201122120847.png&quot; alt=&quot;mother board&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\Motherboard_1_20201122121102.png&quot; alt=&quot;Mother board 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\Motherboard_2_20201122121149.png&quot; alt=&quot;Motherboard 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\Motherboard_3_20201122121149.png&quot; alt=&quot;mother board 3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\wild_left_20201122121415.png&quot; alt=&quot;wild left&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_20201122121548.png&quot; alt=&quot;ram&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_address_beginning_20201122121710.png&quot; alt=&quot;cpu address beginning&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\address_data_20201122121853.png&quot; alt=&quot;address data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\read_data_20201122122104.png&quot; alt=&quot;read data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\write_data_20201122122201.png&quot; alt=&quot;write data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_data_20201122122316.png&quot; alt=&quot;ram data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_data_content_20201122122437.png&quot; alt=&quot;ram data content&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_data_Letter_20201122122600.png&quot; alt=&quot;ram data letter&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_mv_to_ram_socket_20201122122737.png&quot; alt=&quot;mv ram to socket&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\mv_ram_to_socket_2_20201122122912.png&quot; alt=&quot;mv ram to socket 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\ram_into_ram_socket_20201122123027.png&quot; alt=&quot;ram into the ram socket&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\group_ram_data_20201122123121.png&quot; alt=&quot;group ram data&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\instruction_Set_20201122123404.png&quot; alt=&quot;Instruction Set&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\instruction_set_2_20201122123611.png&quot; alt=&quot;instruction set 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_work_process_20201122123831.png&quot; alt=&quot;cpu work process&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;register--&quot;&gt;register  &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Arithmetic Logic Unit (ALU)&lt;/p&gt;

&lt;p&gt;Control Unit&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\alu_control_Unit_20201122144920.png&quot; alt=&quot;alu 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\alu_flag_20201122145006.png&quot; alt=&quot;alu 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\alu_register_20201122145046.png&quot; alt=&quot;alu register&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\alu_set_register_20201122145143.png&quot; alt=&quot;alu register&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_enable_20201122145240.png&quot; alt=&quot;register&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_enable_set_20201122145811.png&quot; alt=&quot;register set enable&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_out_20201122150105.png&quot; alt=&quot;register out&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_bus_20201122150159.png&quot; alt=&quot;register bus&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_other_20201122150513.png&quot; alt=&quot;register other&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_send_20201122150316.png&quot; alt=&quot;register&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_bus_20201122150835.png&quot; alt=&quot;register bus&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\flags_registers_20201122151250.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\alu_flags_20201122151218.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\register_compare_20201122151135.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\jmp_20201122151321.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\work_20201122152112.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\computer_20201122152023.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\harddisck_20201122152006.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\computer_20201122151937.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\motherboard_20201122151920.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\motherboard_20201122151853.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_20201122151828.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_20201122151804.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\cpu_20201122151745.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\top_level_20201122151719.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\control_write_20201122151616.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\jump_20201122151532.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\jump_20201122151452.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\jump_20201122151437.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\Memory_address_20201122151418.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\instruction_address_20201122151354.png&quot; alt=&quot;cpu&quot; /&gt;
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/cpu\instruction_address_20201122151337.png&quot; alt=&quot;cpu&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;todo--&quot;&gt;todo  &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;to be continued&lt;/p&gt;

            </description>
            <pubDate>Sun, 22 Nov 2020 11:40:30 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/22/cpu
            </guid>
        </item>
        
        <item>
            <title>clean code</title>
            <link>
                https://applelin8.github.io//2020/11/20/clean-code
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/20/clean-code&quot;&gt;https://applelin8.github.io/2020/11/20/clean-code&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;code&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;code noun&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;citation needed&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;code-&quot;&gt;code &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;code-noun-&quot;&gt;code noun &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;a set of instructions for a computer&lt;/li&gt;
  &lt;li&gt;a computer program,or a portion thereof&lt;/li&gt;
  &lt;li&gt;system of words,figures or symbols used to represent others,especially for the purposes of secrecy&lt;/li&gt;
  &lt;li&gt;a set of conventions or principles governing behaviour
or activity in a particular domain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;why
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/why_20201120092802.png&quot; alt=&quot;why&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;citation-needed--&quot;&gt;citation needed  &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;NDC {London}
16-20 January 2017
Inspiring Software Developers
since 2008&lt;/p&gt;

&lt;p&gt;short name
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/short_name_20201120094900.png&quot; alt=&quot;short name&quot; /&gt;&lt;/p&gt;

&lt;p&gt;choose right name
&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/choose_right_name_20201120094945.png&quot; alt=&quot;choose right name&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/blog/bad_comment_20201120092447.png&quot; alt=&quot;bad comment&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Clean Coders Hate What Happens to Your Code When You Use These Enterprise Programming Tricks&lt;/p&gt;

&lt;p&gt;Refactoring (noun):a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior. oR Kent Bit. Jolin lrnt Refactor(verb): to restructure software by applying a series of refactorings without changing the observable behavior of the software.&lt;/p&gt;

&lt;p&gt;Singleton Configuration
Singletons
Verbose Naming
Noisy Logging&lt;/p&gt;

&lt;p&gt;Log And Throw&lt;/p&gt;

&lt;p&gt;Repetition And Duplication&lt;/p&gt;

&lt;p&gt;Unnecessary Code&lt;/p&gt;

&lt;p&gt;Mixed Levels Of Abstraction&lt;/p&gt;

&lt;p&gt;Legacy Coding Habits&lt;/p&gt;

&lt;p&gt;Programming By Coincidence&lt;/p&gt;

&lt;p&gt;Programming By Superstition&lt;/p&gt;

&lt;p&gt;Kevlin Henney It is all to easy to dismiss problematic codebases on some nebulous idea of bad practice or bad programmers. Poor code, however, is rarely arbitrary and random in its structure or formulation. Systems of code, well or poorly structured, emerge from systems of practice, whether effective or ineffective. To improve code quality, it makes more sense to pick apart the specific practices and see their interplay — the cause — than to simply focus on the code itself — the effect. This talk looks at how a handful of coding habits, design practices and assumptions can systematically balloon code and compound its accidental complexity.  NDC Conferences &lt;a href=&quot;https://www.youtube.com/redirect?q=https%3A%2F%2Fndc-london.com&amp;amp;v=FyCYva9DhsI&amp;amp;event=video_description&amp;amp;redir_token=QUFFLUhqbi1RVkdDT19tWURWQTJualVqTEFSSlZGWGN4QXxBQ3Jtc0ttenI5TUhBMDMzLXRGajYycElaWmw3UEIwSnNwdjJpQW1qT3hjNVhiYTdGeUJET003VG9vZmJRQndKOU1aaVhXdmJnMjducUwyUVNlb2hoMXktcXFBUkJTeXVfX2lPajRDYjNIcExOZURnRWFuNVJSQQ%3D%3D&quot;&gt;https://ndc-london.com&lt;/a&gt; &lt;a href=&quot;https://www.youtube.com/redirect?q=https%3A%2F%2Fndcconferences.com&amp;amp;v=FyCYva9DhsI&amp;amp;event=video_description&amp;amp;redir_token=QUFFLUhqbjlxQU92TnpQVHE2SS1kNkRoTWJiUDdyZjhUQXxBQ3Jtc0tsQmRCamE5a0VZaHJTc25WajAwOUxOam1vVm55M2pmejhNM0duX2hQRUFPeDRYSHRVM0l5U2trU0E1cUJXWU4tRThkM1N4ZFQ0N1VWMm85QmVKNjlieFlUNjVHT3pkQlV1dEZ4OWpzZWtsdHAyay1Qbw%3D%3D&quot;&gt;https://ndcconferences.com&lt;/a&gt;NDC {London}
16-20 January 2017
Inspiring Software Developers
since 2008&lt;/p&gt;

&lt;p&gt;What if I told you 
Morpheus never says
“What if I told you”?&lt;/p&gt;

&lt;p&gt;Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose.
Cargo cult programming can also refer to the results of applying a design pattern or coding style blindly without understanding the reasons behind that design principle.
http://en. wikipedia.org/wiki/Cargo_cult_programming&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated.
Anderson’s Law&lt;/p&gt;

  &lt;p&gt;The default action is executed only if some previous actions were not executed.
We ask if we can accomplish this without having to check the conditions for the previous actions twice; in other words, if we can make the control flow follow the information flow without loosing modularity.
MaciejPirog
“FizzBuzz in Haskell by Embedding a Domain-Specific Language”&lt;/p&gt;

  &lt;p&gt;A work of art is the unique result of a unique temperament.
Oscar Wilde&lt;/p&gt;

  &lt;p&gt;Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose.
http://en.wikipedia.org/wiki/Cargo_cult programming&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;Signal-to-noise ratio(often abbreviated SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise.
Signal-to-noise ratio is sometimes used informally to refer to the ratio of useful information to false or irrelevant data in a conversation or exchange.
http/en. awikipedi. org/huiki/Signal_to_noise_ratio&lt;/p&gt;

&lt;p&gt;To be,or not to be:that is the question: Whether ‘tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them?
William Shakespeare Hamlet&lt;/p&gt;

&lt;p&gt;Continuing existence or cessation of existence: those are the scenarios. Is it more empowering mentally to work towards an accommodation of the downsizings and negative outcomes of adversarial circumstance, or would it be agreater enhancement of the bottom line to move forwards to a challenge to our current difficulties, and, by making a commitment to opposition, to effect their demise?
Tom Burton Long Words Bother Me&lt;/p&gt;

&lt;p&gt;Comments A delicate matter, requiring taste and judgement.I tend to err on the side ofeliminating comments, for several reasons. First, if the code is clear, and uses good type names and variable names, it should explain itself. Second, comments aren’t checked by the compiler, so there is no guarantee they’ re right, especially after the code is modified.A misleading comment can be very confusing. Third, the issue of typography: comments clutter code.
Rob Pike,”Notes on Programming in C”&lt;/p&gt;

&lt;p&gt;I currently have an average of 15-25 imports in each source file, which is seriously making my code mixed-up and confusing.
Is too many imports in your code a bad thing?
Is there any way around this?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Avoid Long Import Lists by Using Wildcards Long lists of imports are daunting to the reader.
We don’t want to clutter up the tops of our modules with 80 lines of imports. Rather wewant the imports to be a concise statement about which packages we collaborate with.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is not a problem.Any IDE will manage imports and show them to you only when needed.
Most IDEs support code folding where all the imports are folded down to one line.I rarely even see my imports these days as the IDE manages them and hides them as well.&lt;/p&gt;

&lt;p&gt;Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won’t clutter your view.&lt;/p&gt;

&lt;p&gt;http://stackoverflow. com/questions/8485689/too-many-imports-spamming-my-code&lt;/p&gt;

&lt;p&gt;What is the Matrix?
Control.
The Matrix is a computer-generateddream world built to keep us undercontrol in order to change a human being into this.&lt;/p&gt;

&lt;p&gt;A common fallacy is to assume authorsof incomprehensible code will somehowbe able to express themselves lucidly and clearly in comments.
Kevlin Henney https://twitter.com/KevlinHenney/status/381021802941906944&lt;/p&gt;


            </description>
            <pubDate>Fri, 20 Nov 2020 21:03:56 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/20/clean-code
            </guid>
        </item>
        
        <item>
            <title>ipmitool power control</title>
            <link>
                https://applelin8.github.io//2020/11/19/ipmitool
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/19/ipmitool&quot;&gt;https://applelin8.github.io/2020/11/19/ipmitool&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;power control&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1.1&quot;&gt;power status&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.2&quot;&gt;power on&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.3&quot;&gt;power off&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#1.4&quot;&gt;power reset&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;power-control-&quot;&gt;power control &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;power-status-&quot;&gt;power status &lt;span id=&quot;1.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ipmitool &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_ip&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; lanplus &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_username&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_pwd&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; power status
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;error&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error: Unable to establish IPMI v2 / RMCP+ session&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;on
    &lt;blockquote&gt;
      &lt;p&gt;Chassis Power is on&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;off
    &lt;blockquote&gt;
      &lt;p&gt;Chassis Power is off&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;power-on--&quot;&gt;power on  &lt;span id=&quot;1.2&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   ipmitool &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_ip&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; lanplus &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_username&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_pwd&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; power on
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;result
    &lt;blockquote&gt;
      &lt;p&gt;Chassis Power Control: Up/On&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;power-off--&quot;&gt;power off  &lt;span id=&quot;1.3&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   ipmitool &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_ip&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; lanplus &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_username&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_pwd&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; power off
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;result
    &lt;blockquote&gt;
      &lt;p&gt;Chassis Power Control: Down/Off&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;power-reset--&quot;&gt;power reset  &lt;span id=&quot;1.4&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;   ipmitool &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_ip&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-I&lt;/span&gt; lanplus &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_username&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bmc_pwd&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt; power reset
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;result
    &lt;blockquote&gt;
      &lt;p&gt;Chassis Power Control: Reset&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ul&gt;

            </description>
            <pubDate>Thu, 19 Nov 2020 22:21:36 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/19/ipmitool
            </guid>
        </item>
        
        <item>
            <title>TEE</title>
            <link>
                https://applelin8.github.io//2020/11/19/1207-TEE-Trusted-Execution-Environment
            </link>
            <description>
                &lt;h2 id=&quot;tee&quot;&gt;TEE&lt;/h2&gt;

            </description>
            <pubDate>Thu, 19 Nov 2020 12:27:36 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/19/1207-TEE-Trusted-Execution-Environment
            </guid>
        </item>
        
        <item>
            <title>how to learn anything</title>
            <link>
                https://applelin8.github.io//2020/11/18/how-to-learn-anything
            </link>
            <description>
                &lt;h2 id=&quot;how-to-learn-anything&quot;&gt;how to learn anything&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;think out what would you like to learn?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;4-simple-steps-to-rapid-skill-acquisition&quot;&gt;4 simple steps to rapid skill acquisition&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Deconstruct the skill&lt;/li&gt;
  &lt;li&gt;Learn enough to self-correct&lt;/li&gt;
  &lt;li&gt;Remove practice barries&lt;/li&gt;
  &lt;li&gt;Practice at least 20 hours&lt;/li&gt;
&lt;/ol&gt;


            </description>
            <pubDate>Wed, 18 Nov 2020 00:00:00 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/18/how-to-learn-anything
            </guid>
        </item>
        
        <item>
            <title>any questions have answers</title>
            <link>
                https://applelin8.github.io//2020/11/17/any-questions-have-answers
            </link>
            <description>
                &lt;p&gt;#any questions have answers&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;你遇到的所有问题，都有答案。
    &lt;blockquote&gt;
      &lt;p&gt;不知道答案不要紧，寻找它。
在书里，在生活里，在梦里，在错误里，在换角度思考里，
在想象里，在变换角色里，真正安静地，没有干扰的，在心里体验之。
在没有答案时，沉静，实验，多个思路，多个角度，多个维度来体验。
一切定理定律，是在满足一定条件后才达到现在的效果和结果的。
随机性到处都是,一个条件是对应一个结果，是一个随机性的必然性。&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;分不清答案是令人很困惑的，
突破分清，会令人收获答案。&lt;/li&gt;
&lt;/ul&gt;

            </description>
            <pubDate>Tue, 17 Nov 2020 00:00:00 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/17/any-questions-have-answers
            </guid>
        </item>
        
        <item>
            <title>hello my post</title>
            <link>
                https://applelin8.github.io//2020/11/16/hello
            </link>
            <description>
                &lt;hr /&gt;
&lt;p&gt;文章出自个人博客&lt;a href=&quot;https://applelin8.github.io/2020/11/16/hello&quot;&gt;https://applelin8.github.io/2020/11/16/hello&lt;/a&gt;，转载请申明&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;目录-&quot;&gt;目录 &lt;span id=&quot;home&quot;&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1&quot;&gt;问题&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2&quot;&gt;分析&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3&quot;&gt;解决方案&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#3.1&quot;&gt;方法一&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;问题-&quot;&gt;问题 &lt;span id=&quot;1&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;hello&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;分析-&quot;&gt;分析 &lt;span id=&quot;2&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;p&gt;how to show hello&lt;/p&gt;

&lt;h1 id=&quot;解决方案-&quot;&gt;解决方案 &lt;span id=&quot;3&quot;&gt;&lt;/span&gt;&lt;/h1&gt;

&lt;h2 id=&quot;方法一-&quot;&gt;方法一 &lt;span id=&quot;3.1&quot;&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;show hello.&lt;/p&gt;

&lt;p&gt;by words.
say.
listen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://AppleLin8.github.io/assets/img/say_hello.png&quot; alt=&quot;say hello&quot; /&gt;&lt;/p&gt;

            </description>
            <pubDate>Mon, 16 Nov 2020 00:00:00 +0800</pubDate>
            <guid>
                https://applelin8.github.io//2020/11/16/hello
            </guid>
        </item>
        
    </channel>
</rss>