<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>地球生活的杨同学</title>
        <link>https://earthyang.com/</link>
        <description>Less is better, less is more. Reading, thinking, writing.</description>
        <lastBuildDate>Mon, 19 Oct 2026 02:17:58 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2026, Yinqi Yang</copyright>
        <item>
            <title><![CDATA[Mac的caffeinate命令防止系统进入休眠]]></title>
            <link>https://earthyang.com/article/mac-caffeinate</link>
            <guid>https://earthyang.com/article/mac-caffeinate</guid>
            <pubDate>Thu, 04 Dec 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Mac的caffeinate命令防止系统进入休眠，保持后台程序一直运行]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2bf94b203a2c80e5958fd60119bd3303"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-2bf94b203a2c80478f85d4dc690a9be6"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text"><div class="notion-text notion-block-2bf94b203a2c8095b9edef0e1a3c6637">“caffeinate”这个词的字面意思是“喝咖啡”<b>或</b>“摄入咖啡因”<b>，引申为</b>“提神”<b>、</b>“保持清醒”<b>、</b>“防止进入休眠状态”的意思。</div><div class="notion-text notion-block-2bf94b203a2c80aca099d9db8f4c9ca4">在 Mac 电脑的操作系统 (macOS) 中，<code class="notion-inline-code">caffeinate</code> 是一个非常实用的<b>命令行工具</b>，它的作用就是<b>防止系统进入睡眠、显示器休眠或执行自动调光</b>。</div></div></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2bf94b203a2c809fb517cb94e4cb8eb4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3Ac6565149-fc50-49aa-83dc-703792862c1c%3AGemini_Generated_Image_mb7yydmb7yydmb7y-%E8%BD%AC%E6%8D%A2%E8%87%AA-png.webp?table=block&amp;id=2bf94b20-3a2c-809f-b517-cb94e4cb8eb4&amp;t=2bf94b20-3a2c-809f-b517-cb94e4cb8eb4" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-2bf94b203a2c8026a19ec6459a2ea497" data-id="2bf94b203a2c8026a19ec6459a2ea497"><span><div id="2bf94b203a2c8026a19ec6459a2ea497" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2bf94b203a2c8026a19ec6459a2ea497" title="☕最推荐的用法，简单粗暴，全面防睡（直到你叫停）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">☕最推荐的用法，简单粗暴，全面防睡（直到你叫停）</span></span></h3><div class="notion-text notion-block-2bf94b203a2c80efb747d8cab2ac8ee5">这是最简单的用法。它会阻止系统睡眠、显示器睡眠和磁盘睡眠。</div><div class="notion-text notion-block-2bf94b203a2c80fbb6d3f632e6d6766b"><b>如何停止？</b> 当你的任务完成后，在终端窗口中按下 Control+C，<code class="notion-inline-code">caffeinate</code> 就会停止运行，电脑恢复自动睡眠功能。</div><div class="notion-blank notion-block-2bf94b203a2c80d09e3dcd9ec7f65ad8"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-2bf94b203a2c808bb9b0f949d5a19a72" data-id="2bf94b203a2c808bb9b0f949d5a19a72"><span><div id="2bf94b203a2c808bb9b0f949d5a19a72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2bf94b203a2c808bb9b0f949d5a19a72" title="介绍caffeinate：它到底是什么？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">介绍<code class="notion-inline-code">caffeinate</code>：它到底是什么？</span></span></h3><div class="notion-text notion-block-2bf94b203a2c80558fd0f558e2ed316a">最近有一个任务，需要下载视频流数据，非常大，需要mac电脑保持不断网不关机一直在后台运行，虽然可以在设置中打开电池和设置屏幕常亮时间，但是每次遇到这种问题去设置很麻烦。</div><div class="notion-blank notion-block-2bf94b203a2c80b8910aef1c7b520565"> </div><div class="notion-text notion-block-2bf94b203a2c8015907dda40ddd797c4">我想在Google上面通过关键词查找有没有相关的软件或命令，可以保持mac的进程一直在后面运行。结果真被我找到了神奇的<code class="notion-inline-code">caffeinate</code> 命令（喝咖啡）。</div><div class="notion-text notion-block-2bf94b203a2c80f1be88e11ace8f57a3">Mac的<code class="notion-inline-code">caffeinate</code> 命令，可以模拟用户活动来<b>告诉 macOS 系统保持“清醒”状态</b>，就像人喝了咖啡一样保持活跃。在 macOS 中，它是一个内置在终端（Terminal）里的命令行工具。</div><div class="notion-text notion-block-2bf94b203a2c80fab701c28a6ba80b49">简单来说，只要 <code class="notion-inline-code">caffeinate</code> 在运行，你的 Mac 就会对系统说：“<b>我醒着呢！别睡！</b>”</div><div class="notion-blank notion-block-2bf94b203a2c8038835ce6fcf123fda4"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-2bf94b203a2c80a0bfd8d054d32637dd" data-id="2bf94b203a2c80a0bfd8d054d32637dd"><span><div id="2bf94b203a2c80a0bfd8d054d32637dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2bf94b203a2c80a0bfd8d054d32637dd" title="常用选项"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">常用选项</span></span></h3><table class="notion-simple-table notion-block-2bf94b203a2c80aa8d04db853cdaafc2"><tbody><tr class="notion-simple-table-row notion-block-2bf94b203a2c8078a071f27ee1022c2c"><td class="" style="width:120px"><div class="notion-simple-table-cell">选项</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">作用</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell">示例</div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c801e8194ecc62c4afadd"><td class="" style="width:120px"><div class="notion-simple-table-cell">无选项</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">保持清醒直到你按下 Control + C 停止命令。默认阻止系统睡眠、显示器睡眠和磁盘睡眠。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c807d83e6cdd3674498e8"><td class="" style="width:120px"><div class="notion-simple-table-cell">-i</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">阻止系统空闲休眠 (Idle Sleep)。模拟用户输入。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -i</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c803a8d0bc245d245245f"><td class="" style="width:120px"><div class="notion-simple-table-cell">-m</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">阻止磁盘休眠 (Disk Sleep)。在读写操作时非常有用。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -m</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c8049bedafeca908bdad5"><td class="" style="width:120px"><div class="notion-simple-table-cell">-d</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">阻止显示器休眠 (Display Sleep)。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -d</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c80308a92d6b46af425b0"><td class="" style="width:120px"><div class="notion-simple-table-cell">-u</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">模拟用户活动，允许系统进入睡眠（默认不阻止），但阻止显示器在空闲时变暗或关闭。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -u</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c801384ede13d554e961b"><td class="" style="width:120px"><div class="notion-simple-table-cell">-t &lt;seconds&gt;</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">定时运行。指定一个持续时间（秒），时间到了命令自动停止。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -t 3600 (运行 1 小时)</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c808ba1aad49afd649369"><td class="" style="width:120px"><div class="notion-simple-table-cell">-w &lt;pid&gt;</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">跟随进程。保持清醒直到指定的进程 ID (PID) 结束。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate -w 12345</code></div></td></tr><tr class="notion-simple-table-row notion-block-2bf94b203a2c809dba85ea8fc1ffe69e"><td class="" style="width:120px"><div class="notion-simple-table-cell">&lt;command&gt;</div></td><td class="" style="width:267px"><div class="notion-simple-table-cell">运行指定命令。保持清醒直到 &lt;command&gt; 运行结束。</div></td><td class="" style="width:286px"><div class="notion-simple-table-cell"><code class="notion-inline-code">caffeinate ./big_script.sh</code></div></td></tr></tbody></table><div class="notion-blank notion-block-2bf94b203a2c80a08beffc1a5b1436fd"> </div><div class="notion-blank notion-block-2bf94b203a2c80cd9e8bdec818ab1427"> </div><div class="notion-blank notion-block-2bf94b203a2c8020a2f7c2f1b77eeec3"> </div><div class="notion-blank notion-block-2bf94b203a2c80d08b59fa03c459e024"> </div><div class="notion-blank notion-block-2bf94b203a2c80559c08d7f4086de011"> </div><div class="notion-blank notion-block-2bf94b203a2c8003b3ded34f8c8df697"> </div><div class="notion-blank notion-block-2bf94b203a2c80bf80c9fe749b9fb7bc"> </div><div class="notion-blank notion-block-2bf94b203a2c80399806ff7c794414f7"> </div><div class="notion-blank notion-block-2bf94b203a2c807582eae261d9f1d23a"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[vim快捷键-LINUX]]></title>
            <link>https://earthyang.com/article/vim-shortcut</link>
            <guid>https://earthyang.com/article/vim-shortcut</guid>
            <pubDate>Wed, 06 Sep 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[vim快捷键]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-7ce3b06b1c1841f8b2a349d783308638"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-998d1e739eee4592b2e7a94d4f7d2c6c"><b>Vim 常用模式</b></div><ul class="notion-list notion-list-disc notion-block-e3cef0ac011643b2871970878e439e18"><li>交互模式</li></ul><ul class="notion-list notion-list-disc notion-block-319a127782a541bd9dda4b166aeae7c0"><li>插入模式</li></ul><ul class="notion-list notion-list-disc notion-block-4c28f49d8f654a4ea1161d405067ca30"><li>命令模式</li></ul><ul class="notion-list notion-list-disc notion-block-ce63f192ddd74e9c8eb833810e13240d"><li>可视模式</li></ul><div class="notion-text notion-block-53c3b9d1e6f94ea3abc0506541818630">图片中有三种模式如何切换。交互模式-插入模式-命令模式</div><div class="notion-text notion-block-a7d9710df1c4432aa0d084571c98eb74"><b>交互模式</b>：也称为正常模式，这是 Vim 的默认模式，每次运行 Vim 程序的时候，就会进入这个模式。</div><div class="notion-text notion-block-b88bfc009ed14594993a36d1d99daafd">交互模式特征：</div><ul class="notion-list notion-list-disc notion-block-59f1f0556d4e4e94af368b505df9dcc1"><li>在这个模式下，你不能输入文本；</li></ul><ul class="notion-list notion-list-disc notion-block-723ceb3eaeb247078e4a1fe5b581b85f"><li>它可以让我们在文本间移动，删除一行文本，复制黏贴文本，跳转到指定行，撤销操作，等等</li></ul><div class="notion-text notion-block-35eb7962df0a4c78b204fdbca8298cbe"><b>插入模式</b>：这个模式是我们熟悉的文本编辑器的模式，就是可以输入任何你想输入的内容。进入这个模式有几种方法，最常用的方法是按字母键 i （ i、I、a、A、o、O 都可以进入插入模式，只是所处的位置不同），退出这种模式，只需要按下 Esc 键。</div><ul class="notion-list notion-list-disc notion-block-7db512f259544e25b122394c6d67ca23"><li>i, I 进入输入模式 Insert mode ：i 为“从目前光标所在处输入”， I 为“在目前所在行的第一个非空格符处开始输入”；</li></ul><ul class="notion-list notion-list-disc notion-block-68b9419901744b7e9d62de101bf5ab1d"><li>a, A 进入输入模式 Insert mode ：a 为“从目前光标所在的下一个字符处开始输入”，A 为“从光标所在行的最后一个字符处开始输入”；</li></ul><ul class="notion-list notion-list-disc notion-block-4ddeaff7f2ee49468ad502b28380c955"><li>o, O 进入输入模式 Insert mode ：o 为“在目前光标所在的下一行处输入新的一行”；O 为在目前光标所在处的上一行输入新的一行。</li></ul><div class="notion-text notion-block-14da143f65fa41ada543540a003f47fb"><b>命令模式</b>：命令模式也称为底线命令模式，这个模式下可以运行一些命令例如“退出”，“保存”，等动作。冒号后的输入都属于命令模式。比如：wq，q。</div><ul class="notion-list notion-list-disc notion-block-403d32e33c8b460bbdff755013bb58d6"><li>-----------------------------------------------------------------------------------</li></ul><div class="notion-text notion-block-f8e46b0b311649d29bd7681bd968c3bf"><b>基本操作</b></div><div class="notion-text notion-block-2e6cef31c6c6465d8173ebbc0ef1d0fb"><b>打开 Vim</b></div><div class="notion-text notion-block-58fd6f13c3e14715a21ed78ad2a4df09">在终端命令行中输入 vim 回车后 Vim 就会被运行起来，也可以用 Vim 来打开一个文件，只需要在 vim 后面再加文件名。如 vim file.name ，如果文件不存在，那么会被创建。</div><div class="notion-text notion-block-b68b6cbd21eb455e91033203bd1c86e4"><b>插入</b></div><div class="notion-text notion-block-8a953f9e8a864eb2a393d3bb039dd1e3">进入文件之后，此时处于交互模式，可以通过输入 i 进入插入模式。</div><div class="notion-text notion-block-58fba493c4a743f8ad703fbd0a310fb0"><b>移动</b></div><div class="notion-text notion-block-26916743b3444117b8cf1502088b9e31">在 Vim 的交互模式下，我们可以在文本中移动光标。</div><ul class="notion-list notion-list-disc notion-block-fe0979f2707e4f9988116cb7f90a523b"><li>h 向左移动一个字符</li></ul><ul class="notion-list notion-list-disc notion-block-e92013a4753949e0abd4f9d1595e5e17"><li>j 向下移动一个字符</li></ul><ul class="notion-list notion-list-disc notion-block-5d37423a963849bfa3f59201f4598582"><li>k 向上移动一个字符</li></ul><ul class="notion-list notion-list-disc notion-block-2c46ff465d9044fea7c17e13cffcea1d"><li>i 向右移动一个字符</li></ul><div class="notion-text notion-block-7bcb2889d0524b5783db8f3e21c33e3c">当然也可以使用四个方向键进行移动，效果是一样的。</div><div class="notion-text notion-block-6ce151bd5ab54467887cfac03aecb329"><b>跳至行首和行末</b></div><ul class="notion-list notion-list-disc notion-block-eed5f5e73257483783080c711af10284"><li>行首：在交互模式下，为了将光标定位到一行的开始位置，只需要按下数字键 0 即可，键盘上的 Home 键也有相同效果。</li></ul><ul class="notion-list notion-list-disc notion-block-06a4634fdde840eda45af99f251fae22"><li>行末：在交互模式下，为了将光标定位到一行的末尾，只需要按下美元符号键 $ 即可，键盘上的 End 键也有相同效果。</li></ul><div class="notion-text notion-block-f135a4322253415aa37dadaeba263833"><b>按单词移动</b></div><div class="notion-text notion-block-142b286bb9bd4fc2be43dcd28a6e2424">在交互模式下，按字母键 w 可以一个单词一个单词的移动。</div><div class="notion-text notion-block-750bdebb59d646c1aa939a19d6052b44"><b>退出文件</b></div><div class="notion-text notion-block-0f3d03478bd54da68f7cdecfd7473da5">在交互模式下，按下冒号键 : 进入命令模式，再按下 q 键，就可以退出了。</div><div class="notion-text notion-block-333897b1942441ee86f0dc419e4abb6c">如果在退出之前又修改了文件，就直接想用 :q 退出 Vim ，那么 Vim 会显示一个红字标明错误信息。此时我们有两个选择：</div><ol start="1" class="notion-list notion-list-numbered notion-block-72ad15aaea4e4a3a897555312a91d5fb" style="list-style-type:decimal"><li>保存并退出 :wq 或 :x ；</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-f6561a15c6004042823c16383f98780b" style="list-style-type:decimal"><li>不保存且退出 :q! 。</li></ol><div class="notion-text notion-block-90ba0d4f22f44d669100fcd86740fdb0"><b>标准操作</b></div><div class="notion-text notion-block-a8e5e560572c4f23b0a25c6c7b27ade3"><b>删除字符</b></div><div class="notion-text notion-block-c88e36156f4744db9c3a235bfda318b8">在交互模式下，将光标定位到一个你想要删除的字符上，按下字母键 x 你会发现这个字符被删除了。</div><div class="notion-text notion-block-4410c5f36e2c4d978e2d368706b8080e">也可以一次性删除多个字符，只需要在按 x 键之前输入数字即可。</div><div class="notion-text notion-block-0ef5948e6a524546a7f7957551818c3a"><b>删除（剪切）单词，行</b></div><ul class="notion-list notion-list-disc notion-block-9f14b4f9618d44bd95000d43a01437f3"><li>删除一行：连按两次 d 来删除光标所在的那一行。</li></ul><ul class="notion-list notion-list-disc notion-block-0d4831430aed45cc8a9eed6c034ed585"><li>删除多行：例如先输入数字 2 ，再按下 dd ，就会删除从光标所在行开始的两行。</li></ul><ul class="notion-list notion-list-disc notion-block-dee906a9e31a4e68b79e6e191fb8a416"><li>删除一个单词：将光标置于一个单词的首字母处，然后按下 dw 。</li></ul><ul class="notion-list notion-list-disc notion-block-5eac2ca94025499fa72ef504e7c1b497"><li>删除多个单词：例如先按数字键 2 再按 dw 就可以删除两个单词了。</li></ul><ul class="notion-list notion-list-disc notion-block-997f6a6f4122433da6fecc5e03614031"><li>从光标所在位置删除至行首：d0 。</li></ul><ul class="notion-list notion-list-disc notion-block-45a176768bdc4d13b90a96dc2b9a726a"><li>从光标所在位置删除至行末：d$ 。</li></ul><div class="notion-text notion-block-9d5bda35954c4bffaced214543e92043"><b>复制单词，行</b></div><ul class="notion-list notion-list-disc notion-block-f489c540f279456691e1eab185d342e6"><li>复制行：按两次 y 会把光标所在行复制到内存中，和 dd 类似， dd用于“剪切”光标所在行。</li></ul><ul class="notion-list notion-list-disc notion-block-0cbf5303b8ba4c4ca10c23f1969b8590"><li>复制多行：将光标移动到将要复制的首行处，按“nyy”复制n行；其中n为1、2、3……</li></ul><ul class="notion-list notion-list-disc notion-block-331c96a1ce7e4503bce348eb2a7182e7"><li>复制单词：yw 会复制一个单词。</li></ul><ul class="notion-list notion-list-disc notion-block-c100d364c94843e7ad681977495bff8c"><li>复制到行末：y$ 是复制从光标所在处到行末的所有字符。</li></ul><ul class="notion-list notion-list-disc notion-block-c4e2856ef18147b8ab3cf54725ecef9b"><li>复制到行首：y0 是复制光标所在处到行首的所有字符。</li></ul><div class="notion-text notion-block-48ef00cf19384c97bf9c93afbfaee602"><b>粘贴</b></div><div class="notion-text notion-block-9d0fcc2c0be9487d81b6e43216f83618">如果之前用 dd 或者 yy 剪切复制过来的，可以使用 p 来粘贴。同样也可以使用 数字+p来表示复制多次。</div><div class="notion-text notion-block-cea5088d5c7347a7bfd3680ffe50ee86"><b>替换一个字符</b></div><div class="notion-text notion-block-6d8f0c42a7e547f2884d86706921f6ce">在交互模式下，将光标置于想要替换的字符上。按下 r 键，接着输入你要替换的字符即可。</div><div class="notion-text notion-block-b87633cc2db248f1b2927e9f44d6c0fb"><b>撤销操作</b></div><div class="notion-text notion-block-374301d2d63a4fc59fc0f9099ce3a029">如果要撤销最近的修改，只需要按下 u 键，如果想要撤销最近四次修改，可以按下4，再按下 u 。</div><div class="notion-text notion-block-4943641770c34d93a14b1e67ec31d7c8"><b>重做</b></div><div class="notion-text notion-block-d505d9d0a9d04427b78f023e084cf01e">取消撤销，也就是重做之前的修改使用 ctrl + r 。</div><div class="notion-text notion-block-49b490c5b7f2429dabd71d83fbc70cac"><b>跳转到指定行</b></div><div class="notion-text notion-block-b8be42f7418b46939a7646c90b5b2ff7">Vim 编辑的文件中，每一行都有一个行号，行号从1开始，逐一递增。</div><div class="notion-text notion-block-5f38524f933d40e39d84b127007ce62b">行号默认是不显示，如果需要它显示的话，可以进入命令模式，然后输入 set nu ，如果要隐藏行号的话，使用 set nonu 。</div><ul class="notion-list notion-list-disc notion-block-83f73cd1dc3a49d7a66629b562efefea"><li>跳转到指定行：数字+gg ，例如 7gg ，表示跳转到第7行。</li></ul><ul class="notion-list notion-list-disc notion-block-2c54322e6a224532bec2579158e77660"><li>要跳转到最后一行，按下 G 。</li></ul><ul class="notion-list notion-list-disc notion-block-22b7b27e348a413caf23c6e5056431ba"><li>要跳转到第一行，按下 gg</li></ul><ul class="notion-list notion-list-disc notion-block-f3302cde3ab74b73b8f745c95aaba9da"><li>--------------------------------------------------------------------------------------</li></ul><div class="notion-text notion-block-f07249c92420467797aed4e32e8a539d"><b>高级操作</b></div><div class="notion-text notion-block-e801da0d07e6448b91e225a66e66a56a"><b>查找</b></div><div class="notion-text notion-block-f655fa65d9c3432fba9763449851397e">处于交互模式下，按下 / 键，那么就进入查找模式，输入你要查找的字符串，然后按下回车。光标就会跳转到文件中下一个查找到的匹配处。如果字符串不存在，那么会显示 &quot;pattern not found&quot; 。</div><ul class="notion-list notion-list-disc notion-block-3e5e60548f724c0683f411db13a28899"><li>n 跳转到下一个匹配项；</li></ul><ul class="notion-list notion-list-disc notion-block-cb31634a96bd48e4b2d06c030bf2505e"><li>N 跳转到上一个匹配项。</li></ul><div class="notion-text notion-block-5d8fca44fb144163874ea4a6c4671a5d">[注意] 用斜杠来进行的查找是从当前光标处开始向文件尾搜索，如果你要从当前光标处开始，向文件头搜索则使用 ? ，当然也可以先按下 gg 跳转到第一行在进行全文搜索。</div><div class="notion-text notion-block-9be2b03583fa4ab1b460a7b08694f174"><b>查找并替换</b></div><div class="notion-text notion-block-7c69a9c5afac4870a5b357dc3b0b251b">替换光标所在行第一个匹配的字符串：s/旧字符串/新字符串 实例:s/one/two</div><div class="notion-text notion-block-ad9f91efbb88406d86dc293b4ddc7ac7">替换光标所在行所有旧字符串为新字符串：s/旧字符串/新字符串/g</div><div class="notion-text notion-block-fd3407f8b90d44b481ae4279da8d9841">替换第几行到第几行中所有字符串：n,m s/旧字符串/新字符串/g 实例:2,4 s/one/two/g</div><div class="notion-text notion-block-e4ed654a69564374ae01c2acb70410b2">全文替换：%s/旧字符串/新字符串/g</div><div class="notion-text notion-block-927108c5653c4719b0791e05310de015"><b>合并文件</b></div><div class="notion-text notion-block-ce0e3f68c7c9404e823219e21712af81">可以用冒号 +r ( :r ) 实现在光标处插入一个文件的内容。</div><div class="notion-text notion-block-bfa1a8b6f5b9475a8166b3c789bf7235">:r filename 可以用Tab键来自动补全另外一个文件的路径</div><div class="notion-text notion-block-7f214352313a429f97c0ec2b0682cf34"><b>分屏</b></div><div class="notion-text notion-block-b5b312af0b854688a79ea4dc22b45704">Vim 有一个特别便捷的功能那就是分屏，可以同时打开好几个文件，分屏之后，屏幕每一块被称为一个 viewport ，表示“视口”。</div><ul class="notion-list notion-list-disc notion-block-128b99a386a04db8a784005062f44161"><li>横向分屏 :sp 文件名</li></ul><ul class="notion-list notion-list-disc notion-block-08a8dbcd2102413e80b8eaddcd988f62"><li>垂直分屏 :vsp 文件名</li></ul><div class="notion-text notion-block-4f63bf4846a141c795770490cc1c2e0a"><b>分屏模式下的快捷键</b></div><ul class="notion-list notion-list-disc notion-block-8a07a458a6954cfdab3cedc2cc81d796"><li>Ctrl + w 再加 Ctrl + w ，表示从一个 viewport 移动光标到另外一个 viewport ；</li></ul><ul class="notion-list notion-list-disc notion-block-3a0e4060709b4ba2907f8848fc2b8880"><li>Ctrl + w 再加 “方向键”，就可以移动到这个方向所处的下一个视口了；</li></ul><ul class="notion-list notion-list-disc notion-block-badbff87705647a18587099e155fe1cc"><li>Ctrl + w 再加 + 号，表示扩大当前视口；</li></ul><ul class="notion-list notion-list-disc notion-block-e808132cc0614647bf98fe97fc37f825"><li>Ctrl + w 再加 - 号，表示缩小当前视口；</li></ul><ul class="notion-list notion-list-disc notion-block-801323f5f8f4415b83925c318c94137d"><li>Ctrl + w 再加 = 号，表示平均当前视口；</li></ul><ul class="notion-list notion-list-disc notion-block-718785687f254dc58c10c3df7b7c1526"><li>Ctrl + w 再加 r 键，会反向调换视口位置；</li></ul><ul class="notion-list notion-list-disc notion-block-c619846de8cf4d559cb079b6a9409f1c"><li>Ctrl + w 再加 q 键，会关闭当前视口；</li></ul><ul class="notion-list notion-list-disc notion-block-8f8613141f734affb2ccd62737d3dfd2"><li>Ctrl + w 再加 o 键，会关闭除当前视口以外的所有视口；</li></ul><div class="notion-text notion-block-a7a3ca8640414166b3c2efb03252cc2c"><b>运行外部命令 :!</b></div><div class="notion-text notion-block-2fc911134763491396a9871847b18f63">在 Vim 中可以运行一些终端命令，只要先输入 :! ，然后接命令名称。</div><div class="notion-text notion-block-5c09d441b27447c6b64a0c4683e1abfd">:!ls 在Vim中打开的文件所在的目录运行ls命令</div><div class="notion-text notion-block-415fbc701f6d4ba8a39cba28d24eb640"><b>可视模式</b></div><div class="notion-text notion-block-b7ce886496b04984aaa4720d26c87251">前面只讲了 Vim 的三种模式，其实还有一种模式叫做可视模式。</div><div class="notion-text notion-block-bd64123c3ec44e1db556bea553e5569d">进入它的三种方式（都是从交互模式开始）：</div><ul class="notion-list notion-list-disc notion-block-256cbb52c31741c291747429993692c8"><li>v 字符可视模式，进入后配合方向键选中字符后，然后再按 d 键可以删除选中。</li></ul><ul class="notion-list notion-list-disc notion-block-382993e13ce64fe2b110845a6e191703"><li>V 行可视模式，进入后光标所在行默认被选中，然后再按 d 键可以删除所在行。</li></ul><ul class="notion-list notion-list-disc notion-block-99c6a345dfe84550b2b51037bdf4eb8a"><li>Ctrl + v 块可视模式，它是可视模式最有用的功能了，配合 d 和 I 键可以实现删除选中的内容和插入内容</li></ul><div class="notion-text notion-block-806f210a3f9a4180a341f11374bc46c3">同时选中多行，并在选中行头部插入内容的具体操作步骤：</div><ol start="1" class="notion-list notion-list-numbered notion-block-f7c05964d158449fb628876c30ddd02b" style="list-style-type:decimal"><li>ctrl + v 进入块可视模式</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-31ca4dd87ef74082a80893c447895249" style="list-style-type:decimal"><li>使用方向键进行选中（上下左右）假设选中5行</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-769943f68a484f21be306ac0c63e9eca" style="list-style-type:decimal"><li>输入 I 键进行多行同时插入操作</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-1aea0d725e6042f782fee1c12f991f27" style="list-style-type:decimal"><li>插入完成后连续按两下 esc 键，实现多行同时插入相同字符</li></ol><div class="notion-text notion-block-fb0ebac6b806446aaa9db265b9c778dc">进入可视模式之后的操作键：</div><ul class="notion-list notion-list-disc notion-block-bcb71fbc527c4f7aaa7c3802a44a7aca"><li>d 键，表示删除选中；</li></ul><ul class="notion-list notion-list-disc notion-block-1cd2a241d53b41a69dc7f3adb6580ebd"><li>I 键，表示在选中之前插入；</li></ul><ul class="notion-list notion-list-disc notion-block-c558e14e41f04255b3fc38d458e7c8c7"><li>u 键，表示选中变为小写；</li></ul><ul class="notion-list notion-list-disc notion-block-9ee28f1d32bd4bab88b98bf28090ba28"><li>U 键，表示选中变为大写</li></ul><div class="notion-text notion-block-35c0742b6a0447f6ac20d213682f1ac7"><b>Vim 配置</b></div><div class="notion-text notion-block-39a968f2c96741049f6186236d930d8d"><b>选项参数</b></div><div class="notion-text notion-block-a78bb79d4f024506b95dcf8fe4efdadc">在 Vim 被启动后，可以运行一些指令来激活一些选项参数，但是这些选项参数的配置在退出Vim 时会被忘记，例如前面讲解的激活行号。如果希望所在的配置是永久性的，那么需要在家目录（ cd ~ ）创建一个 Vim 的配置文件 .vimrc。</div><div class="notion-text notion-block-7e4c448491e541e290cee30816160caa">在配置文件中可以进行常用修改如下：</div><div class="notion-text notion-block-ac386edcc3e84cdf82dfd35ada294e71">set number &quot; 显示行号syntax on &quot; 激活语法高亮set showcmd &quot; 实时看到输入的命令set ignorecase &quot; 搜索时不区分大小写set mouse=a &quot; 激活鼠标，用鼠标选中时相当于进入可视模式</div><div class="notion-text notion-block-0f9876db52c84f1aac54e4352b70ead6">Vim 配置非常丰富，我们可以通过个性化配置把 Vim 打造成属于自己的 IDE 等等。在 github 上也可以搜索到一些强大的 Vim 配置文件。</div><div class="notion-blank notion-block-27394b203a2c80d9addaf412975e94c8"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[从新开始运动]]></title>
            <link>https://earthyang.com/article/run</link>
            <guid>https://earthyang.com/article/run</guid>
            <pubDate>Tue, 17 Jun 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[在贵安新区第一次跑步]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-21594b203a2c802dbe4ffe0698f069d2"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-21594b203a2c8029aaf8e3ef1d9364a2">从离开学校过后，已经有一段时间没有跑步了，从今天开始，要慢慢给跑步的习惯捡起来🏃</div><div class="notion-blank notion-block-21594b203a2c807b95f2ff45e3102838"> </div><div class="notion-text notion-block-21594b203a2c80b49c27cea5bf7640c5">希望不是flag🐶。</div><div class="notion-blank notion-block-21594b203a2c80f5b3e8fe4db99dbbe1"> </div><div class="notion-text notion-block-21594b203a2c8065a15adb91e75492bf">这是2022年在学校的跑步记录，那时候还蛮厉害的呢🐶，哈哈。</div><div class="notion-row notion-block-21594b203a2c80d999b8d3f608374bcd"><div class="notion-column notion-block-21594b203a2c80fc9aeff1a6d163442e" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.5)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c80378215c424cf08c2ba"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A1df655e0-6326-4516-904f-ee9ea174c6df%3AIMG_1649.png?table=block&amp;id=21594b20-3a2c-8037-8215-c424cf08c2ba&amp;t=21594b20-3a2c-8037-8215-c424cf08c2ba" alt="notion image" loading="lazy" decoding="async"/></div></figure></div><div class="notion-spacer"></div><div class="notion-column notion-block-21594b203a2c804ab6a4c16ac9fb7535" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.5)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c8020834cd74d4522243c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A00a8f76b-24c1-415f-ba45-28723a7e9ad4%3AIMG_1650.png?table=block&amp;id=21594b20-3a2c-8020-834c-d74d4522243c&amp;t=21594b20-3a2c-8020-834c-d74d4522243c" alt="notion image" loading="lazy" decoding="async"/></div></figure></div><div class="notion-spacer"></div></div><div class="notion-blank notion-block-21594b203a2c80049e7dde3356103d0c"> </div><div class="notion-text notion-block-21594b203a2c80969a56f18d9169f449">路过了中国天眼贵安科学中心和贵州师范大学。</div><div class="notion-row notion-block-21594b203a2c80c58bcff01fa3c883d9"><div class="notion-column notion-block-21594b203a2c8011a7e5e5bc2b9e448d" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.5625)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c807fb419c0cc874c0483"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A15b03b23-2546-45d6-b37c-a78a9f1a13f6%3AIMG_1861.jpeg?table=block&amp;id=21594b20-3a2c-807f-b419-c0cc874c0483&amp;t=21594b20-3a2c-807f-b419-c0cc874c0483" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-21594b203a2c8077b8f0ff048dbbf6fd"> </div><div class="notion-blank notion-block-21594b203a2c80009860c15d146b59c4"> </div><div class="notion-blank notion-block-21594b203a2c805790c1d6e221aec1ff"> </div><div class="notion-text notion-block-21594b203a2c805d81a9dbb4d8da32d0">这是今天的垃圾战绩，哈哈哈哈哈。</div></div><div class="notion-spacer"></div><div class="notion-column notion-block-21594b203a2c806b96d5c04d06aec63d" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.4375)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c805cbeeed81363be19dc"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A814353dd-d139-4e15-8fd2-b86d09993501%3AIMG_1862.jpeg?table=block&amp;id=21594b20-3a2c-805c-beee-d81363be19dc&amp;t=21594b20-3a2c-805c-beee-d81363be19dc" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-21594b203a2c8045b3bedb9fcd457ca8"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c8025b6c7e076e34d3b23"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3Ad73cd9f2-18d9-4dfb-acd8-449b8c0718b4%3AIMG_1864.jpeg?table=block&amp;id=21594b20-3a2c-8025-b6c7-e076e34d3b23&amp;t=21594b20-3a2c-8025-b6c7-e076e34d3b23" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-21594b203a2c800791c0cb7f57436264"> </div></div><div class="notion-spacer"></div></div><div class="notion-row notion-block-21594b203a2c80d5bcb7c231aa9260a8"><div class="notion-column notion-block-21594b203a2c8030afa6faefc363980c" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.33333333333333337)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c801aa1f0c37ae07a7b3a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A4ce52aa1-6c6d-42bc-9398-487e82246787%3AIMG_1865.png?table=block&amp;id=21594b20-3a2c-801a-a1f0-c37ae07a7b3a&amp;t=21594b20-3a2c-801a-a1f0-c37ae07a7b3a" alt="notion image" loading="lazy" decoding="async"/></div></figure></div><div class="notion-spacer"></div><div class="notion-column notion-block-21594b203a2c80d985f7ce61c0fefe38" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.33333333333333337)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c808c98b5d16bf4a8243b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A4f13fb3d-ff95-4804-acce-24fb4f9c30fa%3AIMG_1866.png?table=block&amp;id=21594b20-3a2c-808c-98b5-d16bf4a8243b&amp;t=21594b20-3a2c-808c-98b5-d16bf4a8243b" alt="notion image" loading="lazy" decoding="async"/></div></figure></div><div class="notion-spacer"></div><div class="notion-column notion-block-21594b203a2c8029ba97d6633bf57bcb" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.3333333333333333)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-21594b203a2c80b0a4ace46cbb4065e7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A117cb7c3-4f62-4136-b0bd-02d40a03d99d%3AIMG_1867.png?table=block&amp;id=21594b20-3a2c-80b0-a4ac-e46cbb4065e7&amp;t=21594b20-3a2c-80b0-a4ac-e46cbb4065e7" alt="notion image" loading="lazy" decoding="async"/></div></figure></div><div class="notion-spacer"></div></div><div class="notion-blank notion-block-21594b203a2c8036a32afb8c85313088"> </div><div class="notion-text notion-block-21594b203a2c80f0995fd309d30a1dd7">接下来要继续保持。不得不说贵州的天气是真的好。</div><div class="notion-blank notion-block-21594b203a2c807fac72e003458874e0"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[根据 DOI 获取文献信息的实用指南]]></title>
            <link>https://earthyang.com/article/doi_metadata_extractor</link>
            <guid>https://earthyang.com/article/doi_metadata_extractor</guid>
            <pubDate>Mon, 06 Jan 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-17394b203a2c80bb88e0cbade4f7653e"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><blockquote class="notion-quote notion-block-17394b203a2c80369ef0e0d6e5086598"><div>在学术研究中，获取文献的详细信息对于文献综述、引用管理以及进一步研究至关重要。本文将介绍如何利用 Crossref 的 API，根据 DOI（数字对象标识符）从 Excel 文件中批量获取文献信息，包括期刊名称、论文标题、出版日期以及 GitHub 地址。</div></blockquote><div class="notion-blank notion-block-17394b203a2c80bc8a4ff8e3848b390f"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c80808ebae2dafa3589b2" data-id="17394b203a2c80808ebae2dafa3589b2"><span><div id="17394b203a2c80808ebae2dafa3589b2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c80808ebae2dafa3589b2" title="步骤1：准备工作"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步骤1：准备工作</b></span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c804aa007cffea542320d" data-id="17394b203a2c804aa007cffea542320d"><span><div id="17394b203a2c804aa007cffea542320d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c804aa007cffea542320d" title="1.1 准备DOI数据"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>1.1 准备DOI数据</b></span></span></h4><div class="notion-text notion-block-17394b203a2c8083925dd36fa1a2a858">假设你已经有一个包含DOI的Excel文件，格式如下：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-17394b203a2c80e8b77ec683a2b2524f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/attachment%3A25ae0e6e-6c51-49cc-87e5-01911df1cb93%3AUntitled.png?table=block&amp;id=17394b20-3a2c-80e8-b77e-c683a2b2524f&amp;t=17394b20-3a2c-80e8-b77e-c683a2b2524f" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-17394b203a2c804b89fcc3862412c2a1">你需要从Excel中读取这些DOI，并将其用来从Crossref API获取文献信息。</div><div class="notion-blank notion-block-17394b203a2c80b18b50cebfbff80889"> </div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c80d78299cef651863d14" data-id="17394b203a2c80d78299cef651863d14"><span><div id="17394b203a2c80d78299cef651863d14" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c80d78299cef651863d14" title="1.2 安装所需的Python库"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>1.2 安装所需的Python库</b></span></span></h4><div class="notion-text notion-block-17394b203a2c803688ebd6e8c642aa65">我们需要以下Python库来完成任务：</div><ul class="notion-list notion-list-disc notion-block-17394b203a2c8039a7addf3486e70a49"><li>pandas：用于处理Excel数据。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c8033b534effc02f35e45"><li>requests：用于发送HTTP请求。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c80ee992ff8a4919eb117"><li>tqdm：用于显示进度条，方便监控进度。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c80b88b24f02fcdaa31db"><li>re：用于从文章摘要中提取GitHub URL。</li></ul><div class="notion-text notion-block-17394b203a2c809bbd2fdb0dc24bdffd">你可以通过以下命令安装所需库：</div><div class="notion-blank notion-block-17394b203a2c8078a998c0108ac98ca5"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c80099941e67afebc7dbb" data-id="17394b203a2c80099941e67afebc7dbb"><span><div id="17394b203a2c80099941e67afebc7dbb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c80099941e67afebc7dbb" title="步骤2：编写代码"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步骤2：编写代码</b></span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c8017afd5fd475e18d3f2" data-id="17394b203a2c8017afd5fd475e18d3f2"><span><div id="17394b203a2c8017afd5fd475e18d3f2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c8017afd5fd475e18d3f2" title="2.1 定义获取元数据的函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2.1 定义获取元数据的函数</b></span></span></h4><div class="notion-text notion-block-17394b203a2c805b9a22d59735605b78">我们将使用Crossref API来获取文献的元数据。这个API允许我们通过DOI号查询期刊标题、论文标题、发表日期等信息。</div><div class="notion-blank notion-block-17394b203a2c80c984bac0e4431e7b0e"> </div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c8032afd8d2f86f192c47" data-id="17394b203a2c8032afd8d2f86f192c47"><span><div id="17394b203a2c8032afd8d2f86f192c47" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c8032afd8d2f86f192c47" title="2.2 查找GitHub地址"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2.2 查找GitHub地址</b></span></span></h4><div class="notion-text notion-block-17394b203a2c801a9a9cd4a6e928a8fc">有些文章可能会在摘要或正文中包含GitHub链接。为了提取这些链接，我们定义一个简单的函数。</div><div class="notion-blank notion-block-17394b203a2c80ce8089e08c3dcd2429"> </div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c80ceb43fc89ba12a6c02" data-id="17394b203a2c80ceb43fc89ba12a6c02"><span><div id="17394b203a2c80ceb43fc89ba12a6c02" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c80ceb43fc89ba12a6c02" title="2.3 获取所有DOI的元数据"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2.3 获取所有DOI的元数据</b></span></span></h4><div class="notion-text notion-block-17394b203a2c8016a5feef0547265b5d">我们使用progress_apply来迭代DataFrame中的每个DOI，并获取其元数据。</div><div class="notion-blank notion-block-17394b203a2c800d99c8dabdb766c4b4"> </div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-17394b203a2c805ab608ef7fcaaf39b5" data-id="17394b203a2c805ab608ef7fcaaf39b5"><span><div id="17394b203a2c805ab608ef7fcaaf39b5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c805ab608ef7fcaaf39b5" title="2.4 将元数据合并到原始数据"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2.4 将元数据合并到原始数据</b></span></span></h4><div class="notion-text notion-block-17394b203a2c808ea2ccf25f529b6fe7">我们将获取的元数据合并到原始DataFrame中。</div><div class="notion-blank notion-block-17394b203a2c803083b3f012047c685e"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c8018a593f2d39f49dcc9" data-id="17394b203a2c8018a593f2d39f49dcc9"><span><div id="17394b203a2c8018a593f2d39f49dcc9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c8018a593f2d39f49dcc9" title="步骤3：处理代理问题（可选）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步骤3：处理代理问题（可选）</b></span></span></h3><div class="notion-text notion-block-17394b203a2c806489eaca024c040a08">如果你在请求过程中需要使用代理，可以在requests.get中设置代理：</div><div class="notion-blank notion-block-17394b203a2c80ca82ffd0f6282dc92e"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c80ccbdd5e85fb13eb3e7" data-id="17394b203a2c80ccbdd5e85fb13eb3e7"><span><div id="17394b203a2c80ccbdd5e85fb13eb3e7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c80ccbdd5e85fb13eb3e7" title="完整代码"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>完整代码</b></span></span></h3><div class="notion-text notion-block-17394b203a2c80e8ae6aeda6ac0726b5">结合上面的步骤，完整的代码如下：</div><div class="notion-blank notion-block-17394b203a2c807a9086e0d39f899290"> </div><div class="notion-text notion-block-17394b203a2c804c89fce55589b07934">通过以上步骤，你可以轻松地根据DOI号提取文献的详细信息，并将其保存到Excel文件中。如果在请求过程中需要代理，也可以进行配置，确保顺利访问API。</div><div class="notion-text notion-block-17394b203a2c800c8786e10b118c4550">希望这篇博客能够帮助你顺利提取并导出DOI文献信息！</div><div class="notion-blank notion-block-17394b203a2c8049b76de85c1dd60d5a"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[linux 系统安装]]></title>
            <link>https://earthyang.com/article/linux-system-install</link>
            <guid>https://earthyang.com/article/linux-system-install</guid>
            <pubDate>Fri, 02 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[系统安装；显卡驱动安装；创建账号；永久挂载硬盘]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-f5a0fd0917024d3492d2d8cd805f2e6f"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><blockquote class="notion-quote notion-block-fe1d11646da44b61a95947913c6e4366"><div>使用U盘ventoy安装iso镜像</div></blockquote><blockquote class="notion-quote notion-block-ee2efa0eeeea41d19e64b0a7c9cfa29c"><div>安装显卡驱动</div></blockquote><blockquote class="notion-quote notion-block-61ea5655e12b4e7fb3d91911512e2b26"><div>永久挂载硬盘</div></blockquote><div class="notion-blank notion-block-17394b203a2c808f9abada90a1edc5e5"> </div><div class="notion-text notion-block-275f9e7f057f4d059373d94cdaf8f3d0">首先，你需要有下载iso镜像，推荐用ventoy在官网获取你需要安装版本的iso镜像。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-f8678203d652477abc9ca670d949dda8" data-id="f8678203d652477abc9ca670d949dda8"><span><div id="f8678203d652477abc9ca670d949dda8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f8678203d652477abc9ca670d949dda8" title="显卡驱动安装："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">显卡驱动安装：</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-2d073f6bccdb40969b09ab168ed5da32" style="list-style-type:decimal"><li><b>检查显卡型号：</b> 首先，确定你的NVIDIA显卡型号，你可以使用以下命令来检查：</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-dedfd099dc2740da98ddb9e161f4a1ca" style="list-style-type:decimal"><li><b>安装NVIDIA驱动依赖项：</b>在安装NVIDIA驱动之前，你需要安装一些依赖项。运行以下命令：</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-ad67bfd4e7434702aa69120f3be0a12f" style="list-style-type:decimal"><li><b>添加NVIDIA仓库（仅适用于Ubuntu）：</b> 如果你使用的是Ubuntu，建议将NVIDIA官方仓库添加到系统中，以获取最新的驱动。你可以使用以下命令：</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-6b01787f8e074db5ae532830479e67c3" style="list-style-type:decimal"><li><b>安装NVIDIA驱动程序：</b> 使用以下命令安装NVIDIA驱动程序。根据你的显卡型号，选择不同的驱动版本。可以先用ubuntu-drivers devices命令查看，可能有建议。</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-9339c33bf758452f881ce7b85158dc4f" style="list-style-type:decimal"><li>重启系统</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-da1333fa78564e36b9080619fffe6164" style="list-style-type:decimal"><li><b>验证驱动安装：</b> 可以使用以下命令来验证NVIDIA驱动是否正确安装：</li></ol><div class="notion-row"><a class="notion-bookmark notion-block-9e824d1d86ea43969bb2bf24c11b8435" href="https://chat.openai.com/share/831922de-076f-4b15-a809-51de282527f8" target="_blank" rel="noopener noreferrer"><div><div class="notion-bookmark-title">安装Linux显卡驱动</div><div class="notion-bookmark-description">Shared via ChatGPT</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://earthyang.com/notion-proxy/image/https%3A%2F%2Fcdn.oaistatic.com%2F_next%2Fstatic%2Fmedia%2Fapple-touch-icon.59f2e898.png?table=block&amp;id=9e824d1d-86ea-4396-9bb2-bf24c11b8435&amp;t=9e824d1d-86ea-4396-9bb2-bf24c11b8435" alt="安装Linux显卡驱动" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://chat.openai.com/share/831922de-076f-4b15-a809-51de282527f8</div></div></div><div class="notion-bookmark-image"><img style="object-fit:cover" src="https://earthyang.com/notion-proxy/image/https%3A%2F%2Fcdn.oaistatic.com%2F_next%2Fstatic%2Fmedia%2Fchatgpt-share-og.49cbbffe.png?table=block&amp;id=9e824d1d-86ea-4396-9bb2-bf24c11b8435&amp;t=9e824d1d-86ea-4396-9bb2-bf24c11b8435" alt="安装Linux显卡驱动" loading="lazy" decoding="async"/></div></a></div><div class="notion-blank notion-block-bb3b5da7a95d40a590dccb0998411493"> </div><div class="notion-blank notion-block-7ab22cc04677478bbac69b33cfbbbce4"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-3bebd64b33254634bf63b72c05a97f9a" data-id="3bebd64b33254634bf63b72c05a97f9a"><span><div id="3bebd64b33254634bf63b72c05a97f9a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3bebd64b33254634bf63b72c05a97f9a" title="挂载硬盘和永久挂载硬盘"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">挂载硬盘和永久挂载硬盘</span></span></h3><div class="notion-text notion-block-4a5cd1c10cc74f1fa0c604fa9eca2436">在 Linux 中，您可以使用 <code class="notion-inline-code">lsblk</code> 命令查看系统文件系统和硬盘信息，</div><div class="notion-text notion-block-9765b77c07b246d1a4f065ec521ead8c">也可以配合 <code class="notion-inline-code">-f</code> 选项来查看连接到系统上的所有块设备的文件系统类型。这会列出包括硬盘在内的所有存储设备的分区以及它们的文件系统类型、挂载点和其他信息。</div><div class="notion-text notion-block-29563566f8a44c80a68d032720e86e04">执行这个命令后，你会看到一列标记为 <code class="notion-inline-code">FSTYPE</code> 的输出，其中就会显示每个分区的文件系统类型（如 <code class="notion-inline-code">ntfs</code>, <code class="notion-inline-code">ext4</code>, <code class="notion-inline-code">vfat</code> 等等）。</div><div class="notion-text notion-block-7e19aa396e764e0aac8e5a2edccc327b">另一个方法是使用 <code class="notion-inline-code">blkid</code> 命令，它也提供了关于块设备的详细信息：</div><div class="notion-text notion-block-db255b00fd97473b8cc3028a98eb5360">这个命令会列出所有块设备的详细信息，包括它们的 UUID、类型等信息。在这里，你可以找到 <code class="notion-inline-code">TYPE=&quot;文件系统类型&quot;</code> 的部分，这就是每个分区的文件系统类型。</div><div class="notion-text notion-block-6d1b8d8e418a48979fd3a8b94b1589b5">请在执行这些命令时保持谨慎，特别是如果你在使用 <code class="notion-inline-code">sudo</code> 或者处理文件系统和挂载点。如果你不确定某个命令，最好先查询相关文档或者询问有经验的用户。</div><div class="notion-blank notion-block-fb9f49661d254a07ad94b5df14883c1f"> </div><div class="notion-text notion-block-4eaa23f639594134a523421522c1f1fc">挂载命令：</div><div class="notion-text notion-block-a716dbf717b74c4d835e20b25251587d">挂载硬盘：使用 <code class="notion-inline-code"><b>mount</b></code> 命令来挂载硬盘。你需要指定你想要挂载的设备，可以用上面 <code class="notion-inline-code">lsblk</code> 和<code class="notion-inline-code">sudo blkid</code>命令查看。</div><div class="notion-text notion-block-ff2da1094b1744b09b232da2b5841360">如果你已经知道了具体的设备名称（比如 <code class="notion-inline-code"><b>/dev/sda2</b></code>）和你想要挂载的目录名称（假设是 <code class="notion-inline-code"><b>/mnt/mydisk</b></code>），下面是挂载该硬盘的命令：</div><div class="notion-blank notion-block-fbfa6cb95fb348a488645aa0d27c0ea8"> </div><div class="notion-text notion-block-993aecdf5cf3465e843b096a1c0092e1">如果需要永久挂载设备，需要编辑系统的 <code class="notion-inline-code">/etc/fstab</code>文件。这个文件包含了系统引导时自动挂载的文件系统信息。请按照以下步骤进行：</div><ol start="1" class="notion-list notion-list-numbered notion-block-906e3c2ca62d4406b359743bf068abbd" style="list-style-type:decimal"><li>打开终端并以root权限编辑/etc/fstab文件。您可以使用文本编辑器，比如nano或vi。在这里，我将使用vim：</li></ol><ol start="1" class="notion-list notion-list-numbered notion-block-18def0c03b6a4405b8af4d1bd004f877" style="list-style-type:decimal"><li>在打开的/etc/fstab文件中，您需要添加一行来描述/dev/sda2的挂载。行的格式如下：</li></ol><div class="notion-text notion-block-2640424c2ef94528bd1392832dbb2ba3">在这里，请将&quot;UUID_OF_SDA2&quot;替换为/dev/sda2分区的实际UUID（你可以使用 <code class="notion-inline-code">sudo blkid</code> 命令查看uuid以及文件系统类型）。请确保在UUID和/mnt/mydisk之间有一个空格，并且各个字段之间使用空格分隔。</div><div class="notion-blank notion-block-0a4abde574b44ec3800dd51aef7ac4d2"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[如何在矩阵中随机选择行并进行拼接]]></title>
            <link>https://earthyang.com/article/matlab-tech</link>
            <guid>https://earthyang.com/article/matlab-tech</guid>
            <pubDate>Sun, 02 Jul 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[matlab随机抽取指定数量的行，并将剩余行存放在另一个矩阵汇总，以及一些矩阵的拼接操作]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-4abdc1a7903949dcad3c5d1331366e4d"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-a71f81f105e54e24a5e1df0a5df1c009">在处理矩阵数据时，我们经常需要从一个大矩阵中随机选择部分行，或者将多个矩阵按行或列拼接在一起。本文将介绍如何在 <b>MATLAB</b> 和 <b>Python</b> 中实现以下操作：</div><ul class="notion-list notion-list-disc notion-block-17394b203a2c80208c37d8bc428c09fe"><li>从原始矩阵中随机选择部分行。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c80468ceeeec5df9e69bc"><li>将随机选择的行和剩余的行存储到不同的矩阵中。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c809bba77d401bc719435"><li>将两个具有相同列数的矩阵按行或列拼接起来。</li></ul><div class="notion-blank notion-block-85ded83397f44252bee9b65e53aee269"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c805592d5e80cbd3222b0" data-id="17394b203a2c805592d5e80cbd3222b0"><span><div id="17394b203a2c805592d5e80cbd3222b0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c805592d5e80cbd3222b0" title="一、MATLAB 实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>一、MATLAB 实现</b></span></span></h3><div class="notion-text notion-block-17394b203a2c808d9379f173b2167275"><b>1. 随机选择行并拆分矩阵</b></div><div class="notion-text notion-block-17394b203a2c80f2895bcd2ce2a12642">假设我们有一个包含 n 行和 m 列的矩阵 original_matrix，我们需要随机选择 k 行，并将剩余的 n-k 行存储到另一个矩阵中。</div><div class="notion-text notion-block-c3c0832e833c41d797239afd79ef44f3">示例代码：</div><div class="notion-text notion-block-17394b203a2c808b9f58c869cc49fe84"><b>解释：</b></div><div class="notion-text notion-block-17394b203a2c805da11bcaaaaff88c2d">1.randperm(n, k)：生成一个从 1 到 n 的随机排列，并从中选择 k 个索引，表示我们随机选择的行。</div><div class="notion-text notion-block-17394b203a2c8070b073e0ff20b9efe2">2.original_matrix(indices, :)：根据 indices 提取原矩阵中随机选择的行。</div><div class="notion-text notion-block-17394b203a2c80d48ee3ea9229e4aa5d">3.setdiff(1:n, indices)：获取从 1:n 中去除 indices 后的剩余索引。</div><div class="notion-text notion-block-17394b203a2c80b0bf86d15e31765b0e">4.original_matrix(setdiff(1:n, indices), :)：根据剩余的索引提取矩阵的剩余行。</div><div class="notion-text notion-block-17394b203a2c8069bed9cfb940398b6f">在此代码中，random_rows 变量包含了随机选择的行，remaining_rows 变量包含了剩余的行。</div><div class="notion-blank notion-block-17394b203a2c80cdb42ffbda59b1cdd8"> </div><div class="notion-text notion-block-17394b203a2c803cafddc439f265b4ec"><b>2. 拼接矩阵</b></div><div class="notion-text notion-block-17394b203a2c802d90fce9f4ddff95c0">假设我们有两个矩阵 matrix1 和 matrix2，它们具有相同的列数。我们希望将它们按行拼接起来。</div><div class="notion-text notion-block-17394b203a2c803caaa8e600b50d9727"><b>解释：</b>vertcat(matrix1, matrix2)：将 matrix1 和 matrix2 按行拼接成一个新的矩阵，结果是一个四行三列的矩阵。</div><div class="notion-blank notion-block-17394b203a2c8039a444e96ebd73b432"> </div><div class="notion-text notion-block-17394b203a2c803184d0fddd393ef78a">如果你需要按列拼接矩阵，可以使用 horzcat 函数：</div><div class="notion-blank notion-block-17394b203a2c80238da3d338f175a087"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-17394b203a2c8071b18ec9a0d045dcdd" data-id="17394b203a2c8071b18ec9a0d045dcdd"><span><div id="17394b203a2c8071b18ec9a0d045dcdd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#17394b203a2c8071b18ec9a0d045dcdd" title="二、Python 实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>二、Python 实现</b></span></span></h3><div class="notion-text notion-block-17394b203a2c803a96e2e277bed958e9"><b>1. 随机选择行并拆分矩阵</b></div><div class="notion-text notion-block-17394b203a2c80429384c5bd9c78cc27">在 Python 中，我们可以使用 NumPy 库来实现类似的操作。假设我们有一个形状为 (n, m) 的 NumPy 数组 original_matrix，我们需要随机选择 k 行，并将剩余的行存储到另一个数组中。</div><div class="notion-text notion-block-17394b203a2c80cf9a28c31100b65464">其中：</div><div class="notion-text notion-block-17394b203a2c80698453c46763b6fb74">1.np.random.choice(n, k, replace=False)：从 n 行中随机选择 k 行的索引，replace=False 表示不重复选择。</div><div class="notion-text notion-block-17394b203a2c805f9a45d2f3394d315b">2.original_matrix[indices, :]：根据索引提取原矩阵中随机选择的行。</div><div class="notion-text notion-block-17394b203a2c80548d18ff8bb9023da6">3.np.delete(original_matrix, indices, axis=0)：删除 original_matrix 中已经选择的行，axis=0 表示删除行。</div><div class="notion-text notion-block-17394b203a2c800dbfcdcb3642a7a3a8">此时，random_rows 数组包含了随机选择的行，remaining_rows 数组包含了剩余的行。</div><div class="notion-blank notion-block-17394b203a2c809e94c3fc9c73298499"> </div><div class="notion-text notion-block-17394b203a2c80dab832ff369a0a4abc"><b>2. 拼接矩阵</b></div><div class="notion-text notion-block-17394b203a2c802882cfd3b2de925348">在 Python 中，NumPy 提供了 np.concatenate 函数来按行或列拼接矩阵。</div><div class="notion-text notion-block-17394b203a2c80069964ce2b6bf27b98">其中：</div><div class="notion-text notion-block-17394b203a2c80488527f1cb3d9fa284">np.concatenate((matrix1, matrix2), axis=0)：按行拼接 matrix1 和 matrix2，axis=0 表示按行拼接。</div><div class="notion-text notion-block-17394b203a2c8077b6f9e91741847f27">如果你需要按列拼接矩阵，可以使用 axis=1：</div><div class="notion-blank notion-block-17394b203a2c8002891ac2487a175e6d"> </div><div class="notion-text notion-block-17394b203a2c801cb09ed3624d2e4d64"><b>总结</b></div><div class="notion-text notion-block-17394b203a2c80f2b212f86fd0152065">本文介绍了如何在 <b>MATLAB</b> 和 <b>Python</b> 中实现以下操作：</div><ul class="notion-list notion-list-disc notion-block-17394b203a2c80919e66ddd5f655122c"><li>从原始矩阵中随机选择部分行，并将剩余的行存储到另一个矩阵中。</li></ul><ul class="notion-list notion-list-disc notion-block-17394b203a2c80838588f5f9e8ae58f7"><li>将两个具有相同列数的矩阵按行或列拼接起来。</li></ul></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>