1
0
Fork 0
DavidZhang73.github.io/search.xml

399 lines
122 KiB
XML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>在线视频标注工具 - Vidat</title>
<link href="/vidat/"/>
<url>/vidat/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="简介"><a class="header-anchor" href="#简介">¶</a>简介</h2><p><a href="https://github.com/anucvml/vidat" target="_blank" rel="noopener">Github</a> | <a href="http://users.cecs.anu.edu.au/~sgould/vidat/" target="_blank" rel="noopener">Host1 ANU</a> | <a href="https://vidat.davidz.cn/" target="_blank" rel="noopener">Host2 本站</a> | <a href="http://users.cecs.anu.edu.au/~sgould/vidatproto/" target="_blank" rel="noopener">Prototype ANU</a> | <a href="https://vidat.davidz.cn/?video=needinput.mp4&amp;annotation=needinput.json" target="_blank" rel="noopener">Demo</a></p><p>Vidat(VIDeo Annotation Tool)是我本科毕业设计的一部分,即设计实现一个开源的在线(浏览器内)视频标注工具,目前已经实现了四种标注功能,插值标注,导入导出等。</p><p>项目基于<a href="https://cn.vuejs.org/" target="_blank" rel="noopener">Vue.js</a>和<a href="https://quasar.dev/" target="_blank" rel="noopener">Quasar</a>开发。</p><h2 id="功能"><a class="header-anchor" href="#功能">¶</a>功能</h2><h3 id="Object"><a class="header-anchor" href="#Object">¶</a>Object</h3><p>使用矩形标注目标。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/object-1602225326.gif" alt="Object"></p><h3 id="Region"><a class="header-anchor" href="#Region">¶</a>Region</h3><p>使用多边形标注目标。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/region-1602225340.gif" alt="Region"></p><h3 id="Skeleton"><a class="header-anchor" href="#Skeleton">¶</a>Skeleton</h3><p>使用自定义的骨骼模型标注目标。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/skeleton-1602225346.gif" alt="Skeleton"></p><h3 id="Action"><a class="header-anchor" href="#Action">¶</a>Action</h3><p>定义动作的开始结束。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/action-1602225354.gif" alt="Action"></p><h3 id="视频教程"><a class="header-anchor" href="#视频教程">¶</a>视频教程</h3><p><a href="https://www.youtube.com/playlist?list=PLD-7XrNHCcFLv938DO4yYcTrgaff9BJjN" target="_blank" rel="noopener">Youtube</a></p><h2 id="特点"><a class="header-anchor" href="#特点">¶</a>特点</h2><ol><li>完善的配置选项,能够自定义 objectaction 标签,自定义骨架模型,并实时预览。</li><li>现代界面,实时预览标注情况。</li><li>插值功能,标注人员只需标注关键帧,两个关键帧之前的同一物体可以自动标注。</li><li>便利的导入导出,提供 Python 读取脚本,方便导入模型。</li><li>丰富的个性化设置,并且可以从 URL 读取设置,方便作为其他配套设施的一部分。</li><li>直接将源码复制到服务器即可运行,无需编译,集成。</li><li>Vue + Quasar 简单,高效,带有文档,方便二次开发。</li></ol>]]></content>
<categories>
<category> Productivity </category>
</categories>
<tags>
<tag> ANU </tag>
<tag> Javascript </tag>
</tags>
</entry>
<entry>
<title>宜家家居组装数据集</title>
<link href="/IKEA-ASM-Dataset/"/>
<url>/IKEA-ASM-Dataset/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="简介"><a class="header-anchor" href="#简介">¶</a>简介</h2><table><thead><tr><th style="text-align:center">Title</th><th style="text-align:center">The IKEA ASM Dataset: Understanding People Assembling Furniture through Actions, Objects and Pose</th></tr></thead><tbody><tr><td style="text-align:center">Author</td><td style="text-align:center">Yizhak Ben-Shabat</td></tr><tr><td style="text-align:center">Publish Year</td><td style="text-align:center">2020</td></tr><tr><td style="text-align:center">Link</td><td style="text-align:center"><a href="https://arxiv.org/abs/2007.00394" target="_blank" rel="noopener">https://arxiv.org/abs/2007.00394</a></td></tr><tr><td style="text-align:center">Code</td><td style="text-align:center"><a href="https://github.com/IkeaASM/IKEA_ASM_Dataset" target="_blank" rel="noopener">https://github.com/IkeaASM/IKEA_ASM_Dataset</a></td></tr></tbody></table><p>这个是我的导师小组里的研究员 Itzik 发布的一个组装宜家家居的视频数据集。其中数据集包括三个视角的 RGBD 图像,原子动作标注,人体姿势标注,物体分割标注,相机标定以及相关的辅助代码。</p><h2 id="总结"><a class="header-anchor" href="#总结">¶</a>总结</h2><h3 id="数据集"><a class="header-anchor" href="#数据集">¶</a>数据集</h3><p>背景方面,有 48 个人物5 个场景,场景是动态的,存在有无关人员走过的情况。每个场景下都组装两遍,一次在桌子上,一次在地板上,所以一共是 10 中场景设置。</p><p>家具方面4 种家居side table, coffee table, TV bench, and drawer每种三个颜色white, oak, and black。</p><p>标注方面,人工标注视频的$1%$左右,人工复核过。</p><h3 id="基准"><a class="header-anchor" href="#基准">¶</a>基准</h3><h4 id="Action-recognition"><a class="header-anchor" href="#Action-recognition">¶</a>Action recognition</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/table2-1602211486.png" alt="Action recognition"></p><h4 id="Multi-view-and-multi-modal-action-recognition"><a class="header-anchor" href="#Multi-view-and-multi-modal-action-recognition">¶</a>Multi-view and multi-modal action recognition</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/table3-1602211507.png" alt="Multi-view and multi-modal action recognition"></p><h4 id="Instance-segmentation"><a class="header-anchor" href="#Instance-segmentation">¶</a>Instance segmentation</h4><h4 id="Multiple-furniture-part-tracking"><a class="header-anchor" href="#Multiple-furniture-part-tracking">¶</a>Multiple furniture part tracking</h4><h4 id="Human-pose"><a class="header-anchor" href="#Human-pose">¶</a>Human pose</h4>]]></content>
<categories>
<category> Paper Review </category>
</categories>
<tags>
<tag> CV </tag>
<tag> Dataset </tag>
</tags>
</entry>
<entry>
<title>技巧速记Windows 10 透明效果无法正常工作</title>
<link href="/acrylic-not-working/"/>
<url>/acrylic-not-working/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="Q"><a class="header-anchor" href="#Q">¶</a>Q</h2><p>一开始我发现 <a href="https://github.com/microsoft/terminal" target="_blank" rel="noopener">Windows Terminal</a> 的 <code>useAcrylic</code> 选项无效github 之后发现 <a href="https://github.com/microsoft/terminal/issues/1414" target="_blank" rel="noopener">Acrylic transparency not working</a>,这个 Issue 里面有好几个描述的和我一样,不仅仅是 Windows Terminal很多系统的透明特效也都不工作。</p><p>原来Windows Terminal 是使用 <a href="https://www.microsoft.com/design/fluent/#/" target="_blank" rel="noopener">Fluent Design</a> 里面的 Acrylic 效果实现的透明,所以说,这个问题是个系统层面的,而不是 Windows Terminal 本身的。</p><p>问题的具体表现为,除了任务栏是透明的之外,其余所有的透明特效都不工作。所以我直接到 <a href="https://github.com/microsoft/microsoft-ui-xaml" target="_blank" rel="noopener">microsoft/microsoft-ui-xaml</a> 提了一个 <a href="https://github.com/microsoft/microsoft-ui-xaml/issues/2737" target="_blank" rel="noopener">Issue</a>。</p><h2 id="A"><a class="header-anchor" href="#A">¶</a>A</h2><p><a href="https://github.com/microsoft/microsoft-ui-xaml/issues/2737#issuecomment-650471950" target="_blank" rel="noopener">解决方案</a>,把英特尔显卡控制面板里面的输入范围调整成<code>全</code>,重启电脑即可。</p>]]></content>
<categories>
<category> Workaround </category>
</categories>
<tags>
<tag> Windows </tag>
</tags>
</entry>
<entry>
<title>技巧速记如何在Hexo中插入多行公式</title>
<link href="/multiline-equation-in-hexo/"/>
<url>/multiline-equation-in-hexo/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="Q"><a class="header-anchor" href="#Q">¶</a>Q</h2><p>我在博客中写公式的时候使用双斜线<code>\\</code>来代表换行,效果是这样的,</p><p>$$<br>\begin{bmatrix}<br>cos\theta &amp; sin\theta \<br>-sin\theta &amp; cos\theta<br>\end{bmatrix}<br>$$</p><pre><code class="language-latex">$$\begin{bmatrix}cos\theta &amp; sin\theta \\-sin\theta &amp; cos\theta\end{bmatrix}$$</code></pre><p>那么如何插入多行公式呢?</p><h2 id="A"><a class="header-anchor" href="#A">¶</a>A</h2><p>根据<a href="https://github.com/gcushen/hugo-academic/issues/291#issuecomment-334746889" target="_blank" rel="noopener">Multiple lines Mathjax formulas flattened to one line</a>,应该插入 <em>六个</em> 斜线来表示换行应该是由于Markdown的渲染机制导致<code>\\</code>被反义。</p><p>$$<br>\begin{bmatrix}<br>cos\theta &amp; sin\theta \\\<br>-sin\theta &amp; cos\theta<br>\end{bmatrix}<br>$$</p><pre><code class="language-latex">$$\begin{bmatrix}cos\theta &amp; sin\theta \\\\\\-sin\theta &amp; cos\theta\end{bmatrix}$$</code></pre>]]></content>
<categories>
<category> Workaround </category>
</categories>
<tags>
<tag> Markdown </tag>
</tags>
</entry>
<entry>
<title>想法速记SVD求齐次线性方程组 Ax=0 的解</title>
<link href="/SVD-for-homogeneous-linear-equation/"/>
<url>/SVD-for-homogeneous-linear-equation/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><p>众所周知SVD(奇异值分解)可以用于最小二乘法求齐次线性方程组$A\vec{x}=\vec{0}$的解。我看了很多资料,大多使用数学公式推导,得出结论。但是,曾经线性代数差点挂科的我,总觉得有些蹊跷。想了两天,终于有了一些感性的认知(不一定是对的😂),赶紧记录下来。</p><h2 id="矩阵有何意义"><a class="header-anchor" href="#矩阵有何意义">¶</a>矩阵有何意义</h2><p>按照我的理解,一个矩阵的实际意义是对应一个线性变换,这个变换可以理解为瞬间运动。例如,一个旋转矩阵,</p><p>$$<br>A=\begin{bmatrix}<br>cos\theta &amp; sin\theta \\\<br>-sin\theta &amp; cos\theta<br>\end{bmatrix}<br>$$</p><p>它的意思是,把一个向量顺时针旋转$\theta$。也就是说,给定一个$\vec{v_1}=[-1, 1]^T$, 那么变换的结果就是$\vec{v_2}=A\vec{v_1}=[1, 1]^T$.</p><p>除了旋转,矩阵还可以表示包括缩放,投影在内的所有<strong>线性变换</strong>。</p><p>十分推荐大家去看 3Blue1Brown 的 <em>线性代数的本质</em>B 站有<a href="https://www.bilibili.com/video/BV1ys411472E" target="_blank" rel="noopener">官方翻译版</a>,它完全颠覆了我对线性代数的认知。</p><h2 id="SVD到底干了什么"><a class="header-anchor" href="#SVD到底干了什么">¶</a>SVD到底干了什么</h2><p>$$<br>A = U\Sigma V^T<br>$$</p><p>SVD把矩阵$A(m\times n)$分解成了,</p><ul><li>$U(m\times m)$: 左奇异矩阵</li><li>$\Sigma(m\times n)$: 奇异值矩阵</li><li>$V(n\times n)$: 右奇异矩阵</li></ul><p>重点来了SVD的意思就是把一个本来由矩阵$A$表示的变换,转化成一个由$U,\Sigma,V$表示的变换。这个变换是,把一个向量,从以$V$为基向量的空间线性变换到成以$U$为基向量的空间中去($\Sigma$的意义可以说是缩放,待证实,暂时忽略)。这样我们就可以更深入的理解这个变换了。</p><p>例如旋转$\vec{v_1}$90度得到$\vec{v_2}$</p><p><img src="//davidz.cn/static/blog/2020-06-04-SVD-for-homogeneous-linear-equation/rotate90.svg" alt="rotate 90"></p><p>其中,</p><p>$$<br>U=\begin{bmatrix}<br>0 &amp; 1 \\\<br>1 &amp; 0<br>\end{bmatrix}<br>$$</p><p>$$<br>\Sigma=\begin{bmatrix}<br>1 &amp; 1<br>\end{bmatrix}<br>$$</p><p>$$<br>V=\begin{bmatrix}<br>-1 &amp; 0 \\\<br>0 &amp; 1<br>\end{bmatrix}<br>$$</p><p>也就是说,矩阵$A$可以被理解为,我们把一个向量$\vec{v_1}$,从以$\vec{e_1}=[-1, 0]^T,\vec{e_2}=[0, 1]^T$为基向量的空间线性变换到了以$\vec{e_1}=[0, 1]^T,\vec{e_2}=[1, 0]^T$为基向量的空间中。这个变换表现为旋转了90度。</p><h2 id="所以如何理解"><a class="header-anchor" href="#所以如何理解">¶</a>所以如何理解</h2><p>说回求齐次线性方程组$Ax=0$的解来。</p><p>按照矩阵的意义,我们这里要求的是,已知一个线性变换$A$,给定一个$\vec{x}$,使得线性变换后的结果为$\vec{0}$。</p><p>此时非常重要的是,如果$x=\vec{0}$,那一定成立,但是我们想找一个非平凡的解。</p><p>我们暂时不关心这个解是否存在也就是说如果不存在我们就找个最接近的最小二乘法思想我们直接使用SVD分解矩阵$A$,得到对应的$U,\Sigma,V$。</p><p>按照SVD的作用我们现在可以说矩阵$A$这个线性变换,把一个$\vec{x}$,从以$V$为基向量的空间线性变换到了以$U$为基向量的空间中,而我们想找,在以$V$为基向量的空间中,哪个向量会在投影后趋近于或者等于$\vec{0}$。更重要的是,我们只在乎这个向量的方向,而不在乎他的大小,因为它等于$\vec{0}$是个平凡解,这就像最小二乘法中,我们规定$|\vec{x}|=1$。</p><p>这时,答案就开始变得清晰了,因为我们想找的$\vec{x}$,应该就是$V$这组基向量中特异值$\sigma$最小的那一个$\vec{e_{min}}$,也就是说$\vec{x}=\vec{e_{min}}$。此时有两种情况,</p><ol><li>$\sigma=0$ 那么$\vec{x}$投影后的就是$\vec{0}$。</li><li>$\sigma\neq0$,那么$\vec{x}$投影后是使$A\vec{x}$最小的解。因为如果$\vec{x}\neq\vec{e_{min}}$,也就是说它偏离了$\vec{e_{min}}$,那么它一定由$\vec{e_{min}}$和另一个基向量线性组合,而无论怎么组合,$\sigma_{combine}\geq\sigma_{min}$。</li></ol><p>因此,我们求解$A\vec{x}=0$的过程就是,</p><ol><li>$U,\Sigma,V^T=SVD(A)$</li><li>$\vec{x}=V[:, -1]$</li></ol>]]></content>
<categories>
<category> Idea </category>
</categories>
</entry>
<entry>
<title>技巧速记:更改 Rattle 的语言</title>
<link href="/rattle-change-language/"/>
<url>/rattle-change-language/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="Q"><a class="header-anchor" href="#Q">¶</a>Q</h2><p>如何把Rattle的语言设置成英文从而避免显示<code>XXX</code>。</p><h2 id="A"><a class="header-anchor" href="#A">¶</a>A</h2><p>在<code>R_HOME/etc/Rprofile.site</code>的最后添加,</p><pre><code class="language-R">Sys.setenv(LANG=&quot;en&quot;)</code></pre>]]></content>
<categories>
<category> Workaround </category>
</categories>
<tags>
<tag> R </tag>
</tags>
</entry>
<entry>
<title>墙内 Jenkins 插件下载的一种解决方案</title>
<link href="/jenkins-update-solution-inside-gfw/"/>
<url>/jenkins-update-solution-inside-gfw/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>闲来无聊,在家折腾 DevOps第一步当然是部署一个 Jenkins 啦,然而一顿操作猛如虎,插件一个都下载不下来,总不能给 Jenkins 加个代理吧,所以有了下面这一通折腾。</p><h2 id="原因"><a class="header-anchor" href="#原因">¶</a>原因</h2><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E4%B8%8B%E8%BD%BD%E8%B6%85%E6%97%B6-1599485061.png" alt="下载超时"></p><p>根据经验,国外这些软件下载失败基本上都是因为链接不上服务器,换个源就好了。所以简单百度,找到大量相关教程,换了<a href="https://mirrors.tuna.tsinghua.edu.cn/" target="_blank" rel="noopener">清华源</a>在内的四五个镜像源,均无效。</p><p>这就非常奇怪了,所以我打开了清华源的<a href="https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json" target="_blank" rel="noopener">update-center.json</a>,仔细看了看,发现了蹊跷之处。原来,这个文件里面基本上所有插件的链接都指向了官网链接<code>http://updates.jenkins-ci.org/download/plugins/</code>。所以我们使用<code>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</code>只加速了下载这个文件的过程,而并没有加速下载插件的过程。</p><h2 id="解决方案"><a class="header-anchor" href="#解决方案">¶</a>解决方案</h2><p>那么解决方案就很简单了,我们只需要把<code>/var/jenkins_home/updates/default.json</code>这个文件中的所有</p><pre><code class="language-htmlmixed">http://updates.jenkins-ci.org/download/plugins/</code></pre><p>替换成,</p><pre><code class="language-htmlmixed">https://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/</code></pre><p>这样就好啦,但是总不能每次都自己手动替换吧,所以有下面这两个稍微复杂一点的自动化解决方案。</p><h3 id="方案-1-使用-nginx-重定向"><a class="header-anchor" href="#方案-1-使用-nginx-重定向">¶</a>方案 1 使用 nginx 重定向</h3><p>这个方法是参考的<a href="https://my.oschina.net/VASKS/blog/3106314" target="_blank" rel="noopener">jenkins 插件下载加速最终方案</a></p><p>具体我没有试,但是我之前写过 Nginx 的重定向,简单来讲就是遇到官方的地址,就重定向到清华源,配置起来稍微复杂一点。</p><h3 id="方案-2-自己搭建-Jenkins-Update-Center"><a class="header-anchor" href="#方案-2-自己搭建-Jenkins-Update-Center">¶</a>方案 2 自己搭建 Jenkins Update Center</h3><p>这个是我自己尝试出来的,原理就是我在服务器上定时(每小时)从清华源下载<code>update-center.json</code>,然后再把里面的 URL 替换成正确的地址,然后对外提供服务。</p><p>但是 Jenkins 对于<code>update-center.json</code>的地址有验证,<a href="https://github.com/jenkins-zh/mirror-adapter" target="_blank" rel="noopener">具体验证方法</a>不清楚(<s>我实在是懒的研究了</s>)。</p><blockquote><p>山重水复疑无路,柳暗花明又一村</p></blockquote><p>我在 Jenkins 的 Issue 里面找到一个<a href="https://issues.jenkins-ci.org/browse/JENKINS-11598?focusedCommentId=212431&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-212431" target="_blank" rel="noopener">老哥</a>说验证这个功能可以通过属性参数关闭,于是,这个问题就很简单啦。</p><pre><code class="language-shell">hudson.model.DownloadService.noSignatureCheck=true</code></pre><p>加上这个属性就好啦。</p><p><a href="https://jenkins-update.davidz.cn/" target="_blank" rel="noopener">具体教程</a></p><p>哈,插件全秒!😄</p>]]></content>
<categories>
<category> DevOps </category>
</categories>
<tags>
<tag> Linux </tag>
</tags>
</entry>
<entry>
<title>使用 Markdown 编写基于 Latex 的报告</title>
<link href="/write-latex-report-with-markdown/"/>
<url>/write-latex-report-with-markdown/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>计算机这个专业,有很多报告要做。在山威的时候,报告格式没有什么限制 WordPDF 都可以,那个时候我开始使用 Markdown 作为我的排版工具,因为实在是没有时间经历去研究 Word 的各种高级功能(<s>主要是懒</s>。Markdown 十分简单,易学,在<a href="https://github.com" target="_blank" rel="noopener">Github</a>等计算机专业相关平台使用也非常广泛,还可以通过各种模板快速生成<strong>好看</strong><strong>美观</strong><strong>专业</strong>的文档。</p><p>后来到了澳国立,老师教授们开始极力鼓吹 Latex 和 PDF基本上算是软性要求我们使用 Latex 编写,还规定了衬线字体,非衬线字体,字号,段落等等,图片还需要是 SVG 格式的矢量图片(最奇葩的是竟然一整节课只讲这个😂),最后生成 PDF 提交(据说这样分数高一些)。所以我开始了漫漫 Latex 学习之路。然而整个过程十分痛苦,装个 TeX Live 跑了好几个小时,换个字体换的我一脸懵逼,预览竟然都不是实时的!!!我甚至觉得还不如 Word 好用,又开始找那些 Latex 编辑器(同学的 MacOS 上有很不错的,然而我是 Windows之后是在线编辑器<a href="https://www.overleaf.com/" target="_blank" rel="noopener">Overleaf</a>,体验还行,但是一边学习 Latex 一边做实验写报告的体验实在是太差劲了,人都要<s>有丝</s>分裂了。我就先用 Markdown 记录下来,想着之后再改成 Latex 吧。然后,我用了 2 天左右的时间,找到了 Markdown 直接转报告的方法,就没再碰 Latex<s>还是懒</s>)。</p><h2 id="样例"><a class="header-anchor" href="#样例">¶</a>样例</h2><p><a href="https://github.com/Wandmalfarbe/pandoc-latex-template/#example-images" target="_blank" rel="noopener">eisvogel 主题样例</a></p><p>你也可以从<a href="https://davidz-blog.oss-cn-beijing.aliyuncs.com/asset/Report.pdf" target="_blank" rel="noopener">这里</a>看一下我的成果作为参考,我觉得完全符合我的要求。</p><h2 id="思路"><a class="header-anchor" href="#思路">¶</a>思路</h2><p>其实思路很简单,一切的一切都是因为<a href="https://pandoc.org/" target="_blank" rel="noopener">Pandoc</a>这个文档转换软件软件(类似于影音界的格式工厂?)的存在。它官网有一张巨型图片描述了它可以从那些格式转换成那些格式,基本上可以说覆盖了常见的所有文档格式。所以我们就可以用它把 Markown 语言写的文档转换成 PDF 格式的报告,过程中再用一套模板修饰一下就好啦。</p><blockquote><p>注意<br>Pandoc 通过 Markdown -&gt; Latex -&gt; PDF 的方式得到 PDF中间文件是 Latex</p></blockquote><h2 id="准备"><a class="header-anchor" href="#准备">¶</a>准备</h2><h3 id="Markdown-语法"><a class="header-anchor" href="#Markdown-语法">¶</a>Markdown 语法</h3><blockquote><p>注意<br>Markdown 实际上和 HTML 是“近亲”,你甚至可以直接使用 HTML 标签。</p></blockquote><p>这个百度或者谷歌一下很容易找到教程学起来也很简单10 分钟上手1 天熟练。</p><h3 id="Markdown-编辑器"><a class="header-anchor" href="#Markdown-编辑器">¶</a>Markdown 编辑器</h3><p>下面这俩我都有,看心情切换😄。</p><h4 id="选项-1-VSCode"><a class="header-anchor" href="#选项-1-VSCode">¶</a>选项 1: VSCode</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/VSCode-1599485366.png" alt="VSCode with Markdown Preview Enhanced"></p><p>微软出品,宇宙最强 IDE <code>Visual Studio</code> 的“弟弟”,宇宙最强编辑器。</p><p><a href="https://code.visualstudio.com/" target="_blank" rel="noopener">官网</a>|<a href="https://github.com/microsoft/vscode" target="_blank" rel="noopener">Github</a>下载安装包,双击安装即可。</p><p>虽然 <code>VSCode</code> 原生支持 Markdown但是下面这几个属于增强型插件</p><ol><li><a href="https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced" target="_blank" rel="noopener"><code>Markdown Preview Enhanced</code></a>,增强 Markdown 的预览效果,比如支持公式,清单之类的。</li><li><a href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker" target="_blank" rel="noopener"><code>Code Spell Checker</code></a>,检查你报告里的拼写错误(不过好像只支持英文)。</li><li><a href="https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint" target="_blank" rel="noopener"><code>Markdownlint</code></a>,检查 Markdown 的语法规范(强迫症专属)。</li><li><a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode" target="_blank" rel="noopener"><code>Prettier</code></a>,格式化 Markdown 代码(强迫症专属)。</li></ol><h4 id="选项-2-Typora"><a class="header-anchor" href="#选项-2-Typora">¶</a>选项 2: Typora</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/Typora-1599485376.png" alt="Typora"></p><p>写作体验一级棒👍。</p><p><a href="https://www.typora.io/" target="_blank" rel="noopener">官网</a>下载安装包,双击安装即可。</p><h3 id="Latex-Engine"><a class="header-anchor" href="#Latex-Engine">¶</a>Latex Engine</h3><blockquote><p>注意<br>Latex 是个语言规范Latex Engine 是它的实现,下面这俩都是 Latex Engine 的集合</p></blockquote><p>因为 Scoop 里面只有 MiKTeX所以我选择 MiKTeX。反正我只是写个报告选哪个应该都无所谓吧。</p><h4 id="选项-1-MiKTeX"><a class="header-anchor" href="#选项-1-MiKTeX">¶</a>选项 1: MiKTeX</h4><p>通过 Scoop 安装:</p><pre><code class="language-powershell">scoop install latex</code></pre><p>或者<a href="https://miktex.org/" target="_blank" rel="noopener">官网</a>下载安装。</p><h4 id="选项-2-TeX-Live"><a class="header-anchor" href="#选项-2-TeX-Live">¶</a>选项 2: TeX Live</h4><p><a href="http://tug.org/texlive/" target="_blank" rel="noopener">官网</a>下载安装。</p><h3 id="Pandoc"><a class="header-anchor" href="#Pandoc">¶</a>Pandoc</h3><h4 id="Pandoc-主程序"><a class="header-anchor" href="#Pandoc-主程序">¶</a>Pandoc 主程序</h4><p>这个就是前文所说的万能文档格式转换器软件了。</p><p>通过 Scoop 安装:</p><pre><code class="language-powershell">scoop install pandoc</code></pre><p>或者<a href="https://www.pandoc.org/" target="_blank" rel="noopener">官网</a>下载安装。</p><h4 id="Pandoc-Filter"><a class="header-anchor" href="#Pandoc-Filter">¶</a>Pandoc Filter</h4><p>Pandoc 支持自定义<a href="https://www.pandoc.org/filters.html" target="_blank" rel="noopener">过滤器</a>,类似于插件,支持 Lua, Haskell, Python(对于想要自己尝试开发的同学,强烈推荐<a href="https://github.com/sergiocorreia/panflute" target="_blank" rel="noopener">Panflute</a>,比官方的<a href="https://github.com/jgm/pandocfilters" target="_blank" rel="noopener">pandocfilters</a>更人性化一些)。</p><h5 id="原理"><a class="header-anchor" href="#原理">¶</a>原理</h5><pre><code>INPUT --&gt; reader --&gt; AST --&gt; filter --&gt; AST --&gt; writer --&gt; OUTPUT</code></pre><ul><li>INPUT: Pandoc 的输入。</li><li>reader: 把输入解析成 AST。</li><li>AST(Abstract Syntax Tree): 抽象语法树,这个是 Pandoc 的核心组件,是对所有支持的文件类型的抽象。</li><li>filter: 这里就是我们的过滤器了,注意他的输入和输出都是 AST。</li><li>writer: 把 AST 解析成输出。</li><li>OUTPUT: Pandoc 的输出。</li></ul><h5 id="例子"><a class="header-anchor" href="#例子">¶</a>例子</h5><p>上调所有小于 6 的标题的级别,如果大于 6则删除标题把标题变成段落。</p><pre><code class="language-python">from panflute import *def increase_header_level(elem, doc): if type(elem) == Header: if elem.level &lt; 6: elem.level += 1 else: return [] # Delete headers already in level 6def main(doc=None): return run_filter(increase_header_level, doc=doc)if __name__ == &quot;__main__&quot;: main()</code></pre><p>然后在 Pandoc 的命令中用<code>--filter</code>指定这个 Python 文件即可。</p><h5 id="推荐"><a class="header-anchor" href="#推荐">¶</a>推荐</h5><ul><li><a href="https://github.com/lierdakil/pandoc-crossref" target="_blank" rel="noopener">pandoc-crossref</a></li></ul><p>用于 Pandoc 中的交叉引用,图片,公式,章节等,这个我也是用 Scoop 安装的,没有 Scoop 的话看看<a href="https://github.com/lierdakil/pandoc-crossref#installation" target="_blank" rel="noopener">安装教程</a>吧。</p><table><thead><tr><th style="text-align:center">类型</th><th style="text-align:center">标识</th><th style="text-align:center">引用</th></tr></thead><tbody><tr><td style="text-align:center"><a href="http://lierdakil.github.io/pandoc-crossref/#image-labels" target="_blank" rel="noopener">图片</a></td><td style="text-align:center"><code>![Caption](file.ext){#fig:label}</code></td><td style="text-align:center"><code>@fig:label</code></td></tr><tr><td style="text-align:center"><a href="http://lierdakil.github.io/pandoc-crossref/#equation-labels" target="_blank" rel="noopener">公式</a></td><td style="text-align:center"><code>$$ math $$ {#eq:label}</code></td><td style="text-align:center"><code>@eq:label</code></td></tr><tr><td style="text-align:center"><a href="http://lierdakil.github.io/pandoc-crossref/#table-labels" target="_blank" rel="noopener">表格</a></td><td style="text-align:center"><code>: Caption {#tbl:label}</code></td><td style="text-align:center"><code>@tbl:label</code></td></tr><tr><td style="text-align:center"><a href="http://lierdakil.github.io/pandoc-crossref/#section-labels" target="_blank" rel="noopener">段落</a></td><td style="text-align:center"><code># Section {#sec:label}</code></td><td style="text-align:center"><code>@sec:label</code></td></tr><tr><td style="text-align:center"><a href="http://lierdakil.github.io/pandoc-crossref/#code-block-labels" target="_blank" rel="noopener">代码块</a></td><td style="text-align:center"><code>: Listing caption {#lst:label}</code></td><td style="text-align:center"><code>@lst:label</code></td></tr></tbody></table><ul><li><a href="https://github.com/jgm/pandoc-citeproc" target="_blank" rel="noopener">pandoc-citeproc</a></li></ul><p>用于 Pandoc 中的文献引用,这个是自带的,无需安装。</p><p>需要指定 BibTeX(.bib) 文件来指定你的参考源,长这个样子,</p><pre><code class="language-bibtex">@article{vinyals_show_2015,title = {Show and Tell: A Neural Image Caption Generator},url = {http://arxiv.org/abs/1411.4555},shorttitle = {Show and Tell},abstract = {Automatically describing the content of an image is a fundamental problem in articial intelligence that connects computer vision and natural language processing. In this paper, we present a generative model based on a deep recurrent architecture that combines recent advances in computer vision and machine translation and that can be used to generate natural sentences describing an image. The model is trained to maximize the likelihood of the target description sentence given the training image. Experiments on several datasets show the accuracy of the model and the fluency of the language it learns solely from image descriptions. Our model is often quite accurate, which we verify both qualitatively and quantitatively. For instance, while the current state-of-the-art {BLEU}-1 score (the higher the better) on the Pascal dataset is 25, our approach yields 59, to be compared to human performance around 69. We also show {BLEU}-1 score improvements on Flickr30k, from 56 to 66, and on {SBU}, from 19 to 28. Lastly, on the newly released {COCO} dataset, we achieve a {BLEU}-4 of 27.7, which is the current state-of-the-art.},journaltitle = {{arXiv}:1411.4555 [cs]},author = {Vinyals, Oriol and Toshev, Alexander and Bengio, Samy and Erhan, Dumitru},urldate = {2020-06-01},date = {2015-04-20},langid = {english},eprinttype = {arxiv},eprint = {1411.4555},keywords = {Computer Science - Computer Vision and Pattern Recognition}}</code></pre><p>以及 Citation Style Language(.csl)文件来指定你想要的引用格式,比如 APAMLAChicagoHarvard 或者国内常用的 GB7714-2005可以从<a href="https://github.com/citation-style-language/styles" target="_blank" rel="noopener">citation-style-language/styles</a>下载。</p><p>在文中用<code>[@vinyals_show_2015]</code>对应引用源即可实现引用自动生成,十分方便。</p><h4 id="Pandoc-Theme-Eisvogel-主题"><a class="header-anchor" href="#Pandoc-Theme-Eisvogel-主题">¶</a>Pandoc Theme: Eisvogel 主题</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/Eisvogel-1599485385.png" alt="Eisvogel"></p><p>这个是我找到的计算机专业风格的论文/报告/书籍/幻灯片的开源模板,对于我来说是真的很合适了,美观,简约又专业。</p><p><a href="https://github.com/Wandmalfarbe/pandoc-latex-template" target="_blank" rel="noopener">Github Release</a>下载,放到<a href="https://github.com/Wandmalfarbe/pandoc-latex-template#installation" target="_blank" rel="noopener">指定路径</a>,就完了,很简单。</p><h2 id="配置"><a class="header-anchor" href="#配置">¶</a>配置</h2><pre><code class="language-YAML">---# Pandoctitle: Title of the Reportauthor: Jiahao Zhangdate: Jul. 3, 1998block-headings: truedocumentclass: articlepapersize: a4geometry: margin=2.5cmmainfont: Calibrisansfont: Calibrimonofont: JetBrains MonoCJKmainfont: Microsoft YaHeifontsize: 10ptlistings: truetoc: truetoc-depth: 2secnumdepth: 4bibliography: [resources.bib]csl: ieee.csl# Eisvogeltitlepage: trueheader-right: Reportfooter-left: Australian National Universitytoc-own-page: truetable-use-row-colors: falselistings-no-page-break: falsecode-block-font-size: \normalsize# CrossrefsubfigGrid: trueautoSectionLabels: true# Citeproclink-citations: truereference-section-title: References---</code></pre><p>在每个 Markdown 文件最上面形如上面 YAML 代码的叫做<code>YAML Front Matter</code>,可以理解为对全文的配置。这里主要是一些对<a href="https://www.pandoc.org/MANUAL.html#variables" target="_blank" rel="noopener">Pandoc</a>,<a href="https://github.com/Wandmalfarbe/pandoc-latex-template#custom-template-variables" target="_blank" rel="noopener">Eisvogel</a>, <a href="http://lierdakil.github.io/pandoc-crossref/#general-options" target="_blank" rel="noopener">Crossref</a> 和 <a href="https://www.pandoc.org/MANUAL.html#citation-rendering" target="_blank" rel="noopener">Citeproc</a>的配置。</p><h2 id="生成"><a class="header-anchor" href="#生成">¶</a>生成</h2><p>运行下面的命令就可以生成 PDF 啦😄。</p><pre><code class="language-powershell">pandoc Report.md `-o Report.pdf `--standalone `--listings `--number-sections `--filter pandoc-crossref `--filter=pandoc-citeproc `--pdf-engine=xelatex `--template eisvogel</code></pre><p>简单解释一下,</p><ul><li><code>-o</code> 指定输出文件</li><li><code>--standalone</code> 独立完整文件</li><li><code>--listings</code> 使用<a href="https://ctan.org/pkg/listings" target="_blank" rel="noopener">listings</a>高亮代码</li><li><code>--number-sections</code> 启用段落编号</li><li><code>--filter pandoc-crossref</code> 使用过滤器 <code>pandoc-crossref</code></li><li><code>--filter pandoc-citeproc</code> 使用过滤器 <code>pandoc-citeproc</code></li><li><code>--pdf-engine=xelatex</code> 指定 PDF 的 engine 为 <code>xelatex</code></li><li><code>--template eisvogel</code> 指定模板为 <code>eisvogel</code></li></ul><h2 id="想法"><a class="header-anchor" href="#想法">¶</a>想法</h2><p>完整的捣鼓下来其实也和学习 Latex 难度差不多了,但是配置完了这一套,只要要求不变,我再写报告的速度会加快很多很多,因为我只需要专注的写 Markdown 就好了😄。</p><p>PS: 这个博客所有的文章就是使用 Markdown 编写的。</p>]]></content>
<categories>
<category> Productivity </category>
</categories>
<tags>
<tag> Windows </tag>
<tag> Markdown </tag>
</tags>
</entry>
<entry>
<title>卸载浪潮安装的 IP-GUARD 监控软件</title>
<link href="/inspur-ip-guard-uninstallation/"/>
<url>/inspur-ip-guard-uninstallation/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><blockquote><p>屋漏更遭连夜雨,船迟又遇打头风。</p></blockquote><p>刚刚处理完 Docker 里面的“病毒”,又发现自己的笔记本被安装了监控软件,身后一阵凉风。</p><h2 id="发现"><a class="header-anchor" href="#发现">¶</a>发现</h2><blockquote><p>事发突然,因为影响我开发,所以也没有来得及截图。</p></blockquote><p>为了使用 WSL2 里面的 Docker我加入了 <code>Windows 预览体验计划 - 慢</code>,把系统升级到了 Windows 10 2004。结果怪事就出现了——基本上所有的命令行都会在执行前显示一个错误。</p><pre><code class="language-shell">ANOMALY: use of REX.w is meaningless (default operand size is 64)</code></pre><p>从来没见过这个错误,我进入安全模式发现竟然也会报错,在百度 + 谷歌 + stackoverflow 依然无任何有效答案后,陷入了绝望😢。</p><p>本来呢,这个只是报个错,并不是什么大问题(<s>我本身有一点强迫症,不能忍</s>),但是 JetBrains 全家桶全部报错找不到 GitCLion 报错找不到 VS。这就严重影响我开发了。Windows 预览体验计划还非常坑,不能回退,于是我又尝试了<code>Windows 预览体验计划 - 快</code>,结果问题依旧。</p><p>终于我突发奇想在 Github 上搜了一下(<s>不是到我当时咋想的,病急乱投医把</s>),发现了一个叫<a href="https://github.com/martona/mhook" target="_blank" rel="noopener">mhook</a>的项目,在其类库代码中发现了<a href="https://github.com/martona/mhook/blob/master/disasm-lib/disasm_x86.c#L1749" target="_blank" rel="noopener">disasm_x86</a>这个文件,在第 1749 行发现了错误提示的源代码。</p><pre><code class="language-c">if (!SuppressErrors) printf(&quot;[0x%08I64X] ANOMALY: use of REX.w is meaningless (default operand size is 64)\n&quot;, VIRTUAL_ADDRESS);</code></pre><p>现在我大体知道了这个问题产生的原因。</p><ol><li>disasm 是一个 hook钩子可以注入到别的程序。</li><li>更新系统后,这个钩子库和新的系统发生了冲突,于是报错,理论上所有被注入的程序都会报错。</li><li>这个钩子应该是个<strong>监控软件</strong>或者病毒木马之类的。</li></ol><p>我想起了在浪潮实习的时候,我的老师给我说浪潮作为面向政府国企的公司,对内部信息安全非常重视,所以会在员工的电脑里面安装监控软件,监控员工的一举一动,我当时感觉应该不会对实习生下手吧,想不到。。。回想起来,应该是入职浪潮的时候安装的那个上网小助手吧。</p><p>于是我下载了<a href="https://www.freefixer.com/" target="_blank" rel="noopener">freefixer</a>,查找注入的钩子,果不出其然,发现了在系统中安装的<a href="http://www.ip-guard.net/" target="_blank" rel="noopener">IP-GUARD</a>。按照官网的介绍,监控能力之强,范围之广令人汗颜,从网络到文件,邮件,应用等等,简直神通广大。</p><h2 id="处理"><a class="header-anchor" href="#处理">¶</a>处理</h2><p>我已经离职多日,第一时间肯定是卸载这个监控软件,直接删除文件肯定不行,结果 freefixer 也卸不掉(卸载完重启又出现),没有办法,只能到 WinPE 中手动逐一筛查,删除。</p><p>基本步骤如下</p><h3 id="1-进入-WinPE"><a class="header-anchor" href="#1-进入-WinPE">¶</a>1. 进入 WinPE</h3><blockquote><p>安全模式也会打开例如 explorer.exe 这样的系统进程,而监控软件也注入到了其中,所以安装全模式也不能删除</p></blockquote><p>这里免费帮<a href="https://www.itsk.com/forum.php?mod=viewthread&amp;tid=404842" target="_blank" rel="noopener">优启通</a>做个广告。</p><p>下载上面这个 PE 安装到本地或者 U 盘 都行,然后重启进入 WinPE 就好了。</p><h3 id="2-到系统盘中删除对应的所有文件"><a class="header-anchor" href="#2-到系统盘中删除对应的所有文件">¶</a>2. 到系统盘中删除对应的所有文件</h3><p>想不到这个公司还是很良心的,所有程序文件都签了名,在 freefixer 上查得到,叫<a href="https://www.freefixer.com/library/publisher/t.e.c%20solutions%20(g.z.)limited/" target="_blank" rel="noopener">T.E.C Solutions (G.Z.)Limited</a>。</p><blockquote><p>下面这些文件都是在 freefixer 上有记录的文件,可以作为检测 IP-GUARD 是否安装的标志。</p></blockquote><table><thead><tr><th style="text-align:center">File Name</th></tr></thead><tbody><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/ONacAgent.exe-211770/" target="_blank" rel="noopener">ONacAgent.exe</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/TIjtdrvd64.dll-261434/" target="_blank" rel="noopener">TIjtdrvd64.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/thooksv364.dll-261436/" target="_blank" rel="noopener">thooksv364.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/ONacAgent.exe-206855/" target="_blank" rel="noopener">ONacAgent.exe</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/winhadnt64.dll-95360/" target="_blank" rel="noopener">winhadnt64.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/DtFrame32.dll-206842/" target="_blank" rel="noopener">DtFrame32.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/winrdgv3.exe-122257/" target="_blank" rel="noopener">winrdgv3.exe</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/winrdlv3.exe-177929/" target="_blank" rel="noopener">winrdlv3.exe</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/winhafnt64.dll-211772/" target="_blank" rel="noopener">winhafnt64.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/TIjtdrvd64.dll-211775/" target="_blank" rel="noopener">TIjtdrvd64.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/ipnpf.sys-225950/" target="_blank" rel="noopener">ipnpf.sys</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/thooksv364.dll-211779/" target="_blank" rel="noopener">thooksv364.dll</a></td></tr><tr><td style="text-align:center"><a href="https://www.freefixer.com/library/file/winhadnt.dll-239634/" target="_blank" rel="noopener">winhadnt.dll</a></td></tr></tbody></table><p>我们可以利用 Windows Explorer 的按公司分组,快速找到所有相关文件。</p><ol><li>打开系统盘(这里假设是 C 盘),右键 - 分组依据 - 更多 - 勾选 公司 - 确定。</li><li>右键 - 分组依据 - 公司。</li><li>查看 - 选项 - 查看 - 应用到文件夹。</li><li>在下面的路径中找到所有公司为<code>T.E.C Solutions (G.Z.)Limited</code>的文件,删除。</li></ol><pre><code class="language-cmd">C:\Program Files\Common Files\SystemC:\Program Files (x86)\Common Files\SystemC:\WINDOWSC:\WINDOWS\System32C:\WINDOWS\System32\driversC:\WINDOWS\SysWOW64C:\WINDOWS\SysWOW64\drivers</code></pre><h3 id="3-重启"><a class="header-anchor" href="#3-重启">¶</a>3. 重启</h3><p>再次运行 freefixer 检查是否删干净了。</p><h2 id="想法"><a class="header-anchor" href="#想法">¶</a>想法</h2><p>像浪潮这样主要客户是政府,国企的企业,确实需要证明其安全能力,在他的员工的电脑上安装监控软件确实是有效措施,我能够理解。但是,这么大一企业,安装监控时没有主动告知(至少应该告知监控我的哪些行为),毕竟是我自己私人的笔记本,不是企业配发的,也没让我签字。离职时就算知道了也找不到卸载方法(那个上网小助手也是我进入安全模式手动删除的,因为正常卸载需要密码,我嫌麻烦就自己删了),所有面向实习生的文档教程都只有安装方法,我不知道是不是因为实习生的缘故,全程只有我的那个老师给我口头说了一声,我现在感觉自己受到了欺骗,个人隐私受到了严重侵犯,很难受,同时也非常生气,可是又很无力,因为这件事情可大可小,从网上的评论来看在各大企业中都很正常。</p><p>希望这样的事情以后不会发生了吧。🙏</p>]]></content>
<categories>
<category> Internship </category>
</categories>
<tags>
<tag> Windows </tag>
</tags>
</entry>
<entry>
<title>&quot;寄生&quot;于 Docker 的病毒 - Kinsing</title>
<link href="/kinsing-virus/"/>
<url>/kinsing-virus/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>2020 年开年不顺2019 新型冠状病毒肺炎爆发,从年三十居家隔离到了正月十五,没想到自己的服务器也”感染“上了病毒 - Kinsing(进程的名字,姑且这样称呼)。</p><h2 id="发现"><a class="header-anchor" href="#发现">¶</a>发现</h2><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/netdata-1599485973.png" alt="netdata"></p><p>偶然看了看服务器状态,发现 CPU 占用一直保持在 100%上下,有些蹊跷。</p><p>难道是我的博客访问量<s>暴增</s>???那是当然不可能的,然后我去看了看<a href="https://github.com/portainer/portainer" target="_blank" rel="noopener">Portainer</a>看了看,果然,</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/portainer-1599485974.png" alt="portainer"></p><p>这个随机名称的容器就是 Kinsing 基于 Ubuntu 的容器CPU 占用 100%。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E8%BF%9B%E7%A8%8B-1599485975.png" alt="进程"></p><p>简单看了看容器里面的进程表,第一个运行了一个 shell 脚本,这个病毒就是这个脚本下载启动的关键,我打开看了看,<s>也没看懂</s>,大概是下载了几个可执行文件。第二个是 cron这个是定时脚本我猜应该是病毒定时检查一下运行情况第三个好像是个守护进程第四个应该是用于容器保持第五个在网上能搜到是个<a href="https://www.baidu.com/s?wd=kdevtmpfsi" target="_blank" rel="noopener">挖矿的程序</a>。</p><p>无聊的我还简单看了看这个脚本的服务器 IP</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/ip-1599485976.png" alt="ip"></p><p>难道是俄罗斯大佬???</p><p>这个时候我突然想起来,前几天为了调试<a href="https://certbot.eff.org/" target="_blank" rel="noopener">certbot</a>的 Dockerfile, 我直接打开了 Docker 的<a href="https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option" target="_blank" rel="noopener">远程访问</a>,在默认的情况下是没有任何加密措施的。</p><p>这样,就真相大白了,这个病毒通过未加密的接口,在我的服务器上运行了挖矿的容器来盈利,同时也占用了服务器全部的 CPU😢.</p><h2 id="处理"><a class="header-anchor" href="#处理">¶</a>处理</h2><p>Kinsing 病毒还是很良心的(至少我遇到的这个是),把自己”关“在了容器里面,反正后来我也没有在别的地方发现相关文件。</p><p>所以处理起来也简单,</p><ol><li>删掉容器和镜像</li><li>关闭 Docker 远程访问即可。如果不想关闭的话也可以<a href="https://docs.docker.com/engine/security/https/" target="_blank" rel="noopener">用 https 的方式加密</a>。</li></ol><h2 id="小想法"><a class="header-anchor" href="#小想法">¶</a>小想法</h2><p>其实这个 Kinsing 病毒实现起来还是很简单的,</p><ol><li>扫描全网的 2375 这个默认端口</li><li>用 Docker API 连接并部署容器</li><li>执行脚本运行挖矿程序</li></ol><p><s>突然有一个邪恶的想法,一台机器一天就算 1 毛钱好啦</s>,哈哈哈,但是违法的事情不能做呀😄。</p><p>大家一定要注意呀,时刻谨记服务器安全,不要随意开放服务器端口。</p>]]></content>
<categories>
<category> DevOps </category>
</categories>
<tags>
<tag> Linux </tag>
<tag> Shell </tag>
<tag> Docker </tag>
</tags>
</entry>
<entry>
<title>Windows 包管理器 - Scoop</title>
<link href="/windows-package-manager-scoop/"/>
<url>/windows-package-manager-scoop/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>一直以来作为开发者Windows 相较于 Linux 都缺少两样重要的工具,</p><ol><li><strong>好用</strong>的 Shell - 现在可以用 PowerShell Core 或者 WSL 暂时代替。</li><li><strong>好用</strong>的包管理器 - 在开发时 C/Cpp 的库可以用<a href="https://github.com/microsoft/vcpkg" target="_blank" rel="noopener">VCPKG</a>,而日常使用的软件就可以使用本文的主角<a href="https://github.com/lukesampson/scoop" target="_blank" rel="noopener">Scoop</a> 了。</li></ol><h2 id="安装"><a class="header-anchor" href="#安装">¶</a>安装</h2><blockquote><p>按照官网的<a href="https://github.com/lukesampson/scoop/wiki/Quick-Start" target="_blank" rel="noopener">教程</a>,只能使用 PowerShell 而不是 CMD 进行安装。</p></blockquote><pre><code class="language-powershell"># 指定 Scoop 的安装路径,之后安装的 APP 会安装在 path/to/scoop/apps/$env:SCOOP='path/to/scoop'[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User')# 安装 ScoopInvoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')</code></pre><h3 id="Buckets"><a class="header-anchor" href="#Buckets">¶</a><a href="https://github.com/lukesampson/scoop/wiki/Buckets" target="_blank" rel="noopener">Buckets</a></h3><p>Scoop 只是一个包安装器,我们还需要软件源。</p><p>使用,</p><pre><code class="language-powershell">scoop bucket known</code></pre><p>可以列出所有官方已知并推荐的源,使用,</p><pre><code class="language-powershell">scoop bucket add &lt;bucket-name&gt;</code></pre><p>即可安装源。</p><ol><li><code>main</code> - Scoop 官方默认主源,里面所有的软件符合<a href="https://github.com/lukesampson/scoop/wiki/Criteria-for-including-apps-in-the-main-bucket" target="_blank" rel="noopener">标准</a>。</li><li><code>extras</code> - Scoop 官方扩展你源,里面的软件不完全符合标准。</li><li><code>versions</code> - 可选版本的源。</li><li><code>nightlies</code> - nightly 软件源,不推荐。</li><li><code>nirsoft</code> - <a href="https://nirsoft.net/" target="_blank" rel="noopener">Nir Sofer</a>开发的软件。</li><li><code>php</code> - 不同版本的 php。</li><li><code>nerd-fonts</code> - <a href="https://github.com/ryanoasis/nerd-fonts" target="_blank" rel="noopener">Nerd Fonts</a> 和一些其他字体。</li><li><code>nonportable</code> - 非便携软件(可能需要 UAC。</li><li><code>java</code> - 不同版本的 JDKJRE。</li><li><code>games</code> - 开源或免费的游戏以及游戏工具。</li><li><code>jetbrains</code> - JetBrains 全家桶。</li></ol><h2 id="使用"><a class="header-anchor" href="#使用">¶</a>使用</h2><p>和 Ubuntu 的 aptCentOS 的 yum 基本相同。</p><pre><code class="language-powershell"># 搜索scoop search &lt;package-name&gt;# 查看主页scoop home &lt;package-name&gt;# 安装scoop install &lt;package-name&gt;# 更新scoop update &lt;package-name&gt;# 卸载scoop uninstall &lt;package-name&gt;# 更新 Scoop所有源所有软件包scoop update *# 列出所有软件包scoop list</code></pre><h2 id="推荐的软件包"><a class="header-anchor" href="#推荐的软件包">¶</a>推荐的软件包</h2><h3 id="aria2"><a class="header-anchor" href="#aria2">¶</a><a href="https://aria2.github.io/" target="_blank" rel="noopener">aria2</a></h3><p>基本上常见的所有开源下载软件都是基于这个,不但可以跑在 x86 的电脑上, mips 的路由器arm 的手机都不是问题。</p><p>需要注意的是,安装 aria2 后Scoop 的默认下载器会自动改成 aria2并开启多线程下载。</p><h3 id="7zip"><a class="header-anchor" href="#7zip">¶</a><a href="https://www.7-zip.org/" target="_blank" rel="noopener">7zip</a></h3><p>界面超原始,但是替代个收费的 WinRAR以及一众国内带广告的解压软件不是问题。同时 Scoop 有时候也依赖于 7zip 来解压。</p><h3 id="adb"><a class="header-anchor" href="#adb">¶</a><a href="https://developer.android.com/studio/releases/platform-tools.html" target="_blank" rel="noopener">adb</a></h3><p>有的时候连个安卓手机就需要这个东西,虽然我不做安卓开发,但是我玩过<a href="https://github.com/chiqj/WechatJump" target="_blank" rel="noopener">微信跳一跳</a>呀。</p><h3 id="bat"><a class="header-anchor" href="#bat">¶</a><a href="https://github.com/sharkdp/bat" target="_blank" rel="noopener">bat</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/bat-1599485622.png" alt="bat"></p><p>用于代替 cat带行号带高亮可<code>tail -f</code>。</p><h3 id="cpu-z"><a class="header-anchor" href="#cpu-z">¶</a><a href="https://www.cpuid.com/softwares/cpu-z.html" target="_blank" rel="noopener">cpu-z</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/cpuz-1599485622.png" alt="cpuz"></p><p>著名的 CPU 信息查看软件。</p><h3 id="fiddler"><a class="header-anchor" href="#fiddler">¶</a><a href="https://www.telerik.com/fiddler" target="_blank" rel="noopener">fiddler</a></h3><p>著名的抓包软件大学机考神器CCTR-E 的题目和答案一起传输,哈哈哈)。</p><h3 id="figlet"><a class="header-anchor" href="#figlet">¶</a><a href="https://github.com/lukesampson/figlet" target="_blank" rel="noopener">figlet</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/figlet-1599485622.png" alt="figlet"></p><p>把字符串改成字符串图像,还有好几个主题,现在知道那些文档的开头是怎么生成了吧😄。</p><h3 id="git"><a class="header-anchor" href="#git">¶</a><a href="https://gitforwindows.org/" target="_blank" rel="noopener">git</a></h3><p>什么,你没听说过 git !!!,右上角,再见😢。</p><h3 id="motrix"><a class="header-anchor" href="#motrix">¶</a><a href="https://motrix.app/" target="_blank" rel="noopener">motrix</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/motrix-1599485622.png" alt="motrix"></p><p>使用 Electron 开发的 aria2 GUI 客户端,可惜不能指定 aria2只能使用自带的。</p><h3 id="neofetch"><a class="header-anchor" href="#neofetch">¶</a><a href="https://github.com/dylanaraps/neofetch" target="_blank" rel="noopener">neofetch</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/neofetch-1599485622.png" alt="neofetch"></p><p>当你想截个屏,展示一下你的 Terminal 又不知道放什么内容时,就它了。</p><h3 id="psutils"><a class="header-anchor" href="#psutils">¶</a><a href="https://github.com/lukesampson/psutils" target="_blank" rel="noopener">psutils</a></h3><p>Scoop 同开发者开发的一系列 PowerShell 工具,我就说 PS 在国外还是很火的吧。</p><ul><li>gitignore - 从 <a href="http://gitignore.io" target="_blank" rel="noopener">gitignore.io</a> 获取 .gitignore 文件模板并打印出来。</li><li>ln - 类似于 Linux 的 ln实现&quot;软连接&quot;。</li><li>runat - at 命令(微软从 Windows Server 2012 开始废弃)。</li><li>say - 类似于 MacOS 的 say让电脑说话。</li><li>shasum - 类似于 Linux 下的 shasum校验文件。</li><li>sudo - 类似于 Linux 的 sudo但是会显示 UAC 弹出窗口。</li><li>time - 类似 Linux 的 time显示程序运行时间。</li><li>touch - 类似 Linux 的 touch创建文件。</li><li>vimtutor - 因为 Scoop 中的 vim 自带的 vimtutor 无法使用,所以有了这个。</li></ul><h3 id="snipaste"><a class="header-anchor" href="#snipaste">¶</a><a href="https://www.snipaste.com/" target="_blank" rel="noopener">snipaste</a></h3><p><img src="https://i.v2ex.co/71Ftp04b.png" alt="snipaste"></p><p>带边缘检测的强大截图软件。</p><h3 id="spacesniffer"><a class="header-anchor" href="#spacesniffer">¶</a><a href="http://www.uderzo.it/main_products/space_sniffer/index.html" target="_blank" rel="noopener">spacesniffer</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/spacesniffer-1599485769.png" alt="spacesniffer"></p><p>想知道那个文件夹占用了你的 C 盘最多?</p><h3 id="teamviewer"><a class="header-anchor" href="#teamviewer">¶</a><a href="https://www.teamviewer.com/" target="_blank" rel="noopener">teamviewer</a></h3><p>在山威如何快速获得妹子的 QQ微信和手机号加入<a href="https://www.baidu.com/link?url=FSXLyJOtkvCZMj4zl2J-mFLG0Q1GrF6rysPOH8fHKwIAF44VnyyhI7fUML9i99xH&amp;wd=&amp;eqid=cbce32e700025b47000000065e37cf45" target="_blank" rel="noopener">极客鸟</a>,用 Teamviewer 帮妹子修电脑吧。</p><h3 id="wget"><a class="header-anchor" href="#wget">¶</a><a href="https://eternallybored.org/misc/wget/" target="_blank" rel="noopener">wget</a></h3><p>下载个 1kb 的文本文件还需要动用迅雷aria2<code>wget</code>一行命令搞定。</p><h3 id="win32-openssh"><a class="header-anchor" href="#win32-openssh">¶</a><a href="https://github.com/PowerShell/Win32-OpenSSH" target="_blank" rel="noopener">win32-openssh</a></h3><p>微软已经把 ssh 迁移到 Windows 平台上啦。</p><h3 id="winscp"><a class="header-anchor" href="#winscp">¶</a><a href="https://winscp.net/eng/docs/lang:chs" target="_blank" rel="noopener">winscp</a></h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/winscp-1599485622.png" alt="winscp"></p><p>图形化管理服务器的文件。</p><h2 id="软件结构"><a class="header-anchor" href="#软件结构">¶</a>软件结构</h2><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/tree-1599485622.png" alt="目录结构"></p><p>虽然结构还是很清晰的,但不得不说,这几个名字起的太谜了。</p><h3 id="apps"><a class="header-anchor" href="#apps">¶</a>apps</h3><p>这个目录下面时所有安装的软件包。每个软件包都是这样的,</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/app-1599485622.png" alt="apps"></p><p>每个 app 的 current 都指向最新的那个文件夹。</p><h3 id="buckets"><a class="header-anchor" href="#buckets">¶</a>buckets</h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/buckets-1599485622.png" alt="buckets"></p><p>这个目录下是所有安装的源。</p><p>实际上每个源只是一个单独的 git 仓库仓库里面有该源的所有软件包的信息文件。Scoop 依照这个信息文件安装配置软件包。</p><p>比如 7zip 的,</p><pre><code class="language-json">{ &quot;homepage&quot;: &quot;https://www.7-zip.org/&quot;, &quot;description&quot;: &quot;A multi-format file archiver with high compression ratios&quot;, &quot;license&quot;: { &quot;identifier&quot;: &quot;Freeware,LGPL-2.0-only,BSD-3-Clause&quot;, &quot;url&quot;: &quot;https://www.7-zip.org/license.txt&quot; }, &quot;version&quot;: &quot;19.00&quot;, &quot;architecture&quot;: { &quot;64bit&quot;: { &quot;url&quot;: &quot;https://7-zip.org/a/7z1900-x64.msi&quot;, &quot;hash&quot;: &quot;a7803233eedb6a4b59b3024ccf9292a6fffb94507dc998aa67c5b745d197a5dc&quot; }, &quot;32bit&quot;: { &quot;url&quot;: &quot;https://7-zip.org/a/7z1900.msi&quot;, &quot;hash&quot;: &quot;b49d55a52bc0eab14947c8982c413d9be141c337da1368a24aa0484cbb5e89cd&quot; } }, &quot;extract_dir&quot;: &quot;Files/7-Zip&quot;, &quot;bin&quot;: &quot;7z.exe&quot;, &quot;checkver&quot;: { &quot;url&quot;: &quot;https://www.7-zip.org/download.html&quot;, &quot;regex&quot;: &quot;Download 7-Zip ([\\d.]+)&quot; }, &quot;autoupdate&quot;: { &quot;architecture&quot;: { &quot;64bit&quot;: { &quot;url&quot;: &quot;https://7-zip.org/a/7z$cleanVersion-x64.msi&quot; }, &quot;32bit&quot;: { &quot;url&quot;: &quot;https://7-zip.org/a/7z$cleanVersion.msi&quot; } } }, &quot;shortcuts&quot;: [[&quot;7zFM.exe&quot;, &quot;7-Zip&quot;]]}</code></pre><h3 id="cache"><a class="header-anchor" href="#cache">¶</a>cache</h3><p>这个目录里面是下载的软件包安装程序等等缓存。</p><h3 id="persist"><a class="header-anchor" href="#persist">¶</a>persist</h3><p>这个目录存放的是这些软件的配置之类的文件,这些文件的特点是在软件更新时不变。</p><h3 id="shims"><a class="header-anchor" href="#shims">¶</a>shims</h3><p>这个目录是所有软件包的快捷方式。</p><p>每一个软件包都对应三个,</p><ol><li>package-name.exe</li><li>package-name.ps1</li><li>package-name.shim</li></ol><p>我其实有个疑问,我在命令行里输<code>package-name</code>,执行的是<code>package-name.exe</code>还是<code>package-name.ps1</code>呢?</p><p>简单的测试后发现,是根据使用的 shell 确定的CMD 里面是<code>package-name.exe</code>,而 PowerShell 里面是 <code>package-name.ps1</code>。</p><h2 id="软件包管理哲学"><a class="header-anchor" href="#软件包管理哲学">¶</a>软件包管理哲学</h2><blockquote><h3 id="引用自-SpencerWoo"><a class="header-anchor" href="#引用自-SpencerWoo">¶</a>引用自 <a href="https://sspai.com/u/spencerwoo/posts" target="_blank" rel="noopener">SpencerWoo</a></h3><p>最后我还是想说一说:为什么我们推荐使用「包管理」?<br>在写这篇文章之前我也看了我派上面对包管理工具介绍的文章,我觉得这些文章其实都没太讲清为什么我们需要用「包管理」这个看上去复杂难用的命令行工具去下载、管理我们的软件。毕竟现在的软件管理哲学是「我去 App Store 下一个不就行了嘛?」<br>需要明确的是:包管理的设计初衷是为了方便开发者管理和搭建开发环境。用包管理工具能够快速的安装开发工具、开发依赖,从而免去复杂的路径、环境变量等信息的配置。而我们作为普通用户,实际上用「包管理」工具的过程,就是在借鉴这种「软件管理哲学」。<br>但更重要的,也是更对我们用户安装基本软件的过程来说的,是我前文提到的:<br>一行代码省去了搜索、筛选、下载等繁琐步骤<br>安装方便、更新方便、卸载也方便<br>同时也最大程度杜绝了流氓捆绑软件的安装(因为 Scoop 本身和 Scoop 安装过程参考的配置文件都是开源的,要安装什么一目了然)<br>这些都是传统的「搜索 - 筛选 - 下载」的软件管理过程带来的复杂过程和安全隐患的极佳解决方法。<br>尝试一下 Scoop 吧!如果你对这个简洁、克制却依旧强大的工具产生兴趣,你一定离高阶 Windows 用户不远了。</p></blockquote><h2 id="推荐阅读"><a class="header-anchor" href="#推荐阅读">¶</a>推荐阅读</h2><p><a href="https://sspai.com/post/52496" target="_blank" rel="noopener">「一行代码」搞定软件安装卸载,用 Scoop 管理你的 Windows 软件</a></p>]]></content>
<categories>
<category> Productivity </category>
</categories>
<tags>
<tag> Windows </tag>
<tag> Open-Source </tag>
</tags>
</entry>
<entry>
<title>颜值是第一生产力 - Windows Terminal</title>
<link href="/beauty-is-productivity-windows-terminal/"/>
<url>/beauty-is-productivity-windows-terminal/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="回顾"><a class="header-anchor" href="#回顾">¶</a>回顾</h2><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/cmd-1599486120.png" alt="CMD"></p><p>记得我最早的时候用 Visual Studio 写了第一个 Hello World 程序,激动的点运行,出来个黑框一闪就过去了,啥也没看到。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/powershell-1599486121.png" alt="PowerShell"></p><p>后来偶然了解 PowerShell又变成了一个蓝色的框还会有进度提示红的黑的突兀得很😢。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/bash-1599486122.png" alt="bash"></p><p>后来上了大学终于在 Ubuntu 上见到了 bash完全改变了我对 Shell 的认知。</p><p>傻傻分不清 Shell 和 Terminal 的我,激动的打开 Git 自带的 bash它却长成了这样。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/gitbash-1599486123.png" alt="Git-Bash"></p><p>一番优化之后也不是不能用,后来还入坑了 <a href="https://github.com/cmderdev/cmder" target="_blank" rel="noopener">Cmder</a>,用于替代 <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank" rel="noopener">Putty</a> 那个更加原始的 terminal。</p><p>终于2019 年微软开始进入开源世界,为我们带来了颜狗的胜利: <a href="https://github.com/microsoft/terminal" target="_blank" rel="noopener">Windows Terminal</a>。</p><iframe src="//player.bilibili.com/player.html?aid=51700920&cid=90502402&page=1&high_quality=1&danmaku=0" allowfullscreen="true" width="100%" height="600" scrolling="no" frameborder="0" sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts" ></iframe><h2 id="下载-安装"><a class="header-anchor" href="#下载-安装">¶</a>下载&amp;安装</h2><blockquote><p>截止 2020 年 2 月 1 号Windows Terminal 还处在测试阶段,但是已经相对比较完善了,正常使用没有什么大问题了。</p></blockquote><h3 id="方法-1-通过-Windows-Store"><a class="header-anchor" href="#方法-1-通过-Windows-Store">¶</a>方法 1: 通过 Windows Store</h3><p><a href="https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701" target="_blank" rel="noopener">点击这里安装</a></p><h3 id="方法-2-通过-Github"><a class="header-anchor" href="#方法-2-通过-Github">¶</a>方法 2: 通过 Github</h3><p>在 Github 的 <a href="https://github.com/microsoft/terminal/releases" target="_blank" rel="noopener">Release</a> 中下载最新的那个双击安装就好啦,和方法 1 是一样的。</p><h3 id="方法-3-通过-Scoop"><a class="header-anchor" href="#方法-3-通过-Scoop">¶</a>方法 3: 通过 Scoop</h3><blockquote><p><strong>不推荐</strong><br>用 wt 命令启动时会有一个 CMD 窗口,逼死强迫症。</p></blockquote><p>Windows Terminal 在 Scoop 的 extras bucket 里面。</p><pre><code class="language-powershell">scoop install windows-terminal</code></pre><h2 id="配置"><a class="header-anchor" href="#配置">¶</a>配置</h2><p>通过配置,最终 terminal 可以长成这个样子。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/windows-terminal-1599486124.png" alt="windows terminal"></p><p>现阶段只有 json 格式的配置文件,还没有图形化配置界面,项目组说正式版会有,最终应该会与 Vscode 的配置一样。</p><p>根据官网给出的 <a href="https://raw.githubusercontent.com/microsoft/terminal/master/doc/cascadia/profiles.schema.json" target="_blank" rel="noopener">Profiles Schema</a>,我们可以很快的配置我们自己定制化的 Terminal。</p><p>下面是我自己用的配置文件,</p><pre><code class="language-json">{ &quot;$schema&quot;: &quot;https://aka.ms/terminal-profiles-schema&quot;, &quot;defaultProfile&quot;: &quot;{807502AB-0C92-4DF7-9C7C-1E9F7A2A47DE}&quot;, // 默认配置的 GUID 和下面的 profiles.list 中的一个相同 &quot;alwaysShowTabs&quot;: true, // 无论有几个 tab 是否都显示标签栏 &quot;requestedTheme&quot;: &quot;dark&quot;, // &quot;light&quot;,&quot;dark&quot;,&quot;system&quot; &quot;copyOnSelect&quot;: true, // 选择时复制 &quot;launchMode&quot;: &quot;maximized&quot;, // &quot;maximized&quot;,&quot;default&quot; &quot;profiles&quot;: { // shell 或程序的配置 &quot;defaults&quot;: { // 所有 shell 或程序配置的默认值 &quot;acrylicOpacity&quot;: 0.7, // 背景透明度 &quot;useAcrylic&quot;: true, // 是否启用透明背景 &quot;colorScheme&quot;: &quot;One Half Dark&quot;, // 色彩配置,和下面 schemes 中的一个相同 &quot;fontFace&quot;: &quot;JetBrains Mono&quot;, // 字体 &quot;fontSize&quot;: 12, // 字号 &quot;startingDirectory&quot;: &quot;.&quot;, // 工作路径,设置成 “.” 可以实现在资源管理器的地址栏输入 wt 直接打开时工作目录是当前目录 &quot;closeOnExit&quot;: &quot;always&quot; // &quot;never&quot;,&quot;graceful&quot;,&quot;always&quot; }, &quot;list&quot;: [ { &quot;guid&quot;: &quot;{807502AB-0C92-4DF7-9C7C-1E9F7A2A47DE}&quot;, // 唯一 GUID &quot;name&quot;: &quot;powershell core&quot;, // 在下拉框中显示的名称 &quot;commandline&quot;: &quot;pwsh.exe -nol&quot;, // 执行的命令,-nol 的作用是不显示 Microsoft 那些提示 &quot;icon&quot;: &quot;path/to/icon&quot; // 标签栏和下拉菜单中显示的图标 }, { &quot;guid&quot;: &quot;{85933BC0-E5D2-4299-9FBC-AC6C9F6DFD46}&quot;, &quot;name&quot;: &quot;davidz.cn&quot;, &quot;commandline&quot;: &quot;ssh.exe root@davidz.cn&quot;, // ssh 也可以,用于代替 Putty &quot;icon&quot;: &quot;path/to/icon&quot; } ] }, &quot;schemes&quot;: [ // 配色 { &quot;name&quot;: &quot;One Half Dark&quot;, // 我最喜欢的主题VscodeVSJetBrains 全家桶都有类似主题,关键词 atom one dark &quot;background&quot;: &quot;#282C34&quot;, &quot;black&quot;: &quot;#282C34&quot;, &quot;blue&quot;: &quot;#61AFEF&quot;, &quot;brightBlack&quot;: &quot;#5A6374&quot;, &quot;brightBlue&quot;: &quot;#61AFEF&quot;, &quot;brightCyan&quot;: &quot;#56B6C2&quot;, &quot;brightGreen&quot;: &quot;#98C379&quot;, &quot;brightPurple&quot;: &quot;#C678DD&quot;, &quot;brightRed&quot;: &quot;#E06C75&quot;, &quot;brightWhite&quot;: &quot;#DCDFE4&quot;, &quot;brightYellow&quot;: &quot;#E5C07B&quot;, &quot;cyan&quot;: &quot;#56B6C2&quot;, &quot;foreground&quot;: &quot;#DCDFE4&quot;, &quot;green&quot;: &quot;#98C379&quot;, &quot;purple&quot;: &quot;#C678DD&quot;, &quot;red&quot;: &quot;#E06C75&quot;, &quot;white&quot;: &quot;#DCDFE4&quot;, &quot;yellow&quot;: &quot;#E5C07B&quot; } ]}</code></pre><blockquote><p>GUID 可以使用这个<a href="https://www.guidgen.com" target="_blank" rel="noopener">在线网站</a> 或者 Visual Studio 自带的工具 guidgen 生成。</p></blockquote><h3 id="主题"><a class="header-anchor" href="#主题">¶</a>主题</h3><p>除了我最喜欢的这个 One Half Dark你还可以在<a href="https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/windowsterminal" target="_blank" rel="noopener">这里</a>选择自己喜欢的主题,复制到配置文件即可。</p><h3 id="字体"><a class="header-anchor" href="#字体">¶</a>字体</h3><p>我推荐使用 JetBrains 推出的字体 <a href="https://www.jetbrains.com/lp/mono/" target="_blank" rel="noopener">JetBrains Mono</a>,这是一款适合写代码的带连字的字体。类似的字体还有微软特意为 Windows Terminal 开发的 <a href="https://github.com/microsoft/cascadia-code" target="_blank" rel="noopener">Cascadia Code</a>,或者是 Mozilla 主推由 Nikita Prokopov 开发的 <a href="https://github.com/tonsky/FiraCode" target="_blank" rel="noopener">Fira Code</a>。</p><p>这些字体都在积极的维护和更新中,除了双击安装之外,还可以使用 Scoop 安装方便更新。在 Scoop 的 nerd-fonts bucket 中。</p><pre><code class="language-powershell">scoop install JetBrains-Mono</code></pre><h2 id="PowerShell-Core"><a class="header-anchor" href="#PowerShell-Core">¶</a><a href="https://github.com/PowerShell/PowerShell" target="_blank" rel="noopener">PowerShell Core</a></h2><p>PowerShell Core 是微软推出的基于 .Net Core 跨平台开源脚本语言,用于代替 PowerShell 和更加原始的 CMD。目前来看在国内基本上没什么影响力国外相对好一些。除非大家都用 Windows Server 作为服务器,否则我感觉前景也不是很乐观。但是作为个人使用起来还是很好用的。</p><p>PowerShell Core 也有自己的模块管理平台 <a href="https://www.powershellgallery.com" target="_blank" rel="noopener">PowerShell Gallery</a>。</p><p>搜索</p><pre><code class="language-powershell">Find-Module xxx</code></pre><p>安装</p><pre><code class="language-powershell">Install-Module xxx</code></pre><p>卸载</p><pre><code class="language-powershell">Uninstall-Module xxx</code></pre><p>更新</p><pre><code class="language-powershell">Update-Module xxx</code></pre><p>类似于 <code>.bashrc</code> 之与 bash <code>.zshrc</code> 之与 zshPowerShell 也有自己的配置文件<code>Microsoft.PowerShell_profile.ps1</code>,可以通过<code>$PROFILE</code>访问。</p><p>使用模块<code>Module</code>时,</p><pre><code class="language-powershell">Import-Module xxx</code></pre><p>如果每次启动 PowerShell 都想引用该插件,则在<code>Microsoft.PowerShell_profile.ps1</code>中添加<code>Import-Module xxx</code>即可。</p><h3 id="oh-my-posh"><a class="header-anchor" href="#oh-my-posh">¶</a><a href="https://github.com/JanDeDobbeleer/oh-my-posh" target="_blank" rel="noopener">oh-my-posh</a></h3><p>这个是 oh-my-zsh 的 PowerShell 版本,但是只能管理主题。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/robbyrussel-1599486125.png" alt="robbyrussel"></p><p>我比较喜欢的是这个 robbyrussel 主题,因为比较简洁。</p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/my-theme-1599486170.png" alt="my-theme"></p><p>后来参考了<a href="https://github.com/spencerwooo/dotfiles#powershell" target="_blank" rel="noopener">dotfiles</a>,自己按照 oh-my-zsh 的 ys 主题魔改了一个,为了区分不同环境,我把最前面的符号改成了<code>PS</code>。</p><p><a href="https://github.com/DavidZhang73/Config/blob/master/themes/MyTheme.psm1" target="_blank" rel="noopener">我的主题</a></p><h3 id="z"><a class="header-anchor" href="#z">¶</a><a href="https://github.com/vincpa/z" target="_blank" rel="noopener">z</a></h3><p>类似于 autojump实现原理就是每次 cd 都记录下来,然后 z name 会去匹配访问最多的那个路径,直接跳转到。非常实用。</p><h2 id="Linux-or-Windows-Subsystem-for-Linux"><a class="header-anchor" href="#Linux-or-Windows-Subsystem-for-Linux">¶</a>Linux or <a href="https://docs.microsoft.com/zh-cn/windows/wsl/about" target="_blank" rel="noopener">Windows Subsystem for Linux</a></h2><p>我用了好久好久的 bash 才终于知道了还有像 zshfish 这样更加人性化的 shell。从前者切换到后者就像从 dos 切换到 windows 一样惊艳。</p><h3 id="ohmyzsh"><a class="header-anchor" href="#ohmyzsh">¶</a><a href="https://github.com/ohmyzsh/ohmyzsh" target="_blank" rel="noopener">ohmyzsh</a></h3><p>这个是 zsh 的插件平台,支持添加主题,工具等等插件。</p><h4 id="z内置"><a class="header-anchor" href="#z内置">¶</a>z内置</h4><p>和上面 PowerShell 中的 z 是一样的。</p><h4 id="git内置"><a class="header-anchor" href="#git内置">¶</a>git内置</h4><p>这个主要是 git 命令的提示与自动补全(我没怎么用过)。</p><h4 id="sudo内置"><a class="header-anchor" href="#sudo内置">¶</a>sudo内置</h4><p>当你输入<code>apt update</code>提示无法获得锁的时候,按上键加两下<code>esc</code>就可以自动加上<code>sudo</code>啦。</p><h4 id="extract内置"><a class="header-anchor" href="#extract内置">¶</a>extract内置</h4><p>你背的过不同压缩文件的解压命令吗???背不过的话还是用用<code>extract</code>吧。</p><h4 id="zsh-autosuggestions"><a class="header-anchor" href="#zsh-autosuggestions">¶</a><a href="https://github.com/zsh-users/zsh-autosuggestions/" target="_blank" rel="noopener">zsh-autosuggestions</a></h4><p>根据命令历史记录自动建议,按右键自动补全。</p><h4 id="zsh-syntax-highlighting"><a class="header-anchor" href="#zsh-syntax-highlighting">¶</a><a href="https://github.com/zsh-users/zsh-syntax-highlighting" target="_blank" rel="noopener">zsh-syntax-highlighting</a></h4><p>命令高亮。</p><p>具体的配置文件可以参考<a href="https://github.com/DavidZhang73/Config/blob/master/dotfiles/.zshrc" target="_blank" rel="noopener">这里</a>。同时,如果你和我一样闲的话,也可以写一个简单的<a href="https://github.com/DavidZhang73/Config" target="_blank" rel="noopener">一键配置脚本</a>,这样只需要有网络链接的环境下,就可以一键还原 zsh 环境了。</p><h3 id="dircolors"><a class="header-anchor" href="#dircolors">¶</a>dircolors</h3><p>在 WSL 里面使用默认的<code>.dircolors</code>可能会亮瞎眼,所以可以使用 <a href="https://github.com/seebi/dircolors-solarized" target="_blank" rel="noopener">dircolors-solarize</a>作为代替。</p><p>下载后放到用户目录里面,在<code>.zshrc</code>里面添加</p><pre><code class="language-shell">eval $(dircolors -b $HOME/.dircolors)</code></pre><p>即可。</p><h2 id="推荐阅读"><a class="header-anchor" href="#推荐阅读">¶</a>推荐阅读</h2><p><a href="https://dowww.spencerwoo.com/" target="_blank" rel="noopener">Dev on Windows with WSL</a> - 强烈推荐</p><p><a href="https://sspai.com/post/52907" target="_blank" rel="noopener">5 个 PowerShell 主题,让你的 Windows 终端更好看</a></p><p><a href="https://sspai.com/post/52868" target="_blank" rel="noopener">告别 Windows 终端的难看难用,从改造 PowerShell 的外观开始</a></p>]]></content>
<categories>
<category> Productivity </category>
</categories>
<tags>
<tag> Windows </tag>
<tag> Open-Source </tag>
<tag> Terminal </tag>
</tags>
</entry>
<entry>
<title>浪潮实习</title>
<link href="/inspur-internship/"/>
<url>/inspur-internship/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>到了期末都说要找个实习的工作,我也跟个风😂。</p><p>我是主要是在<a href="https://www.shixiseng.com/" target="_blank" rel="noopener">实习僧</a>上找的(就当免费做个广告吧),我住在美丽的泉城济南,<s>这个地方好就好在</s>,咳咳咳,我大概填了填简历,可能是没啥亮点,投了三四家都不要我😢。</p><p>我分析原因大概有以下几条:</p><ol><li>我最喜欢最熟练的语言是 Python但是现在国内的环境Python 很少作为 Web 的后端,主要是用在机器学习(大数据分析,量化交易之类的)方面。济南大多数都是 Java 和 Cpp 岗。</li><li>我个人没有参加过 acm 之类的比赛,除了几个项目没法有效证明我的能力。</li><li>我这个寒假只能干 2 个月,<s>其实最终只干了一个半月</s>。</li><li>我是个大三的学生。可能培养了对于公司来说也没啥意义吧。</li></ol><p>最后还是十分感谢秦老师❤️,不但收了我到浪潮实习,还在实习过程中给了我很多帮助和指导。</p><p>下面列一列我学习了解的项目工具之类的。</p><h2 id="CppMicroServices"><a class="header-anchor" href="#CppMicroServices">¶</a><a href="https://github.com/CppMicroServices/CppMicroServices" target="_blank" rel="noopener">CppMicroServices</a></h2><p>我们主要做了一个插件管理器,是基于 CppMicroServices 的二次开发。这是一个 Cpp 的微服务框架,主要实现了 Bundle 的全生命周期管理,注册,启动,停止,状态管理等。</p><h2 id="CLion"><a class="header-anchor" href="#CLion">¶</a><a href="https://www.jetbrains.com/clion" target="_blank" rel="noopener">CLion</a></h2><p>大爱 Jetbrains 全家桶,我实习的第一件事大概就是给组里所有人安利了 CLion 吧。与宇宙第一 IDE Visual Studio 相比最突出的优点有</p><ol><li>精美的全功能编辑器。不是我吐槽VS 的编辑器为了向下兼容现在甚至已经落后 VSCode 了,这还是曾经的宇宙第一 IDE 嘛。举一个简单的例子,连字功能连个开关都找不到,重启 VS 没成功,重启电脑就成功了?再加上没有拼写检查?没有自动注释补全?没有缺陷提示?你可能觉得没什么,但是这些都是 CLion 的自带功能啊。</li><li>丰富完善的插件生态。虽然感觉比不上 VSCode但是相对于 VS😄。</li><li>CMake 项目的原生支持。VS 虽然也有,但是感觉应该还处在开发状态。</li><li>SVN &amp; Git 的原生支持。</li><li>远程开发功能。因为我们要求项目有跨平台能力所以需要在多个平台切换。VS 虽然也有这个功能,但是也是感觉在开发状态,相比 CLion 少了很多配置的灵活性。</li><li>丰富的主题。VS 硬伤。</li></ol><p>综上所述,对于 Cpp 的 CMake 跨平台项目,还是推荐使用 CLion 作为 IDE。</p><p>我猜测 Visual Studio 是宇宙第一 IDE 应该说的是对于 C# 项目吧。</p><h2 id="CMake"><a class="header-anchor" href="#CMake">¶</a><a href="www.cmake.org">CMake</a></h2><p>以前的 C/Cpp 项目对我来说就是个谜解决方案、项目傻傻分不清楚Visual Studio 写单文件程序,解算法题还是很溜的,但是两个文件以上就很晕。</p><p>傻瓜式的配置的优点和确定都是非常显著的,好用是好用,用好是真的难。</p><p>CMake 作为这几年流行的跨平台构建工具,实现了配置式构建,终于让我理解了大学里 Linux 老师讲的程序编译链接都是些啥。</p><p>下面我简单写一写 CMake 的入门知识。</p><h3 id="常见编译器"><a class="header-anchor" href="#常见编译器">¶</a>常见编译器</h3><table><thead><tr><th style="text-align:center">Platform</th><th style="text-align:center">Windows</th><th style="text-align:center">Linux</th></tr></thead><tbody><tr><td style="text-align:center">GNU(open source)</td><td style="text-align:center">MinGW, MinGW-w64</td><td style="text-align:center">GCC(GNU Compiler Collection)</td></tr><tr><td style="text-align:center">Other</td><td style="text-align:center">Clang(Apple), MSVC(Microsoft), ICC(Intel) etc.</td><td style="text-align:center">Clang(Apple), ICC(Intel) etc.</td></tr></tbody></table><p>上面这些编译器都可以作为 CMake 的编译器。</p><p>这里主要还是推荐 GCC毕竟老牌经过这么多年的洗礼了。</p><p>其次的话推荐 CLang这些年对于新特性特别是 C++20支持的不错。</p><p>再次就是如果真的需要 Windows 原生底层支持,那就只能使用 MSVC 啦。</p><h3 id="常见构建工具"><a class="header-anchor" href="#常见构建工具">¶</a>常见构建工具</h3><table><thead><tr><th style="text-align:center">Platform</th><th style="text-align:center">Windows</th><th style="text-align:center">Linux</th></tr></thead><tbody><tr><td style="text-align:center">GNU(open source)</td><td style="text-align:center">MinGW-make(Makefile)</td><td style="text-align:center">make(Makefile)</td></tr><tr><td style="text-align:center">Other</td><td style="text-align:center">nmake(Makefile), MSBuild(.vcxproj), ninja(.ninja), qmake etc.</td><td style="text-align:center">ninja(.ninja), qmake etc.</td></tr><tr><td style="text-align:center">Solution</td><td style="text-align:center">Visual Studio(.sln), QT(.project)</td><td style="text-align:center">XCode, QT(.project)</td></tr></tbody></table><p>以上所有都可以作为 CMake 的 Generator。</p><p>IDE 可以识别 CMake 根据 CMakeLists.txt 生成的 CMakeCache.txt从中获得项目构成编译连接选项等从而替代解决方案。</p><p>我们在项目中使用的情况是,在 Linux 下使用 make在 Windows 下使用 nmake。</p><h3 id="CMake-常用指令"><a class="header-anchor" href="#CMake-常用指令">¶</a>CMake 常用指令</h3><pre><code class="language-shell">Generate a Project Buildsystem cmake [&lt;options&gt;] &lt;path-to-source&gt; cmake [&lt;options&gt;] &lt;path-to-existing-build&gt; cmake [&lt;options&gt;] -S &lt;path-to-source&gt; -B &lt;path-to-build&gt;Build a Project cmake --build &lt;dir&gt; [&lt;options&gt;] [-- &lt;build-tool-options&gt;]Install a Project cmake --install &lt;dir&gt; [&lt;options&gt;]Open a Project cmake --open &lt;dir&gt;Run a Script cmake [{-D &lt;var&gt;=&lt;value&gt;}...] -P &lt;cmake-script-file&gt;Run a Command-Line Tool cmake -E &lt;command&gt; [&lt;options&gt;]Run the Find-Package Tool cmake --find-package [&lt;options&gt;]View Help cmake --help[-&lt;topic&gt;]</code></pre><p>这些其实用不太到,构建别人的项目只使用简单的<code>cmake ..</code>就好啦。</p><p>其他常用的 CLion 都有相应的图形化设置。</p><h3 id="Makefile"><a class="header-anchor" href="#Makefile">¶</a>Makefile</h3><pre><code class="language-makefile">&lt;TargetName&gt;: gcc &lt;arg1&gt; &lt;arg2&gt; ... &lt;file&gt; g++ &lt;arg1&gt; &lt;arg2&gt; ... &lt;file&gt; gcc &lt;arg1&gt; &lt;arg2&gt; ... &lt;file&gt;</code></pre><p>这个是传统的 makefile事实上对于大型项目已经很少有人这么写了详细参考<a href="https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html" target="_blank" rel="noopener">Autotools</a>。</p><h3 id="CMakeLists-txt"><a class="header-anchor" href="#CMakeLists-txt">¶</a>CMakeLists.txt</h3><pre><code class="language-cmake">cmake_minimum_required(VERSION 3.16)project(Demo)set(CMAKE_CXX_STANDARD 14)find_package(Poco REQUIRED COMPONENTS Foundation)include_directories(include)add_executable(Demo src/main.cpp)set(BUILD_SHARED_LIBS true)add_library(Cal src/cal.cpp include/cal.h)message(STATUS ${Poco_LIBRARIES})target_link_libraries(Demo ${Poco_LIBRARIES} Cal)set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/)set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/)</code></pre><p>这个是一个简单的 Demo链接外部的 Poco 库,还编译生成了一个动态库和一个可执行文件,然后指定了输出目录。</p><p>整体难度中等,主要原因是<a href="https://cmake.org/" target="_blank" rel="noopener">官网文档</a>有一点看不懂😢。</p><h2 id="Vcpkg"><a class="header-anchor" href="#Vcpkg">¶</a><a href="https://github.com/microsoft/vcpkg" target="_blank" rel="noopener">Vcpkg</a></h2><p>这个是微软开发的,类似于 Python 的 pipNodejs 的 npm总而言之就是个依赖包管理器。主要适用于解决开发依赖问题。</p><p>比如安装一个 poco原来你需要下载源码-&gt;编译源码-&gt;把文件放进项目-&gt;修改编译链接选项,然后才能用,现在你只需要</p><pre><code class="language-shell">vcpkg install poco</code></pre><p>然后在 CMakeLists.txt 里面添加</p><pre><code class="language-cmake">find_package(Poco REQUIRED COMPONENTS Foundation)</code></pre><p>然后再连接上 Target 就好啦。</p><p>Vcpkg 甚至还允许你使用</p><pre><code class="language-shell">vcpkg install poco:x64-windows</code></pre><p>直接安装 64 位的 Poco 库。</p><p>至于搜索和卸载都大同小异。</p><p><strong>但是</strong>,它有一个致命问题是,不支持版本管理,每个库都是由一个文件指定的,而不是像 pipnpm 之类的,有个在线仓库,所以,你 vcpkg 的版本直接决定了依赖的版本。</p><p>vcpkg 安装依赖都是下载后现编译安装的,不过这个应该是 C/Cpp 项目不可避免的,我也没找到 Windows 下更好的依赖包管理器。</p><h2 id="Poco"><a class="header-anchor" href="#Poco">¶</a><a href="https://github.com/pocoproject/poco" target="_blank" rel="noopener">Poco</a></h2><p>这个类似于野生 C++标准类库<a href="https://www.boost.org" target="_blank" rel="noopener">Boost</a>,但是官网说很轻量,使用感觉也确实是这样。但是用起来总感觉有一些问题,我也提了 issue作者也没回我可能太忙了吧。</p><p>基本上能够让 Cpp 在使用上达到 Java 的水平吧,但是肯定还是有一定的差距的,跟我熟悉的 Python 更是相差甚远,毕竟不是标准库,也情有可原吧。</p><p>用了一段时间之后,感觉这个库的实现还是很标准的,看了一些源代码,也很规范,以后再有 Cpp 的项目可以着重考虑一下了。</p><h2 id="Linux"><a class="header-anchor" href="#Linux">¶</a>Linux</h2><p>因为跨平台,在项目开发过程中大量使用了 Linux 上 shellsystemctldocker 这些工具以及 CFEngine Zabbix 这些运维的东西,感觉又喜欢上了 Linux 和命令行,熟悉了之后真是很方便。</p><p>同时因为是 C/Cpp 项目,我们编译了很多开源项目,算是终于知道了 Linux 根目录下面每个目录都是干啥的。</p><p>Linux 下的包管理器比如 aptyum 用起来也很爽。所以我也看了看 Windows 下面的包管理器,发现了 Scoop 这个神器,在另外一篇<a href="https://blog.davidz.cn/beauty-is-productivity-windows-terminal">博文</a>里介绍了它。</p><h2 id="MSYS2"><a class="header-anchor" href="#MSYS2">¶</a><a href="https://github.com/msys2/msys2" target="_blank" rel="noopener">MSYS2</a></h2><p>因为快离职的时候,新的需求要交叉编译 CFEngine虽然到离职也没搞成功但是让我发现了 MSYS2 这个交叉编译神器。</p><blockquote><p>MinGW 是在 Windows 平台的<a href="https://www.gnu.org/software/gcc" target="_blank" rel="noopener">GCC</a>,而 CygWin 和 MSYS2 均是在 MinGW 基础上的<a href="https://www.gnu.org/software/libc/manual/html_node/POSIX.html" target="_blank" rel="noopener">POSIX</a>子操作系统(概念类似于微软 WSL。<br><a href="https://www.cnblogs.com/Netsharp/p/11073142.html" target="_blank" rel="noopener">CygWin、Msys、MinGW、Msys2 的区别与联系</a></p></blockquote><p>选择 MSYS2 而不是 MinGW 也不是 CygWin 的主要原因也是因为 MSYS2 的包管理器 pacman。</p><p>交叉编译也是个大坑,巨坑无比,反正我也没研究明白,七八个可执行文件就编译出来一个。</p><h2 id="感谢"><a class="header-anchor" href="#感谢">¶</a>感谢</h2><p>感谢所有在实习中帮助过我的老师,同事们❤️。</p>]]></content>
<categories>
<category> Internship </category>
</categories>
<tags>
<tag> Cpp </tag>
<tag> Windows </tag>
<tag> Linux </tag>
</tags>
</entry>
<entry>
<title>ANU COMP2310(2019) Assignment 1</title>
<link href="/anu-comp2310-assignment1/"/>
<url>/anu-comp2310-assignment1/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><blockquote><p><strong>敬告</strong></p><div style="color: red">本博客仅供参考,请不要抄袭。</div></blockquote><h2 id="前言"><a class="header-anchor" href="#前言">¶</a>前言</h2><p>这是 ANU <a href="http://courses.cecs.anu.edu.au/courses/COMP2310/" target="_blank" rel="noopener">COMP2310</a>的第一次大作业,历时一个月左右,也是这个学期我写的最认真的一次作业,所以在博客搭建伊始,我先把这个记录下来。</p><h2 id="问题"><a class="header-anchor" href="#问题">¶</a>问题</h2><p>根据<a href="https://davidz-blog.oss-cn-beijing.aliyuncs.com/asset/Assignment1.pdf" target="_blank" rel="noopener">Assignment 1 PDF</a>中的描述,大概的意思就是在三维空间中有许多的<code>车</code>,具有速度和加速度(都是三维向量),而且不管是否加速,都会消耗一定的能量,当然加速也会加快能量的消耗。然后就是有一个或多个<code>能量球</code>,当然也是在运动中的,同样具有速度和加速度。当<code>车</code>和<code>能量球</code>靠近的时候,<code>车</code>能够获取到<code>能量球</code>的信息(加速度,速度,位置),并且加满能量,而当<code>车</code>与<code>车</code>靠近的时候,能够互相交换一次信息,这个信息的内容是自己定义的。<code>车</code>在能量耗尽后就消失了,而我们需要做的就是在一定的时间内,保证尽可能多的<code>车</code>存活。</p><h2 id="分析"><a class="header-anchor" href="#分析">¶</a>分析</h2><p>其实这个问题最关键的地方在于,没有一个中央的控制节点,也就是说对于每一个<code>车</code>来说都是完全平等且独立的。所以我们需要他们能够尽可能的一直处在能够交流的状态,并且都能知道<code>能量球</code>在哪里。</p><blockquote><p><strong>注意</strong><br>这个问题在没有中央控制时<strong>不存在</strong>最优解,我们只能无线接近最优解。<br>我采用的是<strong>球形模型</strong>,这个模型参考于这次作业的 <a href="https://cs.anu.edu.au/courses/comp2310/1-Labs-Assignments.html" target="_blank" rel="noopener">Examples</a>。<br>在和我的同学互相交流时,这个模型是最普遍的,解决方案是最多的,效果也是相对最好的。</p></blockquote><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/3D%E7%90%83%E5%BD%A2%E6%A8%A1%E5%9E%8B-1599486499.png" alt="3D球形模型"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/2D%E7%90%83%E5%BD%A2%E6%A8%A1%E5%9E%8B-1599486500.png" alt="2D球形模型"></p><p>球形模型设计的两大重点是:</p><ol><li>所有的<code>车</code>都均匀平等地分布在球面上(球面是个相对概念,可以是球壳???)。</li><li>所有的<code>车</code>都能随时交流,也就是说大家形成一个通讯网络。</li></ol><h2 id="实现"><a class="header-anchor" href="#实现">¶</a>实现</h2><blockquote><p><strong>注意</strong><br>所有的 Ada 代码都是示意性的,有可能不能直接在项目中使用。</p></blockquote><h3 id="Stage-A-B"><a class="header-anchor" href="#Stage-A-B">¶</a>Stage A&amp;B</h3><p>这个阶段中,能量球只有一个,我们让所有的<code>车</code>都围绕这个能量球运动来实现一个基本的球形模型。</p><h4 id="基本程序结构Basic-Program-Structure"><a class="header-anchor" href="#基本程序结构Basic-Program-Structure">¶</a>基本程序结构Basic Program Structure</h4><p>程序基本的结构是一个死循环,每次循环分为 4 个步骤:</p><ol><li>判断<code>能量球</code>信息</li><li>发送信息</li><li>接受信息</li><li>设置目的地和油门</li></ol><h4 id="消息结构Message-Structure"><a class="header-anchor" href="#消息结构Message-Structure">¶</a>消息结构Message Structure</h4><p>最基础的消息需要包括:</p><ol><li><code>能量球</code>的信息</li><li>获得<code>能量球</code>信息的时间戳</li></ol><h4 id="中央控制Central-Control"><a class="header-anchor" href="#中央控制Central-Control">¶</a>中央控制Central Control</h4><p>允许中央控制是 Stage 1 中的条件,我在作业中跳过了这一部分,因为</p><ol><li>在允许中央控制时,该问题存在最优解,该最优解应该是一个数学问题,对我来说难度过大。</li><li>后面的 Stage 2,3,4 均不允许中央控制。</li></ol><h4 id="能量球位置估计Energy-Globe-Position-Estimation"><a class="header-anchor" href="#能量球位置估计Energy-Globe-Position-Estimation">¶</a>能量球位置估计Energy Globe Position Estimation</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E8%83%BD%E9%87%8F%E7%90%83%E4%BD%8D%E7%BD%AE%E4%BC%B0%E8%AE%A1-1599486501.png" alt="能量球位置估计"></p><p>这个问题类似于一个追击问题(红球是一个匀速导弹,蓝球是拦截导弹),我们需要求的是预计追击时间$T_e$。</p><p><code>能量球</code>到追击点$P_m$,两个坐标相同,所以,</p><p>$$<br>P_m=VeT_{total}+P_e<br>$$</p><p>易得总时间,</p><p>$$<br>T_{total}=T_f-T_n+T_e<br>$$</p><p>通过边相等得,</p><p>$$<br>P_e+(T_f-T_n+T_e)V_e=V_vT_e+\frac{1}{2}A_vT_e^2+P_v<br>$$</p><p>即可解出$T_e$。</p><blockquote><p><strong>注意</strong><br>存在无法追击的情况,即($\Delta&lt;0$),因为我们这里是严格的计算,实际上整个追击过程只有 1-2 秒,并且在不断地更新<code>能量球</code>的信息,所以预计的那一段时间$T_e$通常可以忽略不计。但是在可以计算时,能够提供更加准确的预计到达时间,从而让<code>车</code>能够更加精准的决策何时去充电。</p></blockquote><h4 id="充电决策Charge-Determination"><a class="header-anchor" href="#充电决策Charge-Determination">¶</a>充电决策Charge Determination</h4><p>当同时满足以下两个条件时:</p><ol><li><code>车</code>知道<code>能量球</code>的信息</li><li><code>车</code>的预计剩余能量小于等于警戒能量</li></ol><p>预计剩余能量:</p><pre><code class="language-ada">Left_Charge := Current_Charge - Current_Discharge_Per_Sec * Estimated_Time;</code></pre><h4 id="半径决策Radius-Determination"><a class="header-anchor" href="#半径决策Radius-Determination">¶</a>半径决策Radius Determination</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E5%8D%8A%E5%BE%84%E5%86%B3%E7%AD%96-1599486502.png" alt="半径决策"></p><p>半径向量:</p><pre><code class="language-ada">Radius_Vector := Radius_Distance * Norm (Position - Vehicle_Message.EG.Position);</code></pre><p><code>车</code>的位置:</p><pre><code class="language-ada">Destination := Vehicle_Message.EG.Position + Radius_Vector;</code></pre><p>其中有些变量的值或初始值是由经验确定的</p><ol><li><code>Radius_Distance</code>的值是<code>0.3</code>,是因为多次实验发现在 64 个128 个256 个<code>车</code>的情况下<code>0.3</code>表现均衡。</li><li><code>Destination</code>的初始值是<code>(0, 0, 0)</code>,这样能够避免一开始时<code>车</code>四散,导致失去联系,不能构成球形。</li></ol><h4 id="使用当前能量优化半径Radius-Optimization-With-Current-Charge"><a class="header-anchor" href="#使用当前能量优化半径Radius-Optimization-With-Current-Charge">¶</a>使用当前能量优化半径Radius Optimization With Current Charge</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E4%BD%BF%E7%94%A8%E5%BD%93%E5%89%8D%E8%83%BD%E9%87%8F%E4%BC%98%E5%8C%96%E5%8D%8A%E5%BE%84-1599486502.png" alt="使用当前能量优化半径"></p><pre><code class="language-ada">Radius_Vector = (0.75 + 0.25 * Current_Charge) * Radius_Vector;</code></pre><p><code>0.75</code>和<code>0.25</code>都是人为确定的,没什么依据😄。</p><h4 id="一个解决碰撞的机制A-Solution-To-Collision"><a class="header-anchor" href="#一个解决碰撞的机制A-Solution-To-Collision">¶</a>一个解决碰撞的机制A Solution To Collision</h4><blockquote><p><strong>注意</strong><br>这个机制未经过控制变量实验验证,只是理论上分析得到的。</p></blockquote><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E4%B8%80%E4%B8%AA%E8%A7%A3%E5%86%B3%E7%A2%B0%E6%92%9E%E7%9A%84%E6%9C%BA%E5%88%B6-1599486503.png" alt="一个解决碰撞的机制"></p><p>因为<code>车</code>和<code>车</code>离的足够近时会发生碰撞,表现为大家都减速不动。所以当一个<code>车</code>从外层到<code>能量球</code>去加油时,周围的<code>车</code>减速会一定程度的减少碰撞的发生。</p><p>实现时,需要在消息结构中添加<code>Vehicle_Charge</code>来判断谁的能量更低。</p><h3 id="Stage-C"><a class="header-anchor" href="#Stage-C">¶</a>Stage C</h3><p>这个阶段中,能量球有两个或更多。我们遇到的新问题有:</p><ol><li>如何决策去围绕哪一个<code>能量球</code>运动</li><li>如何自适应球形模型大小的变化</li></ol><h4 id="多个能量球决策Multiple-Energy-Globes-Decision"><a class="header-anchor" href="#多个能量球决策Multiple-Energy-Globes-Decision">¶</a>多个<code>能量球</code>决策Multiple Energy Globes Decision</h4><p>当有多个<code>能量球</code>时(<code>能量球</code>还有可能凭空消失),每个<code>车</code>都要独立的选择其中一个作为他所在球形模型的球心,而且这个过程时动态的。</p><p>我们分两种情况去讨论这个问题:</p><h5 id="1-车发现了两个以上能量球"><a class="header-anchor" href="#1-车发现了两个以上能量球">¶</a>1. <code>车</code>发现了两个以上<code>能量球</code></h5><p>这种情况比较简单,我们只需要从中选择最近的哪一个即可。距离公式如下:</p><pre><code class="language-ada">distance := EG.Position + (Clock - EG_Find_Time) * EG.Velocity - Vehicle_Position</code></pre><h5 id="2-车从别的车获得的信息中有新的能量球"><a class="header-anchor" href="#2-车从别的车获得的信息中有新的能量球">¶</a>2. <code>车</code>从别的<code>车</code>获得的信息中有新的<code>能量球</code></h5><p>这种情况实际上是非常复杂的,因为存在一种情况:两个<code>车</code>说的时同一个<code>能量球</code>,但是不是同时发现的,很难判断是否是同一个<code>能量球</code>。</p><p>我们可以使用时间戳来判断获得更新的<code>能量球</code>。但是这个更新不能以时间戳作为唯一判据,因为存在一种情况,<code>车A</code>知道一个旧的<code>能量球</code>,但是发现的时间已经过去很久了,<code>车B</code>发现一个新的<code>能量球</code>,从远处靠近<code>车A</code>,时,两车交换信息,该如何选择呢?</p><p>所以,我又加入了一个失效时间,来解决上述问题。</p><pre><code class="language-ada">Clock - Vehicle_Message.EG_Update_Time &gt; Vehicle_Message_Expire_Time</code></pre><p>当上述条件为真时,<code>车</code>才会选择更新的信息。</p><h4 id="使用旋转优化Optimization-With-Rotation"><a class="header-anchor" href="#使用旋转优化Optimization-With-Rotation">¶</a>使用旋转优化Optimization With Rotation</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E6%97%8B%E8%BD%AC%E5%8D%8A%E5%BE%84-1599486504.png" alt="旋转半径"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E6%97%8B%E8%BD%AC%E8%BD%B4-1599486505.png" alt="旋转轴"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/2D%E6%97%8B%E8%BD%AC%E5%8D%8A%E5%BE%84-1599486506.png" alt="2D旋转半径"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/3D%E6%97%8B%E8%BD%AC-1599486507.png" alt="3D旋转"></p><p>相对于静态的在球面等待,动态的在球面旋转在实验中取得了更稳定的表现。</p><blockquote><p><strong>注意</strong><br>这个优化措施可能无效,我的同学们对这个优化反应褒贬不一,但是我觉得确实让这个模型更好看啦😄</p></blockquote><p>旋转半径向量与旋转轴垂直:</p><p>$$<br>X_rX_a+Y_rY_a+Z_rZ_a=0<br>$$</p><p>易得无数个解,但是为了尽量让两个<code>车</code>不会面对面相撞(随机赋值的话),这里手动赋值$X_a$和$Y_a$为$1$,求得唯一解。</p><h4 id="自动半径适应Automatic-Radius-Adaptation"><a class="header-anchor" href="#自动半径适应Automatic-Radius-Adaptation">¶</a>自动半径适应Automatic Radius Adaptation</h4><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E9%80%9A%E8%AE%AF%E7%8E%AF-1599486507.png" alt="通讯环"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E9%80%9A%E8%AE%AF%E7%8E%AF%E5%86%85-1599486508.png" alt="通讯环内"></p><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E9%80%9A%E8%AE%AF%E7%8E%AF%E5%A4%96-1599486509.png" alt="通讯环外"></p><p>我们在 Stage A&amp;B 中的半径是手动设置的,但是在 Stage C 中,每个球星模型的<code>车</code>的数量是动态的,如果半径不跟随数量变化,那么就有可能丢失通讯。</p><p>在理想的球星模型中,我们可以发现一个通讯环,在通讯环中的所有<code>车</code>都是互联的,并且中心的<code>能量球</code>很难突破这层环。在<code>车</code>进出通讯环时,我们可以通过当时的位置,动态修正半径大小。</p><p>我们分三种情况讨论该模型:</p><ol><li>半径过大,此时会有更多的<code>车</code>进到通讯环以内,从而使得半径变小。</li><li>半径国小,此时会有更多的<code>车</code>进到通讯环以外,从而使得半径变大。</li><li>半径正好,进到通讯环以内的<code>车</code>和进到通讯环以外的<code>车</code>大致是相同的,所以半径会稳定在某一个数值。</li></ol><p>在自动修正半径时,我们需要一个学习率参数<code>Track_Correction_Rate</code>,来确保不会因为充能量的不确定性而使得半径不稳定。</p><p>要实现该模型,我们还需要存在一个弹出通讯环的效果,即<code>车</code>在<code>能量球</code>加完能量后,弹出到通讯环外。实现如下,</p><pre><code class="language-ada">Actual_Radius_Vector := 1.5 * Rotated_Radius_Vector;</code></pre><h3 id="Stage-D"><a class="header-anchor" href="#Stage-D">¶</a>Stage D</h3><p>最后一个阶段,要求<code>车</code>之间随机协商出一定数量的<code>车</code>存活,剩下的自主“死亡“,比如一开始是 64 个,最终要求剩下 42 个。</p><p>这个问题最简单的解决方案是直接从 1 开始分配编号,按照编号顺序“死亡”就好啦,但是我觉得这个方案无法体现<code>随机</code>。</p><p>通过分析,这个类似于现在大火的<code>区块链</code>中最重要的一个问题,即分布式节点如何达成共识,解决方案也是一样的:共识算法。</p><p>推荐观看<a href="https://www.bilibili.com/video/av78588312?from=search&amp;seid=1453987515383608625" target="_blank" rel="noopener">李永乐老师:拜占庭将军问题是什么?区块链如何防范恶意节点?</a></p><h4 id="共识算法-Consensus-Algorithm"><a class="header-anchor" href="#共识算法-Consensus-Algorithm">¶</a>共识算法(Consensus Algorithm)<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup></h4><p>在这里我们仅利用共识算法的思想(不解决恶意节点问题),利用时间戳达成共识。</p><p>在<code>车</code>与<code>车</code>的通讯过程中,我们约定以下原则:</p><ol><li>在消息中添加三个字段:<code>Vehicle_No</code>数组,<code>Target_No_of_Elements</code>数组长度和<code>Vehicle_List_Update_Time</code>上一次更新时间。</li><li>所有的<code>车</code>一直都能接受和发送信息。</li><li>在最开始,所有的<code>车</code>都把自己的编号放到数组的第一个位置。</li><li>如果<code>车</code>接收到的信息与自身存储的信息不同(数组长度不同,或者上一次更新时间不同),那么按照下面的规则确定保留哪个<br>保留数组更长的那个<br>选择上一次更新时间更早的那个</li><li>检查自己的编号是否在<code>Vehicle_No</code>数组中,若不在并且仍有空间,那么就把自己的编号加进去。</li><li>在上一次更新时间又<code>Confirm_Time_Interval</code>秒后,如果数组已满并且自己的编号不在里面,那么该<code>车</code>就不能再去加能量了。</li></ol><p>经过实验,在 64 个<code>车</code>,缩减到 42 个的情况下,<code>Confirm_Time_Interval</code>设置为 1 秒就可以满足要求。</p><h2 id="结果"><a class="header-anchor" href="#结果">¶</a>结果<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup></h2><h3 id="截图"><a class="header-anchor" href="#截图">¶</a>截图</h3><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/%E6%88%AA%E5%9B%BE-1599486510.png" alt="截图"></p><h3 id="Stage-A-B-Single-Globe-In-Orbit"><a class="header-anchor" href="#Stage-A-B-Single-Globe-In-Orbit">¶</a>Stage A&amp;B(<code>Single_Globe_In_Orbit</code>)</h3><table><thead><tr><th style="text-align:center">Initial Number</th><th style="text-align:center">Target Number</th><th style="text-align:center">Duration</th><th style="text-align:center">Test times</th><th style="text-align:center">Average Result</th><th style="text-align:center">Survival Rate</th><th style="text-align:center">Average Frame Rate</th></tr></thead><tbody><tr><td style="text-align:center">32</td><td style="text-align:center">32</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">31.8</td><td style="text-align:center">0.99375</td><td style="text-align:center">30 Hz</td></tr><tr><td style="text-align:center">64</td><td style="text-align:center">64</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">63.4</td><td style="text-align:center">0.990625</td><td style="text-align:center">28 Hz</td></tr><tr><td style="text-align:center">128</td><td style="text-align:center">128</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">126.8</td><td style="text-align:center">0.990625</td><td style="text-align:center">20 Hz</td></tr><tr><td style="text-align:center">256</td><td style="text-align:center">256</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">233</td><td style="text-align:center">0.910156</td><td style="text-align:center">9 Hz</td></tr></tbody></table><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/stageAB-1599486511.png" alt="Stage A&amp;B"></p><h3 id="Stage-C-Random-Globes-In-Orbits"><a class="header-anchor" href="#Stage-C-Random-Globes-In-Orbits">¶</a>Stage C(<code>Random_Globes_In_Orbits</code>)</h3><table><thead><tr><th style="text-align:center">Initial Number</th><th style="text-align:center">Target Number</th><th style="text-align:center">Duration</th><th style="text-align:center">Test times</th><th style="text-align:center">Average Result</th><th style="text-align:center">Survival Rate</th><th style="text-align:center">Average Frame Rate</th></tr></thead><tbody><tr><td style="text-align:center">32</td><td style="text-align:center">32</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">26.8</td><td style="text-align:center">0.8375</td><td style="text-align:center">30 Hz</td></tr><tr><td style="text-align:center">64</td><td style="text-align:center">64</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">60.2</td><td style="text-align:center">0.940625</td><td style="text-align:center">28 Hz</td></tr><tr><td style="text-align:center">128</td><td style="text-align:center">128</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">109.2</td><td style="text-align:center">0.853125</td><td style="text-align:center">20 Hz</td></tr><tr><td style="text-align:center">256</td><td style="text-align:center">256</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">208.2</td><td style="text-align:center">0.813281</td><td style="text-align:center">9 Hz</td></tr></tbody></table><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/stageC-1599486512.png" alt="Stage C"></p><h3 id="Stage-D-Random-Globes-In-Orbits"><a class="header-anchor" href="#Stage-D-Random-Globes-In-Orbits">¶</a>Stage D(<code>Random_Globes_In_Orbits</code>)</h3><table><thead><tr><th style="text-align:center">Initial Number</th><th style="text-align:center">Target Number</th><th style="text-align:center">Duration</th><th style="text-align:center">Test times</th><th style="text-align:center">Average Result</th><th style="text-align:center">Survival Rate</th><th style="text-align:center">Average Frame Rate</th></tr></thead><tbody><tr><td style="text-align:center">32</td><td style="text-align:center">42</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">24</td><td style="text-align:center">0.571429</td><td style="text-align:center">30 Hz</td></tr><tr><td style="text-align:center">64</td><td style="text-align:center">42</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">37.4</td><td style="text-align:center">0.890476</td><td style="text-align:center">28 Hz</td></tr><tr><td style="text-align:center">128</td><td style="text-align:center">100</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">83.4</td><td style="text-align:center">0.834</td><td style="text-align:center">20 Hz</td></tr><tr><td style="text-align:center">256</td><td style="text-align:center">150</td><td style="text-align:center">5 min</td><td style="text-align:center">5</td><td style="text-align:center">133</td><td style="text-align:center">0.886667</td><td style="text-align:center">9 Hz</td></tr></tbody></table><p><img src="https://davidz-blog.oss-cn-beijing.aliyuncs.com/img/stageD-1599486513.png" alt="Stage D"></p><h2 id="感谢"><a class="header-anchor" href="#感谢">¶</a>感谢</h2><p>感谢所有在作业中帮助过我的同学,辅导员和老师❤️。</p><hr class="footnotes-sep"><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p>共识算法:<a href="https://en.wikipedia.org/wiki/Consensus_decision-making" target="_blank" rel="noopener">https://en.wikipedia.org/wiki/Consensus_decision-making</a> <a href="#fnref1" class="footnote-backref">↩︎</a></p></li><li id="fn2" class="footnote-item"><p>测试平台: 笔记本 Intel I7 处理器 @ 3.43GHz16GB 内存。因为我是用 Python 编写测试脚本,通过识别当前程序线程数量来判断<code>车</code>的数量的,所以测试结果可能不准确。 <a href="#fnref2" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
<categories>
<category> Study </category>
</categories>
<tags>
<tag> Ada </tag>
<tag> ANU </tag>
</tags>
</entry>
<entry>
<title>Hello World</title>
<link href="/hello-world/"/>
<url>/hello-world/</url>
<content type="html"><![CDATA[<blockquote><p>原创发表于 <a href="https://blog.davidz.cn">DavidZ Blog</a>,遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target="_blank" rel="noopener">CC 4.0 BY-NC-SA</a> 版权协议,转载请附上原文出处链接及本声明。</p></blockquote><p>哈哈哈,这是一个经典的测试页面。</p><p>一直以来都想拥有一个自己的博客,从<a href="https://wordpress.org/" target="_blank" rel="noopener">WordPress</a>开始,到<a href="http://typecho.org/" target="_blank" rel="noopener">Typecho</a>,再到<a href="https://halo.run/" target="_blank" rel="noopener">Halo</a>,甚至中途尝试用 Django 自己实现了一个(不过样子也太丑了),虽然说一直在捣鼓博客,但是从来都是安装=&gt;部署=&gt;安装插件=&gt;选择主题=&gt;发布第一篇文章,然后就没有然后了。</p><p>今天我突然看到<a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>的<a href="https://github.com/TriDiamond/hexo-theme-obsidian" target="_blank" rel="noopener">Obsidian</a>主题,我觉得时机到了,毕竟颜值是第一生产力。</p><p>给自己列一个简单的 TODO LIST 吧。</p><ul class="contains-task-list"><li class="task-list-item"><input class="task-list-item-checkbox" checked="" disabled="" type="checkbox"> 完善 BLOG</li><li class="task-list-item"><input class="task-list-item-checkbox" checked="" disabled="" type="checkbox"> COMP2310 作业整理</li><li class="task-list-item"><input class="task-list-item-checkbox" checked="" disabled="" type="checkbox"> 浪潮实习</li><li class="task-list-item"><input class="task-list-item-checkbox" checked="" disabled="" type="checkbox"> 终端与 WSL</li></ul><p>希望这个寒假能做完这些吧。</p><p>就这样。</p>]]></content>
<categories>
<category> Personal </category>
</categories>
<tags>
<tag> Others </tag>
</tags>
</entry>
</search>