<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>马火星的迷你小屋</title>
  <icon>http://blog.1314171.xyz/icon.png</icon>
  <subtitle>可能有一些学习心得和日常</subtitle>
  <link href="http://blog.1314171.xyz/atom.xml" rel="self"/>
  
  <link href="http://blog.1314171.xyz/"/>
  <updated>2025-09-01T13:35:59.375Z</updated>
  <id>http://blog.1314171.xyz/</id>
  
  <author>
    <name>TT2TER</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>和科研中无人问津的TensorFlow斗智斗勇 --配置tensorflow环境</title>
    <link href="http://blog.1314171.xyz/post/250315run-tensorflow.html"/>
    <id>http://blog.1314171.xyz/post/250315run-tensorflow.html</id>
    <published>2025-03-15T08:53:25.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<p>为了运行<a href="https://nvlabs.github.io/sionna/">sionna</a>，一个nvidia开发的无线信道仿真工具，依赖于tensorflow</p><h1 id="tensorflow官方的安装要求"><a href="#tensorflow官方的安装要求" class="headerlink" title="tensorflow官方的安装要求"></a>tensorflow官方的安装要求</h1><p><a href="https://www.tensorflow.org/install/gpu">官网</a>上给出了tensorflow的安装要求，其中包括了cuda，cudnn等环境的要求，这些环境的安装对于初学者来说是一个很大的挑战，而且这些环境对于不同的深度学习框架来说是有冲突的，所以我不想在本机上安装这些环境，而是选择在docker中安装tensorflow环境。</p><h1 id="conda安装tensorflow环境"><a href="#conda安装tensorflow环境" class="headerlink" title="conda安装tensorflow环境"></a>conda安装tensorflow环境</h1><p>正如摘要中提到的，我不想在本机配置cuda-toolkit, cudnn等环境，在一开始我尝试按照pytorch类似的方法在conda中安装cuda，但因为对tensorflow的不熟悉，且官方文档对于各个版本tensorflow对应的cuda版本等信息不够清晰，尝试了几种不同的组合，好像中间成功过（但因为我代码有个地方有bug，所以程序没运行成功，并且tensorflow也有Error报错，令我误以为是环境没有配置好）</p><p>报错如下：</p><figure class="highlight vim"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs vim">E tensorflow/<span class="hljs-keyword">compiler</span>/xla/stream executor/cuda/cuda dnn.<span class="hljs-keyword">cc</span>:<span class="hljs-number">9342</span>]<br>Unable <span class="hljs-keyword">to</span> register cuDNN factory: Attempting <span class="hljs-keyword">to</span> register factory <span class="hljs-keyword">for</span> plugin cuDNN when one <span class="hljs-built_in">has</span> already been registered<br>E tensorflow/<span class="hljs-keyword">compiler</span>/xla/stream executor/cuda/cuda fft.<span class="hljs-keyword">cc</span>:<span class="hljs-number">609</span>] Unable <span class="hljs-keyword">to</span> register cuFfT factor/: Attempting <span class="hljs-keyword">to</span> reaister factory <span class="hljs-keyword">for</span> plugin cuFFT when one <span class="hljs-built_in">has</span> already been reaistered<br>E tensorflow/<span class="hljs-keyword">compiler</span>/xla/stream executor/cuda/cuda blas,<span class="hljs-keyword">cc</span>:<span class="hljs-number">1518</span><span class="hljs-keyword">l</span> Unable <span class="hljs-keyword">to</span> reaister cuBLAs factory: Attempting <span class="hljs-keyword">to</span> register factory <span class="hljs-keyword">for</span> plugin cuBLAs when one <span class="hljs-built_in">has</span> already been registered<br></code></pre></td></tr></table></figure><p>根据在github上讨论，这个error更像是warning，不影响程序的运行，后续有时间我再补充上使用conda配置tensorflow的方法</p><p>关键的思路就是使用conda安装cuda,cudnn，然后正常安装tensorflow（忘了是pip还是conda装能跑通了）</p><p>最难受的是用pip安装tensorflow-gpu，然后再安装sionna时，pip会自动升级tensorflow版本，好像也会导致问题。</p><p><a href="https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#using-conda-to-install-the-cuda-software">conda安装cuda</a></p><p><a href="https://docs.nvidia.com/deeplearning/cudnn/installation/latest/linux.html#conda-installation">conda安装cudnn</a></p><h1 id="docker安装tensorflow环境"><a href="#docker安装tensorflow环境" class="headerlink" title="docker安装tensorflow环境"></a>docker安装tensorflow环境</h1><blockquote><p>先决条件：安装docker</p></blockquote><blockquote><p>先决条件：安装nvidia container toolkit<br><a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html">按照官方文档安装</a></p></blockquote><h2 id="安装tensorflow"><a href="#安装tensorflow" class="headerlink" title="安装tensorflow"></a>安装tensorflow</h2><p><a href="https://www.tensorflow.org/install/docker">参考官方文档的docker安装</a></p><p>需要注意的是，tensorflow的版本和cuda的版本是有对应关系的，所以在安装时需要注意这一点，可以在官方的dockerhub上查看对应cuda最低版本的要求，你本地的nvidia-smi的cuda版本需要比tensorflow要求的cuda版本高，否则会报错</p><p>如<a href="https://hub.docker.com/layers/tensorflow/tensorflow/2.15.0-gpu-jupyter/images/sha256-2de4ac3c6e8360a1e57b7dc4fca8d061daf7c58b61de31da1f0aca11c18bab32">2.15.0版本的tensorflow的详情页</a>，在第8条命令开始就有对应的cuda版本要求</p><p>ENV NVIDIA_REQUIRE_CUDA&#x3D;cuda&gt;&#x3D;12.3</p><p>那么我本地cuda是12.2, 就不支持这个2.15版本的容器</p><p>因此我最后选择了2.14.0版本的容器，其他如目录挂载的命令等都是和正常跑docker是一样的</p><p>就是要加上–gpus all参数，这样才能让docker使用gpu</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker run --gpus all -it -d -p 8888:8888 -v /home/ma/Documents/opensora/10M_val_human:/home/ma/Documents/opensora/10M_val_human -v /home/ma/Documents/code/h264:/home/ma/Documents/code/h264 tensorflow/tensorflow:2.14.0-gpu-jupyter  bash<br></code></pre></td></tr></table></figure><p>随后在终端内安装sionna，然后运行即可</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">pip install sionna<br></code></pre></td></tr></table></figure><p>安装需要的其他库如Opencv-python</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">pip install opencv-python<br></code></pre></td></tr></table></figure><p>有可能会有些lib库的依赖镜像中本来没有，因此需要apt安装对应的库</p><p>比如我就遇到了如下报错</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><code class="hljs latex">Traceback (most recent call last):<br>  File &quot;/home/ma/Documents/code/h264/SionnaPlus<span class="hljs-built_in">_</span>sora.py&quot;, line 13, in &lt;module&gt;<br>    import cv2<br>  File &quot;/usr/local/lib/python3.11/dist-packages/cv2/<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>init<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>.py&quot;, line 181, in &lt;module&gt;<br>    bootstrap()<br>  File &quot;/usr/local/lib/python3.11/dist-packages/cv2/<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>init<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>.py&quot;, line 153, in bootstrap<br>    native<span class="hljs-built_in">_</span>module = importlib.import<span class="hljs-built_in">_</span>module(&quot;cv2&quot;)<br>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>  File &quot;/usr/lib/python3.11/importlib/<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>init<span class="hljs-built_in">_</span><span class="hljs-built_in">_</span>.py&quot;, line 126, in import<span class="hljs-built_in">_</span>module<br>    return <span class="hljs-built_in">_</span>bootstrap.<span class="hljs-built_in">_</span>gcd<span class="hljs-built_in">_</span>import(name[level:], package, level)<br>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<span class="hljs-built_in">^</span><br>ImportError: libGL.so.1: cannot open shared object file: No such file or directory<br></code></pre></td></tr></table></figure><p>这个报错是因为opencv-python依赖于libGL.so.1，而这个库在镜像中没有，因此需要安装</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash">apt-get update<br>apt-get install libgl1-mesa-glx<br></code></pre></td></tr></table></figure><p>这种问题gpt直接可以解决</p><p>总的来说，docker安装tensorflow环境确实是最简单的，但是需要注意cuda版本的对应关系，以及可能会有一些库的依赖问题，但是这些问题都是可以解决的</p>]]></content>
    
    
    <summary type="html">tensorflow是google开源的深度学习框架，但是在科研中并不主流，其文档及环境配置也不如torch方便。并且其对本机环境的依赖性很强，而我又不想在本机上安装cuda（因为会与其他torch环境有冲突）</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="docker" scheme="http://blog.1314171.xyz/tags/docker/"/>
    
    <category term="TensorFlow" scheme="http://blog.1314171.xyz/tags/TensorFlow/"/>
    
    <category term="gpu" scheme="http://blog.1314171.xyz/tags/gpu/"/>
    
  </entry>
  
  <entry>
    <title>配置更符合现代科研环境的NTSCC</title>
    <link href="http://blog.1314171.xyz/post/250315run-ntscc.html"/>
    <id>http://blog.1314171.xyz/post/250315run-ntscc.html</id>
    <published>2025-03-15T08:00:36.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="配置ntscc"><a href="#配置ntscc" class="headerlink" title="配置ntscc"></a>配置ntscc</h1><p>ntscc是一个图像的信源信道联合编码工具<a href="https://semcomm.github.io/ntscc/">https://semcomm.github.io/ntscc/</a></p><p>他官方的环境需要的torch版本和cuda版本都比较老了，有点脱离现在的科研环境</p><p>将官方的都升级了一下python3.8-&gt;3.10 torch1.71-&gt;2.2.2 cuda11.0-&gt;11.8</p><p>以下是经过我测试的配置方案。测试环境是”Ubuntu 22.04.5 LTS” RTX 4090 Driver Version: 535.183.01 CUDA Version: 12.2</p><p>本机只装了nvidia的显卡驱动，无cuda等其他工具</p><blockquote><p>前置条件，安装conda</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs bash">conda create -n <span class="hljs-variable">$YOUR_PY38_ENV_NAME</span> python=3.10<br>conda activate <span class="hljs-variable">$YOUR_PY38_ENV_NAME</span><br><br>pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu118<br><br>python -m pip install -r requirements.txt<br></code></pre></td></tr></table></figure><p>其中，requirements.txt对应内容需要修改为</p><figure class="highlight txt"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs txt"># This file may be used to create an environment using:<br># $ conda create --name &lt;env&gt; --file &lt;this file&gt;<br># platform: linux-64<br>compressai==1.2.6<br>timm==0.9.16<br>numpy==1.24.3<br></code></pre></td></tr></table></figure><p>特别将numpy版本降低到1.24.3（我也忘了是要适配哪个库需要降级了）</p><p>最后，因为用了更高版本的compressai，需要修改一下ntscc中import</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-comment"># 将文件net/NTSCC_Hyperior.py中</span><br><span class="hljs-comment"># from compressai.ops import ste_round</span><br><span class="hljs-comment"># 改成:</span><br><span class="hljs-keyword">from</span> compressai.ops <span class="hljs-keyword">import</span> quantize_ste<br><span class="hljs-comment"># 同时也要修改一下调用的地方</span><br><span class="hljs-comment"># ste_round -&gt; quantize_ste</span><br></code></pre></td></tr></table></figure>]]></content>
    
    
    <summary type="html">NTSCC官方的环境好像有些问题，我这里记录一下解决方法。</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="ntscc" scheme="http://blog.1314171.xyz/tags/ntscc/"/>
    
  </entry>
  
  <entry>
    <title>关闭 Linux 图形化界面以节省内存</title>
    <link href="http://blog.1314171.xyz/post/20250106linux-without-gui.html"/>
    <id>http://blog.1314171.xyz/post/20250106linux-without-gui.html</id>
    <published>2025-01-11T08:53:34.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<p><img src="https://pic.1314171.xyz/i/2025/01/09/20250109154847804.png" alt="关闭后内存消耗急剧下降"><br>关闭后内存消耗急剧下降</p><h1 id="临时关闭："><a href="#临时关闭：" class="headerlink" title="临时关闭："></a>临时关闭：</h1><p>运行以下命令停止显示管理器：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl stop display-manager<br></code></pre></td></tr></table></figure><p>系统会切换到命令行模式，此时图形界面相关进程被停止，节省内存。</p><h1 id="永久关闭："><a href="#永久关闭：" class="headerlink" title="永久关闭："></a>永久关闭：</h1><p>修改系统默认启动目标为命令行模式：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl set-default multi-user.target<br>sudo reboot<br><br><span class="hljs-comment">#如果需要重新启用图形化界面：</span><br><br>sudo systemctl set-default graphical.target<br>sudo reboot<br></code></pre></td></tr></table></figure><p>关闭图形界面后会影响哪些功能？<br>1.无法使用桌面应用：<br>•图形化应用（如浏览器、文本编辑器等）无法运行，但命令行工具仍可正常使用。<br>2.远程桌面功能中断：<br>•如果依赖 VNC、NoMachine 等远程图形工具，它们将无法工作。不过，SSH 和命令行工具不受影响。<br>3.HDMI 显示屏输出：<br>•HDMI 可能只显示命令行，而非图形界面。</p>]]></content>
    
    
    <summary type="html">宿舍的工控机只用来跑一些服务，不需要图形化界面，关闭图形化界面可以节省内存，提高性能</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="linux" scheme="http://blog.1314171.xyz/tags/linux/"/>
    
    <category term="gui" scheme="http://blog.1314171.xyz/tags/gui/"/>
    
  </entry>
  
  <entry>
    <title>针对 SMB 的速度测试，并优化传输速度</title>
    <link href="http://blog.1314171.xyz/post/20250109smb-speed-test.html"/>
    <id>http://blog.1314171.xyz/post/20250109smb-speed-test.html</id>
    <published>2025-01-11T08:50:08.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="问题描述和分析"><a href="#问题描述和分析" class="headerlink" title="问题描述和分析"></a>问题描述和分析</h1><p>工位上的电脑和家里的nas使用之前提到的tailscale部署在了同一个局域网内，但是smb传输速度很慢，大概只有几十kb&#x2F;s，而且不稳定，有时候会掉到几kb&#x2F;s，甚至断联。同时，连接时延也很高，ping延迟在500ms以上。</p><p>而宿舍的工控机，或者别的校园网环境内的电脑，使用smb传输速度都很快，可以达到10mb&#x2F;s以上的下载速度。ping延迟也只有几十ms。甚至几ms。</p><h2 id="smb传输速度检测"><a href="#smb传输速度检测" class="headerlink" title="smb传输速度检测"></a>smb传输速度检测</h2><p>创建测试文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">dd</span> <span class="hljs-keyword">if</span>=/dev/zero of=testfile bs=1m count=1024<br></code></pre></td></tr></table></figure><p>挂载nas</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 在Ubuntu上挂载nas</span><br>sudo apt update<br>sudo apt install cifs-utils<br><br>sudo <span class="hljs-built_in">mkdir</span> -p /mnt/smb<br>sudo mount -t cifs //&lt;server&gt;/&lt;share&gt; /mnt/smb -o username=&lt;your-username&gt;,password=&lt;your-password&gt;,vers=3.0<br></code></pre></td></tr></table></figure><p>使用dd测试传输速度</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 上传到nas</span><br><span class="hljs-built_in">dd</span> <span class="hljs-keyword">if</span>=testfile of=/mnt/smb/testfile bs=1M <span class="hljs-comment">#可能会有权限问题，可以在nas上先创建这个文件</span><br><span class="hljs-comment"># 从nas下载</span><br><span class="hljs-built_in">dd</span> <span class="hljs-keyword">if</span>=/mnt/smb/testfile of=/dev/null bs=1M<br><br>❯ 1024+0 records <span class="hljs-keyword">in</span><br>❯ 1024+0 records out<br>❯ 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 90.8313 s, 11.8 MB/s<br></code></pre></td></tr></table></figure><blockquote><p>如果在mac上测试，使用dd命令时，需要使用<code>bs=1m</code>，而不是<code>bs=1M</code>，否则会报错<code>dd: bs: illegal numeric value</code></p></blockquote><p>比较不同网络环境的速度</p><p>取消挂载，删除测试文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo umount /mnt/smb<br>sudo <span class="hljs-built_in">rmdir</span> /mnt/smb<br><span class="hljs-built_in">rm</span> testfile<br></code></pre></td></tr></table></figure><h1 id="解决方法：使用iptables优化smb传输路径"><a href="#解决方法：使用iptables优化smb传输路径" class="headerlink" title="解决方法：使用iptables优化smb传输路径"></a>解决方法：使用iptables优化smb传输路径</h1><p>网络拓扑假设</p><p>假设：<br>•A 的 IP 地址：192.168.1.10<br>•B 的 IP 地址：192.168.1.20<br>•C 的 IP 地址：192.168.1.30<br>•SMB 服务运行在 C 的 445 端口。</p><p>目标：<br>•A 通过访问 B 的 445 端口间接访问 C 的 SMB 服务。<br>•配置完成后，A 访问 192.168.1.20:445 相当于访问 192.168.1.30:445。</p><h2 id="1-在-B-上启用ip转发"><a href="#1-在-B-上启用ip转发" class="headerlink" title="1. 在 B 上启用ip转发"></a>1. 在 B 上启用ip转发</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 临时开启</span><br>sudo sysctl -w net.ipv4.ip_forward=1<br><span class="hljs-comment"># 永久开启</span><br>sudo vim /etc/sysctl.conf<br>将其中的net.ipv4.ip_forward=1取消注释<br><br><span class="hljs-comment"># 重新加载配置</span><br>sudo sysctl -p<br></code></pre></td></tr></table></figure><p>验证是否开启了ip转发</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">cat</span> /proc/sys/net/ipv4/ip_forward<br><span class="hljs-comment"># 如果返回1，则表示开启了ip转发</span><br></code></pre></td></tr></table></figure><p>这一步是确保B能够转发流量</p><h2 id="2-在-B-上配置iptables规则"><a href="#2-在-B-上配置iptables规则" class="headerlink" title="2. 在 B 上配置iptables规则"></a>2. 在 B 上配置iptables规则</h2><h3 id="添加PREROUTING规则"><a href="#添加PREROUTING规则" class="headerlink" title="添加PREROUTING规则"></a>添加PREROUTING规则</h3><p>在B上添加PREROUTING规则，将所有访问B的445端口的流量转发到C的445端口</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.1.20 --dport 445 -j DNAT --to-destination 192.168.1.30:445<br></code></pre></td></tr></table></figure><h3 id="配置FORWARD规则"><a href="#配置FORWARD规则" class="headerlink" title="配置FORWARD规则"></a>配置FORWARD规则</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo iptables -A FORWARD -p tcp -s 192.168.1.10 -d 192.168.1.30 --dport 445 -j ACCEPT<br>sudo iptables -A FORWARD -p tcp -s 192.168.1.30 -d 192.168.1.10 --sport 445 -j ACCEPT<br></code></pre></td></tr></table></figure><p>允许A和C之间的445端口的通信</p><h3 id="配置POSTROUTING规则"><a href="#配置POSTROUTING规则" class="headerlink" title="配置POSTROUTING规则"></a>配置POSTROUTING规则</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo iptables -t nat -A POSTROUTING -p tcp -d 192.168.1.30 --dport 445 -j MASQUERADE<br></code></pre></td></tr></table></figure><p>这一步是确保C能够回复流量, 如果不配置这一步，C会自己直接回复给A，而不经过B，导致连接失败（当然也可以配置C的路由表，让C知道A的存在）</p><p>但做源地址伪装就不会有这个问题，C回复的数据包会被B伪装成B的数据包，A也会认为自己是在和B通信</p><h2 id="3-验证配置是否生效"><a href="#3-验证配置是否生效" class="headerlink" title="3. 验证配置是否生效"></a>3. 验证配置是否生效</h2><p>可以使用之前的dd命令测试一下速度，如果速度有明显提升，说明配置生效了</p><p>经过我的测试，速度从0kb，没错，9kb&#x2F;s，提升到了3mb&#x2F;s，速度提升了300多倍！可以正常打开和保存文件，甚至可以正常播放视频。<br><img src="https://pic.1314171.xyz/i/2025/01/09/20250109235227637.png" alt="可以看到效果很好"></p><p>虽然传输极大文件的速度还是不够理想，但是对于小文件的传输已经足够了。说明中转这一下速度影响还是很大的。（在宿舍时到nas的速度不中转也能达到10mb，而中转8mb）</p><p>如果有更大文件传输需求，可能需要考虑其他方法了……</p><h1 id="持久化iptables规则"><a href="#持久化iptables规则" class="headerlink" title="持久化iptables规则"></a>持久化iptables规则</h1><p>因为规则是临时的，重启后会失效，同时其他服务如tailscale，docker好像也会修改iptables规则，所以需要持久化规则，但又不能直接粗暴的<code>iptables-save &gt; /etc/iptables/rules.v4</code>，因为这样会把其他规则也保存下来，可能会导致其他服务出问题。</p><p>所以需要将规则命令保存到一个脚本中，然后在开机时执行这个脚本。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 创建启动脚本</span><br>sudo vim /usr/local/bin/iptables-setup.sh<br></code></pre></td></tr></table></figure><p>将需要执行的命令写入脚本中</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-meta">#!/bin/bash</span><br><br><span class="hljs-comment"># 添加 iptables 规则</span><br>iptables -t nat -A PREROUTING -p tcp -d 192.168.1.20 --dport 445 -j DNAT --to-destination 192.168.1.30:445<br><br><span class="hljs-comment"># 配置FORWARD规则</span><br>iptables -A FORWARD -p tcp -s 192.168.1.10 -d 192.168.1.30 --dport 445 -j ACCEPT<br>iptables -A FORWARD -p tcp -s 192.168.1.30 -d 192.168.1.10 --sport 445 -j ACCEPT<br><span class="hljs-comment"># 配置POSTROUTING规则</span><br>iptables -t nat -A POSTROUTING -p tcp -d 192.168.1.30 --dport 445 -j MASQUERADE<br></code></pre></td></tr></table></figure><p>给脚本添加执行权限</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo <span class="hljs-built_in">chmod</span> +x /usr/local/bin/iptables-setup.sh<br></code></pre></td></tr></table></figure><p>创建systemd服务</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo vim /etc/systemd/system/iptables-setup.service<br></code></pre></td></tr></table></figure><p>写入服务配置</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs bash">[Unit]<br>Description=Setup iptables rules<br>After=network.target<br><br>[Service]<br>Type=oneshot<br>ExecStart=/usr/local/bin/iptables-setup.sh<br>RemainAfterExit=<span class="hljs-built_in">yes</span><br><br>[Install]<br>WantedBy=multi-user.target<br></code></pre></td></tr></table></figure><p>重新加载配置</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl daemon-reload<br></code></pre></td></tr></table></figure><p>启用服务</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl <span class="hljs-built_in">enable</span> iptables-setup.service<br>sudo systemctl start iptables-setup.service<br>sudo systemctl status iptables-setup.service<br></code></pre></td></tr></table></figure><h1 id="补充"><a href="#补充" class="headerlink" title="补充"></a>补充</h1><p>Ubuntu好像默认FORWARD链是ACCEPT的，所以不需要配置FORWARD规则</p><p>另外，使用校园网有线连接时，转发速度也会有所提升，达到了8mb&#x2F;s</p>]]></content>
    
    
    <summary type="html">工位的电脑在校园网里又加了层nat，导致smb传输速度很慢，这里记录一下解决方法</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="smb" scheme="http://blog.1314171.xyz/tags/smb/"/>
    
    <category term="iptables" scheme="http://blog.1314171.xyz/tags/iptables/"/>
    
  </entry>
  
  <entry>
    <title>在执行代码后通知我</title>
    <link href="http://blog.1314171.xyz/post/240913notify.html"/>
    <id>http://blog.1314171.xyz/post/240913notify.html</id>
    <published>2024-09-13T13:04:26.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="在执行代码后通知我"><a href="#在执行代码后通知我" class="headerlink" title="在执行代码后通知我"></a>在执行代码后通知我</h1><p>找了很多现成的实现，感觉都很复杂，因此自己写了一个脚本，实现在执行代码后通知我</p><p>很简单，实现原理可以问GPT </p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 在~/.zshrc中添加</span><br><span class="hljs-comment">#以下是发出提示音的测试脚本</span><br><span class="hljs-comment"># Function to play a different sound based on the command result</span><br><span class="hljs-keyword">function</span> <span class="hljs-function"><span class="hljs-title">command_end_beep</span></span>() &#123;<br>    <span class="hljs-keyword">if</span> [ $? -eq 0 ]; <span class="hljs-keyword">then</span><br>        <span class="hljs-comment"># Command succeeded, play success sound</span><br>        paplay /usr/share/sounds/freedesktop/stereo/complete.oga <span class="hljs-comment"># You can change this to another sound</span><br>    <span class="hljs-keyword">else</span><br>        <span class="hljs-comment"># Command failed, play error sound</span><br>        <span class="hljs-built_in">echo</span> -e <span class="hljs-string">&quot;\a&quot;</span>  <span class="hljs-comment"># Change to a different sound or method for failure</span><br>    <span class="hljs-keyword">fi</span><br>&#125;<br><br><span class="hljs-comment"># Hook the function to run after every command</span><br><span class="hljs-keyword">if</span> [[ ! <span class="hljs-variable">$&#123;precmd_functions&#125;</span> == *command_end_beep* ]]; <span class="hljs-keyword">then</span><br>    precmd_functions+=(command_end_beep)<br><span class="hljs-keyword">fi</span><br></code></pre></td></tr></table></figure><p>有一点不完美的是在打开新的终端的时候，会有一个提示音，这是因为在打开终端的时候也会执行一次命令</p><p>暂时没有找到好的实现方法</p>]]></content>
    
    
    <summary type="html">当执行一些很长时间的代码的时候，往往会摸鱼或者干一些别的工作，这时候如果代码执行完了，我们希望能够通知我们</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="zsh" scheme="http://blog.1314171.xyz/tags/zsh/"/>
    
  </entry>
  
  <entry>
    <title>使用conda安装cuda</title>
    <link href="http://blog.1314171.xyz/post/240912condawithcuda.html"/>
    <id>http://blog.1314171.xyz/post/240912condawithcuda.html</id>
    <published>2024-09-12T02:02:27.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="使用conda安装cuda"><a href="#使用conda安装cuda" class="headerlink" title="使用conda安装cuda"></a>使用conda安装cuda</h1><p>因为需要在本地跑很多项目，有些项目在安装的时候会出现很多猝不及防的问题</p><p>最大的问题就是在正常创建conda环境，正常安装torch之后，一些依赖在安装的时候需要安装cuda,如nvcc，这时如何安装匹配的cuda版本就是一个问题</p><p>为了避免安装某个版本的cuda后，在跑其他项目的时候出现cuda版本不匹配的问题，我们可以使用conda安装cuda</p><h2 id="安装cuda"><a href="#安装cuda" class="headerlink" title="安装cuda"></a>安装cuda</h2><blockquote><p>注意，网上有教程说当需要使用conda安装包时，先将所有需要conda安装的包都安装好，再安装pip安装的包（虽然我没遇到过类似情况）</p></blockquote><p>参考<a href="https://docs.nvidia.com/cuda/archive/12.1.0/cuda-installation-guide-linux/index.html#conda-installation">官方文档</a></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">conda install cuda -c nvidia/label/cuda-12.1.0<br></code></pre></td></tr></table></figure><p>避坑，使用pip安装cuda识别不到nvcc，很怪。同时conda安装11.8时无法下载，再测试一下情况。</p><blockquote><p>其实能装cuda-11.8.0，只不过一开始不会显示进度，等一会就好了，可以用nload看一下下载速度，就不会焦虑了</p></blockquote><blockquote><p>相似的问题，使用pip安装需要编译的时候，有时候也很慢，为了避免焦虑可以使用-v参数，显示详细信息</p></blockquote><p>同时</p><blockquote><p>避坑！！</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">pip install nvidia-pyindex <span class="hljs-comment">#不要复制运行</span><br></code></pre></td></tr></table></figure><p>会直接覆盖掉你的pip.conf文件，更改pip默认配置，不建议下载</p><p><a href="https://github.com/NVIDIA/tensorflow/issues/98">相关问题讨论</a></p><p>如果已经不小心覆盖率，解决办法：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">pip config debug<br></code></pre></td></tr></table></figure><p>找到所有的配置文件，删除掉就行了，或者将对应配置使用unset参数</p><h2 id="其他问题"><a href="#其他问题" class="headerlink" title="其他问题"></a>其他问题</h2><p>在编译mmcv的时候，会出现找不到c++的问题，但实际上已经安装了g++</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">which</span> g++ <span class="hljs-comment"># /usr/bin/g++</span><br><span class="hljs-built_in">which</span> c++ <span class="hljs-comment">#c++ not found</span><br></code></pre></td></tr></table></figure><p>解决办法：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo <span class="hljs-built_in">ln</span> -s /usr/bin/g++ /usr/bin/c++<br></code></pre></td></tr></table></figure><p>这样就可以解决问题了</p><p>由此还想到一个问题，就是g++&#x2F;gcc的版本控制，因为发行版会默认对应一个版本，但是有时候我们需要使用其他版本，这时候就需要更改默认版本</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment">#以下两行仅供示意，未经过验证</span><br>sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100<br>sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100<br></code></pre></td></tr></table></figure><p>反正就是使用update-alternatives来更改默认版本，这样就可以解决问题了</p><p><a href="https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version">参考链接</a></p>]]></content>
    
    
    <summary type="html">使用conda安装cuda，避免cuda版本不匹配的问题</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="conda" scheme="http://blog.1314171.xyz/tags/conda/"/>
    
    <category term="cuda" scheme="http://blog.1314171.xyz/tags/cuda/"/>
    
  </entry>
  
  <entry>
    <title>号外号外，我有微信公众号了！</title>
    <link href="http://blog.1314171.xyz/post/240730Wechat.html"/>
    <id>http://blog.1314171.xyz/post/240730Wechat.html</id>
    <published>2024-07-30T15:44:16.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h3 id="为了让更多的人看到我的内容，我注册了个微信公众号"><a href="#为了让更多的人看到我的内容，我注册了个微信公众号" class="headerlink" title="为了让更多的人看到我的内容，我注册了个微信公众号"></a>为了让更多的人看到我的内容，我注册了个微信公众号</h3><p>请大家关注我的微信公众号：<strong>马火星自留地</strong>，或者扫描下面的二维码：<br><img src="https://pic.1314171.xyz/i/2024/07/30/Wechat.png" alt="马火星自留地"></p>]]></content>
    
    
    <summary type="html">求求关注，求求关注</summary>
    
    
    
    
    <category term="微信公众号" scheme="http://blog.1314171.xyz/tags/%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7/"/>
    
  </entry>
  
  <entry>
    <title>当真正面对“解绑”需求，tmux是你的最终归宿</title>
    <link href="http://blog.1314171.xyz/post/240728tmux.html"/>
    <id>http://blog.1314171.xyz/post/240728tmux.html</id>
    <published>2024-07-28T07:01:51.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="tmux，躲不开的归宿"><a href="#tmux，躲不开的归宿" class="headerlink" title="tmux，躲不开的归宿"></a>tmux，躲不开的归宿</h1><p><a href="https://www.ruanyifeng.com/blog/2019/10/tmux.html">阮一峰写的教程，很好用</a></p><p>相关快捷键</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><code class="hljs shell">tmux new -s &lt;session-name&gt; #新建名为&lt;session-name&gt;的会话<br>tmux attach -t &lt;session-name&gt; #连接名为&lt;session-name&gt;的会话<br>tmux ls #查看所有会话<br>tmux kill-session -t &lt;session-name&gt; #杀死名为&lt;session-name&gt;的会话<br>tmux switch -t &lt;session-name&gt; #切换到名为&lt;session-name&gt;的会话<br>tmux rename-session -t &lt;old-name&gt; &lt;new-name&gt; #重命名会话<br>C-b $ #重命名当前会话<br>C-b d #退出/挂起会话<br>C-b s #查看所有会话<br><br>C-b c #新建窗口<br>C-b n #切换到下一个窗口<br>C-b p #切换到上一个窗口<br>C-b w #查看所有窗口<br>C-b , #重命名窗口<br>C-b &amp; #关闭窗口<br>C-b 0-9 #切换到指定窗口<br><br>C-b % #垂直分割窗格<br>C-b &quot; #水平分割窗格<br>C-b &lt;方向键&gt; #切换到指定窗格<br>C-b x #关闭窗格<br>C-b z #最大化/恢复当前窗格<br>C-b &#123; #向前交换窗格位置<br>C-b &#125; #向后交换窗格位置<br>C-b ; #切换到上一个窗格<br>C-b o #切换到下一个窗格<br>C-b q #显示窗格编号<br>C-b 空格 #重新排列窗格布局<br>C-b C-&lt;方向键&gt; #调整窗格大小<br>C-b ! #将当前窗格分离为新窗口<br></code></pre></td></tr></table></figure><h2 id="tmux-中zsh没有颜色解决方案"><a href="#tmux-中zsh没有颜色解决方案" class="headerlink" title="tmux 中zsh没有颜色解决方案"></a>tmux 中zsh没有颜色解决方案</h2><h4 id="非官方方法"><a href="#非官方方法" class="headerlink" title="非官方方法"></a>非官方方法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">echo &quot;export TERM=xterm-256color&quot; &gt;&gt; ~/.zshrc<br></code></pre></td></tr></table></figure><p><a href="https://www.mojidong.com/post/2017-05-14-zsh-autosuggestions/">参考博客</a></p><p><a href="https://unix.stackexchange.com/questions/139082/zsh-set-term-screen-256color-in-tmux-but-xterm-256color-without-tmux">相关讨论</a></p><h3 id="符合官方建议的方法应该是"><a href="#符合官方建议的方法应该是" class="headerlink" title="符合官方建议的方法应该是"></a>符合官方建议的方法应该是</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">vim ~/.tmux.conf<br></code></pre></td></tr></table></figure><figure class="highlight vim"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs vim"><span class="hljs-keyword">set</span> -g default-terminal <span class="hljs-string">&quot;screen-256color&quot;</span><br></code></pre></td></tr></table></figure><p><a href="https://www.cnblogs.com/yiheyue/p/10731265.html">参考链接</a></p>]]></content>
    
    
    <summary type="html">你是否曾经遇到过这样的需求，你在远程服务器上运行了一个程序，但是你不想让它在你退出ssh的时候停止运行……你是否曾经遇到过这样的需求，你在工位运行了一个程序，但你还想在宿舍里看到它的输出……</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    <category term="share" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/share/"/>
    
    
    <category term="linux" scheme="http://blog.1314171.xyz/tags/linux/"/>
    
    <category term="shell" scheme="http://blog.1314171.xyz/tags/shell/"/>
    
    <category term="tmux" scheme="http://blog.1314171.xyz/tags/tmux/"/>
    
    <category term="terminal" scheme="http://blog.1314171.xyz/tags/terminal/"/>
    
    <category term="remote" scheme="http://blog.1314171.xyz/tags/remote/"/>
    
  </entry>
  
  <entry>
    <title>最简单的内网穿透方法！Tailscale</title>
    <link href="http://blog.1314171.xyz/post/240727Tailscale.html"/>
    <id>http://blog.1314171.xyz/post/240727Tailscale.html</id>
    <published>2024-07-28T05:39:09.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="很久没有写blog了"><a href="#很久没有写blog了" class="headerlink" title="很久没有写blog了"></a>很久没有写blog了</h1><p>很久没有写博客了，最近半年都比较忙，很多时候都没有时间写杂七杂八的东西，在这里交代一下近况，如果没有兴趣，请直接从侧边导航栏跳转到正文部分。</p><p>最近进组了，搞了一块很顶的4090显卡，在实验室工位上。最近刚刚把系统驱动环境搞定（真的挺不容易的，详情可以从主板上碰掉的电容说起……）。有了这么顶的显卡，当然要随时随地跑代码喽，那么外网访问就是必须要解决的事情。尤其是linux系统在校园网环境下拿不到ipv6老毛病一直没有得到解决，根本解决不了好吧。我还只有一个公网的仅ipv6服务器。想自己搭内网穿透都麻烦的很。找了很多服务，现成的内网穿透服务商，以及cloudflare，甚至是用warp给linux拿一个ipv6的方法都考虑过，都不是很好用。</p><p>在和神奇的前舍友讨论之后，找到了这个简单而且稳定的服务，<a href="https://tailscale.com/">tailscale</a></p><h1 id="正文"><a href="#正文" class="headerlink" title="正文"></a>正文</h1><p>用法很简单，访问官网，点击get started，登陆账号（我用的github），跟着教程一步一步的来，先添加两个设备。</p><p>如果不放心，可以看看这个<a href="https://tailscale.com/kb/1017/install">quick-start教程</a></p><p>为你所有想安装的服务安装上之后，就可以直接使用了</p><h2 id="最佳实践"><a href="#最佳实践" class="headerlink" title="最佳实践"></a>最佳实践</h2><h3 id="为设备改名"><a href="#为设备改名" class="headerlink" title="为设备改名"></a>为设备改名</h3><p>将设备名称改为更短更好记忆的名称</p><p>在控制面板的machines中找到你想改名的设备，在右侧点击三个点，并且编辑设备名称。</p><p>（用处，这样可以在ping&#x2F;ssh&#x2F;访问设备中的服务的时候直接用这个短的名称作为设备的名字）</p><p>注意，如果名称是纯数字，会在ping等命令中出现问题。</p><h3 id="使用magic-dns"><a href="#使用magic-dns" class="headerlink" title="使用magic dns"></a>使用magic dns</h3><p>更改tailent name</p><p>可以在dns选项中将域名改为foo-ber.ts.net的好记忆的域名</p><p>foo bar是两个随机分配的英文单词，有的组合还是很有意思的</p><p>在命名完之后，就可以用<machines-name>.<tailent name>来唯一确定你的任意组网内的机器了。</p><p>参考<a href="https://tailscale.com/kb/1081/magicdns">magic-dns</a></p><p>当然，如果你自己有短域名或者更顺手的域名，可以用自己的的域名解析dns，但是就得在你的域名管理平台自己添加了</p><h3 id="打开tailscale自己的ssh"><a href="#打开tailscale自己的ssh" class="headerlink" title="打开tailscale自己的ssh"></a>打开tailscale自己的ssh</h3><p>可以通过tailscale连接ssh,免去输入密码&#x2F;配置密钥的困扰（当然正常的ssh连接的方案不受影响）</p><p>我还没有阅读他的详细的原理，但是这个方法看起来（尝试起来）都很好用</p><p>参考<a href="https://tailscale.com/kb/1193/tailscale-ssh">ssh</a></p><p>ssh连接命令示例</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">ssh ubuntu@device<br></code></pre></td></tr></table></figure><h3 id="剩下的功能没有尝试，也暂时没有需求"><a href="#剩下的功能没有尝试，也暂时没有需求" class="headerlink" title="剩下的功能没有尝试，也暂时没有需求"></a>剩下的功能没有尝试，也暂时没有需求</h3><p><a href="https://tailscale.com/kb/1103/exit-nodes">尝试了一下出口节点（感觉就像代理一样，组网内的设备可以选择从出口节点出站)</a></p><p>我用宿舍的工控机和手机尝试了一下，不是很好用，流量没有转发。因为没有需求，因此没有进一步尝试。</p><h3 id="建议配合tmux等工具一起使用，断网不心疼"><a href="#建议配合tmux等工具一起使用，断网不心疼" class="headerlink" title="建议配合tmux等工具一起使用，断网不心疼"></a>建议配合tmux等工具一起使用，断网不心疼</h3><p><a href="https://blog.1314171.xyz/post/240728tmux/">跳转本站tmux介绍</a></p>]]></content>
    
    
    <summary type="html">解决的需求，在没有公网跳板机的情况下访问无法外网访问的服务器。</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    <category term="share" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/share/"/>
    
    
    <category term="network" scheme="http://blog.1314171.xyz/tags/network/"/>
    
    <category term="ipv6" scheme="http://blog.1314171.xyz/tags/ipv6/"/>
    
    <category term="内网穿透" scheme="http://blog.1314171.xyz/tags/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/"/>
    
    <category term="Tailscale" scheme="http://blog.1314171.xyz/tags/Tailscale/"/>
    
  </entry>
  
  <entry>
    <title>我用上了最好的Linux发行版！</title>
    <link href="http://blog.1314171.xyz/post/240131wsl2.html"/>
    <id>http://blog.1314171.xyz/post/240131wsl2.html</id>
    <published>2024-01-31T15:52:47.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="缘起"><a href="#缘起" class="headerlink" title="缘起"></a>缘起</h1><p>wsl在大一的时候一定是入不了我的法眼的，因为在当时，我秉持着Windows yyds的心态，并无使用Linux的需求与需要</p><p>wsl在大二的时候，我开始接触到了Linux（服务器，nas，工控机），但是我并没有在自己的电脑上安装wsl，而是在服务器上安装了Linux，又给电脑装了双系统，Linux充斥着玩乐的气息</p><p>在今年，终于有需要跑的项目代码在Linux上环境更适合，Linux系统走向了学术，变得不可或缺。</p><p>今年小学期的程序设计实验，nlp和cv最后的大作业，都需要Linux开发环境，同时联系的老师布置的任务也需要更强大的算力。好巧不巧该说不说，老师给的服务器居然是windows的，我不得不在自己的电脑上搭建Linux环境（鉴于老师的电脑我没法装双系统，也没法装虚拟机–众所周知vmware等虚拟机不能很好的连显卡）</p><p>在这样的大背景下，wsl又进入了我的眼帘。</p><h2 id="准备步骤"><a href="#准备步骤" class="headerlink" title="准备步骤"></a>准备步骤</h2><h3 id="根据以下链接，确认你的电脑能够启用wsl功能"><a href="#根据以下链接，确认你的电脑能够启用wsl功能" class="headerlink" title="根据以下链接，确认你的电脑能够启用wsl功能"></a>根据以下链接，确认你的电脑能够启用wsl功能</h3><p><a href="https://www.zdnet.com/article/windows-10-tip-find-out-if-your-pc-can-run-hyper-v/">windows-10-tip-find-out-if-your-pc-can-run-hyper-v&#x2F;</a></p><p>重点关注以下部分</p><blockquote><p>type msinfo32 in the search box to the right of the Start button<br>Scroll to the very end and look for the four items that begin with Hyper-V. If you see a Yes next to each one</p></blockquote><h3 id="确认你的显卡驱动是可用的版本"><a href="#确认你的显卡驱动是可用的版本" class="headerlink" title="确认你的显卡驱动是可用的版本"></a>确认你的显卡驱动是可用的版本</h3><p>详见cuda官方文档</p><p><a href="https://docs.nvidia.com/cuda/wsl-user-guide/index.html#nvidia-compute-software-support-on-wsl-2">nvidia-compute-software-support-on-wsl-2</a></p><p><a href="https://docs.nvidia.com/cuda/wsl-user-guide/index.html#step-1-install-nvidia-driver-for-gpu-support">step-1-install-nvidia-driver-for-gpu-support</a><br>中特别强调<em>This is the only driver you need to install. Do not install any Linux display driver in WSL.</em><br>其中还提到<br><em>From this point you should be able to run any existing Linux application which requires CUDA. Do not install any driver within the WSL environment. For building a CUDA application, you will need CUDA Toolkit. Read the next section for further information.</em></p><p>这里的这”step one”是指windows系统安装成功正确驱动 (稍后会讲我的安装实践</p><p>如果要用Linux构建cuda程序，才需要在wsl中安装toolkit</p><p><strong>因此不要轻易在wsl中运行任何cuda安装的相关命令（官方说很容易覆盖掉正确的驱动）</strong></p><h3 id="安装过程流水账"><a href="#安装过程流水账" class="headerlink" title="安装过程流水账"></a>安装过程流水账</h3><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cmd">wsl --install --distribution Ubuntu-<span class="hljs-number">20</span>.<span class="hljs-number">04</span><br></code></pre></td></tr></table></figure><p>这一步我应该是没开命令行代理，同时是在管理员的cmd中安装的</p><p>然后运行完他说重启之前不会做任何改动</p><p>然后我发现<br>wsl -l -v也不起作用，<br>重启之后也不起作用</p><p>报错如下：<br>    适用于 Linux 的 Windows 子系统没有已安装的分发。<br>    使用‘wsl.exe –list –online’列出可用的分发<br>    和 ‘wsl.exe –install <Distro>’进行安装。<br>    也可以通过访问 Microsoft Store 安装分发：<br>    <a href="https://aka.ms/wslstore">https://aka.ms/wslstore</a><br>    Error code: Wsl&#x2F;Service&#x2F;CreateInstance&#x2F;GetDefaultDistro&#x2F;WSL_E_DEFAULT_DISTRO_NOT_FOUND</p><p>以为没装上，就重新执行了<br>$wsl.exe –install –web-download Ubuntu-20.04$</p><p>结果显示：</p><pre><code class="hljs">Ubuntu 20.04 LTS 已安装。正在启动 Ubuntu 20.04 LTS...Installing, this may take a few minutes...Please create a default UNIX user account. The username does not need to match your Windows username.For more information visit: https://aka.ms/wslusersEnter new UNIX username: mayuNew password:Retype new password:passwd: password updated successfully</code></pre><p>安装操作误打误撞成功完成。</p><pre><code class="hljs">Installation successful!To run a command as administrator (user &quot;root&quot;), use &quot;sudo &lt;command&gt;&quot;.See &quot;man sudo_root&quot; for details.Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)* Documentation:  https://help.ubuntu.com* Management:     https://landscape.canonical.com* Support:        https://ubuntu.com/advantageSystem information as of Sat Dec 23 00:32:12 CST 2023System load:  0.81                Processes:             43Usage of /:   0.1% of 1006.85GB   Users logged in:       0Memory usage: 0%                  IPv4 address for eth0: 172.30.137.32Swap usage:   0%Expanded Security Maintenance for Applications is not enabled.0 updates can be applied immediately.Enable ESM Apps to receive additional future security updates.See https://ubuntu.com/esm or run: sudo pro statusThe list of available updates is more than a week old.To check for new updates run: sudo apt updateThis message is shown once a day. To disable it please create the/home/mayu/.hushlogin file.mayu@DESKTOP-68DFFP1:~$ ls</code></pre><p>我应该是跳过了正确安装的第一次正常启动的过程</p><p>正常的第一次启动应该是这样的：使用 WSL 安装 Linux 发行版的过程完成后，使用“开始”菜单打开该发行版（默认情况下为 Ubuntu）。 系统将要求你为 Linux 发行版创建“用户名”和“密码”。<a href="https://learn.microsoft.com/zh-cn/windows/wsl/setup/environment#set-up-your-linux-username-and-password">参看</a></p><p>经过了上述步骤之后，你在新的cmd中应该会有以下效果</p><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs cmd"><span class="hljs-function">C:\<span class="hljs-title">Windows</span>\<span class="hljs-title">system32</span>&gt;<span class="hljs-title">wsl</span> -<span class="hljs-title">l</span> -<span class="hljs-title">v</span></span><br><span class="hljs-function">  <span class="hljs-title">NAME</span>            <span class="hljs-title">STATE</span>           <span class="hljs-title">VERSION</span></span><br><span class="hljs-function">* <span class="hljs-title">Ubuntu</span>-20.04    <span class="hljs-title">Running</span>         2</span><br></code></pre></td></tr></table></figure><p>然后在wsl中运行nvidia-smi可以直接显示显卡</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs wsl">mayu@DESKTOP-68DFFP1:~$ nvidia-smi<br>Sat Dec 23 00:59:44 2023<br>+---------------------------------------------------------------------------------------+<br>| NVIDIA-SMI 535.54.04              Driver Version: 536.23       CUDA Version: 12.2     |<br>|-----------------------------------------+----------------------+----------------------+<br>| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |<br>| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |<br>|                                         |                      |               MIG M. |<br>|=========================================+======================+======================|<br>|   0  NVIDIA GeForce RTX 2080 Ti     On  | 00000000:73:00.0  On |                  N/A |<br>| 17%   34C    P8              27W / 250W |    446MiB / 22528MiB |      4%      Default |<br>|                                         |                      |                  N/A |<br>+-----------------------------------------+----------------------+----------------------+<br><br>+---------------------------------------------------------------------------------------+<br>| Processes:                                                                            |<br>|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |<br>|        ID   ID                                                             Usage      |<br>|=======================================================================================|<br>|    0   N/A  N/A        23      G   /Xwayland                                 N/A      |<br>+---------------------------------------------------------------------------------------+<br></code></pre></td></tr></table></figure><p>截止目前，我没有在wsl中安装任何cuda相关驱动。因此根据我的验证，网上没缘由安装cuda的博客全都在扯淡。</p><p>当然如果需要nvcc(使用toolkit编译cuda程序)，则需要安装cuda，但是是特别版的。</p><h4 id="（如有需要）安装cuda"><a href="#（如有需要）安装cuda" class="headerlink" title="（如有需要）安装cuda"></a>（如有需要）安装cuda</h4><p>我是在配置一个项目的环境的时候遇到了如下的报错：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs bash">× python setup.py egg_info did not run successfully.<br>│ <span class="hljs-built_in">exit</span> code: 1<br>╰─&gt; [13 lines of output]<br>    Traceback (most recent call last):<br>      File <span class="hljs-string">&quot;&lt;string&gt;&quot;</span>, line 2, <span class="hljs-keyword">in</span> &lt;module&gt;<br>      File <span class="hljs-string">&quot;&lt;pip-setuptools-caller&gt;&quot;</span>, line 34, <span class="hljs-keyword">in</span> &lt;module&gt;<br>      File <span class="hljs-string">&quot;/tmp/pip-install-2fg0sy0m/flash-attn_c0c61b96808f437eab0096f319bdd46e/setup.py&quot;</span>, line 105, <span class="hljs-keyword">in</span> &lt;module&gt;<br>        raise_if_cuda_home_none(<span class="hljs-string">&quot;flash_attn&quot;</span>)<br>      File <span class="hljs-string">&quot;/tmp/pip-install-2fg0sy0m/flash-attn_c0c61b96808f437eab0096f319bdd46e/setup.py&quot;</span>, line 55, <span class="hljs-keyword">in</span> raise_if_cuda_home_none<br>        raise RuntimeError(<br>    RuntimeError: flash_attn was requested, but nvcc was not found.  Are you sure your environment has nvcc available?  If you<span class="hljs-string">&#x27;re installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain &#x27;</span>devel<span class="hljs-string">&#x27; will provide nvcc.</span><br></code></pre></td></tr></table></figure><p>可以看到，它尝试使用nvcc编译cuda程序，但是nvcc并没有找到。</p><p>遇到了不得不安装工具包的情况<br>还是跟着官网来<a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#wsl">cuda官方的wsl安装教程</a></p><figure class="highlight maxima"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs maxima">sudo apt-<span class="hljs-built_in">key</span> <span class="hljs-built_in">del</span> 7fa2af80<br><br></code></pre></td></tr></table></figure><p>从历史archive里找到对应版本的cuda，这里有几点注意事项，首先cuda版本不得高于你的显卡驱动支持的版本，其次，cuda的版本要和你的环境中安装的pytorch的cuda版本对应。注意要选择wsl版本的cuda，不要选择linux版本的cuda。<br>历史archive<a href="https://developer.nvidia.com/cuda-toolkit-archive">链接点击这里</a></p><p>以下是我的踩坑记录，可以不看（错在了版本不匹配，以及<em>官方的安装脚本有小问题</em>）。<br>    wget <a href="https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb">https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb</a><br>    sudo dpkg -i cuda-keyring_1.0-1_all.deb<br>    sudo apt-get update<br>    sudo apt-get -y install cuda</p><pre><code class="hljs">我的驱动支持到12.2，所以这一步我选了12.1版本，在线安装但是不知道怎么回事安装上的nvcc版本是12.3nvcc -V结果如下：nvcc: NVIDIA (R) Cuda compiler driverCopyright (c) 2005-2023 NVIDIA CorporationBuilt on Wed_Nov_22_10:17:15_PST_2023Cuda compilation tools, release 12.3, V12.3.107Build cuda_12.3.r12.3/compiler.33567101_0不过看起来能正常运行（编译flash-attn）不知道这个版本高低有没有影响，先用着吧实际上不能正常运行The detected CUDA version (12.3) mismatches the version that was used to compile    PyTorch (11.3). Please make sure to use the same CUDA versions.不得不卸载旧的cuda</code></pre><p><a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#handle-conflicting-installation-methods">卸载cuda</a></p><p>安装新的，要和torch的cuda版本对应</p><p>前几句脚本就是官方的命令，只不过在最后一句安装的时候，需要指定安装的版本</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><code class="hljs bash">wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin<br>sudo <span class="hljs-built_in">mv</span> cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600<br>wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-wsl-ubuntu-11-3-local_11.3.0-1_amd64.deb<br>sudo dpkg -i cuda-repo-wsl-ubuntu-11-3-local_11.3.0-1_amd64.deb<br>sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-3-<span class="hljs-built_in">local</span>/7fa2af80.pub<br>sudo apt-get update<br><span class="hljs-comment"># 官方的错误命令，执行了就会安装最新版本</span><br><span class="hljs-comment">#sudo apt-get -y install cuda #（不管用，版本错误的罪魁祸首）</span><br><span class="hljs-comment">#正确指令如下：</span><br>sudo apt-get install cuda-toolkit-11-3<br></code></pre></td></tr></table></figure><h5 id="重要经验教训"><a href="#重要经验教训" class="headerlink" title="重要经验教训"></a>重要经验教训</h5><p>-y不能随便运行</p><p>如果我没有随意执行-y，那么可能在一开始安装的时候就会发现版本不对，然后就不会有后面的一系列问题了</p><p>最后参考这个<a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#why-do-i-see-nvcc-no-such-file-or-directory-when-i-try-to-build-a-cuda-application">链接</a>，在终端中激活nvcc</p><h3 id="proxy部分（直接用win的代理）"><a href="#proxy部分（直接用win的代理）" class="headerlink" title="proxy部分（直接用win的代理）"></a>proxy部分（直接用win的代理）</h3><p><a href="https://zhuanlan.zhihu.com/p/640242841">https://zhuanlan.zhihu.com/p/640242841</a><br>按照这个配置客户端<br><a href="https://zhuanlan.zhihu.com/p/153124468">https://zhuanlan.zhihu.com/p/153124468</a><br>按照这个配置代理，记得放开防火墙，我用的是xray内核，所以选的xray </p><p>网络的官方说明：<a href="https://learn.microsoft.com/zh-cn/windows/wsl/networking">https://learn.microsoft.com/zh-cn/windows/wsl/networking</a></p><p>里面提到了自动代理功能，todo</p><p>配置之前</p><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs powershell">mayu@DESKTOP<span class="hljs-literal">-68DFFP1</span>:~<span class="hljs-variable">$</span> <span class="hljs-built_in">curl</span> google.com<br><span class="hljs-built_in">curl</span>: (<span class="hljs-number">56</span>) Recv failure: Connection reset by peer<br>mayu@DESKTOP<span class="hljs-literal">-68DFFP1</span>:~<span class="hljs-variable">$</span> <span class="hljs-built_in">curl</span> baidu.com<br>&lt;html&gt;<br>&lt;meta http<span class="hljs-literal">-equiv</span>=<span class="hljs-string">&quot;refresh&quot;</span> content=<span class="hljs-string">&quot;0;url=http://www.baidu.com/&quot;</span>&gt;<br>&lt;/html&gt;<br></code></pre></td></tr></table></figure><p>配置之后</p><figure class="highlight typescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><code class="hljs typescript"><span class="hljs-keyword">export</span> https_proxy=<span class="hljs-string">&quot;http://172.30.128.1:10809&quot;</span><br><span class="hljs-keyword">export</span> http_proxy=<span class="hljs-string">&quot;http://172.30.128.1:10809&quot;</span><br>mayu<span class="hljs-meta">@DESKTOP</span>-68<span class="hljs-attr">DFFP1</span>:~$ <span class="hljs-keyword">export</span> https_proxy=<span class="hljs-string">&quot;http://172.30.128.1:10809&quot;</span><br>mayu<span class="hljs-meta">@DESKTOP</span>-68<span class="hljs-attr">DFFP1</span>:~$ curl <span class="hljs-attr">https</span>:<span class="hljs-comment">//google.com</span><br><span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">HTML</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">HEAD</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">&quot;content-type&quot;</span> <span class="hljs-attr">content</span>=<span class="hljs-string">&quot;text/html;charset=utf-8&quot;</span>&gt;</span></span><br><span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">TITLE</span>&gt;</span>301 Moved<span class="hljs-tag">&lt;/<span class="hljs-name">TITLE</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">HEAD</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">BODY</span>&gt;</span></span><br><span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">H1</span>&gt;</span>301 Moved<span class="hljs-tag">&lt;/<span class="hljs-name">H1</span>&gt;</span></span><br><span class="language-xml">The document has moved</span><br><span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">A</span> <span class="hljs-attr">HREF</span>=<span class="hljs-string">&quot;https://www.google.com/&quot;</span>&gt;</span>here<span class="hljs-tag">&lt;/<span class="hljs-name">A</span>&gt;</span>.</span><br><span class="language-xml"><span class="hljs-tag">&lt;/<span class="hljs-name">BODY</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">HTML</span>&gt;</span></span><br></code></pre></td></tr></table></figure><p>todo写bashrc云云</p><h3 id="访问win文件"><a href="#访问win文件" class="headerlink" title="访问win文件"></a>访问win文件</h3><p>在&#x2F;mnt&#x2F;e等<br>如果想从 WSL 发行版命令行访问 Windows 文件目录，而不是使用 C:\Users\username，则需使用 &#x2F;mnt&#x2F;c&#x2F;Users&#x2F;username 访问该目录，因为 Linux 发行版将 Windows 文件系统视为已装载的驱动器。</p><p>打开win中的vscode:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">code .<br></code></pre></td></tr></table></figure><h3 id="安装anaconda和torch"><a href="#安装anaconda和torch" class="headerlink" title="安装anaconda和torch"></a>安装anaconda和torch</h3><p>更新软件源</p><p>正常按照anaconda安装<br><a href="https://zhuanlan.zhihu.com/p/166102942">https://zhuanlan.zhihu.com/p/166102942</a><br>这个写的很好</p><p>新建环境<br>conda create -n name python&#x3D;3.9<br>然后直接pip install 对应版本的torch<br>pip install torch&#x3D;&#x3D;1.10.0+cu111 torchvision&#x3D;&#x3D;0.11.0+cu111 torchaudio&#x3D;&#x3D;0.10.0 -f <a href="https://download.pytorch.org/whl/torch_stable.html">https://download.pytorch.org/whl/torch_stable.html</a><br>网速感人(终端甚至没挂代理，安装anaconda重启后忘记配了）<br>更正，只有pytorch速度够，剩下的就几k每秒<br>挂上代理就快了</p><h3 id="多显卡"><a href="#多显卡" class="headerlink" title="多显卡"></a>多显卡</h3><p>网上说还不支持多显卡：<br><a href="https://blog.csdn.net/yul13579/article/details/134280724">https://blog.csdn.net/yul13579/article/details/134280724</a></p><p>但经过我的实测，不需要任何额外配置就可以调用两张魔改版本的2080ti（两张一模一样的卡）</p><h3 id="未来可能的参考"><a href="#未来可能的参考" class="headerlink" title="未来可能的参考"></a>未来可能的参考</h3><h4 id="迁移wsl"><a href="#迁移wsl" class="headerlink" title="迁移wsl"></a>迁移wsl</h4><p><a href="https://zhuanlan.zhihu.com/p/621873601">https://zhuanlan.zhihu.com/p/621873601</a></p><h1 id="后记"><a href="#后记" class="headerlink" title="后记"></a>后记</h1><p>这次安装工作步骤我均严格参考各个官方文档，仍然踩了不少的坑，但总比直接无脑copy网上的教程强。</p><p>我也不希望后人直接照抄我这篇博客，因为时代在发展，代码在变化。博客仅供参看流程和思想实验</p><p>在此隆重附上一切的一切的开始，也就是微软官方的wsl安装<a href="https://learn.microsoft.com/zh-cn/windows/wsl/install">教程(点击这里)</a></p><p>希望你的wsl之旅顺利。</p><h2 id="参考的过时博客，用来思想实验"><a href="#参考的过时博客，用来思想实验" class="headerlink" title="参考的过时博客，用来思想实验"></a>参考的过时博客，用来思想实验</h2><p>列举几个示众<br><a href="https://blog.csdn.net/iwanvan/article/details/122119595">https://blog.csdn.net/iwanvan/article/details/122119595</a></p><p><a href="https://zhuanlan.zhihu.com/p/515621724#%E5%AE%89%E8%A3%85wsl2">https://zhuanlan.zhihu.com/p/515621724#%E5%AE%89%E8%A3%85wsl2</a></p><p><a href="https://zhuanlan.zhihu.com/p/506477744">https://zhuanlan.zhihu.com/p/506477744</a></p>]]></content>
    
    
    <summary type="html">给windows安装wsl2，并且全套配置好开发环境，anaconda, cuda, 代理等</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="wsl2" scheme="http://blog.1314171.xyz/tags/wsl2/"/>
    
  </entry>
  
  <entry>
    <title>在Linux上使用v2raya代理</title>
    <link href="http://blog.1314171.xyz/post/231222linuxv2raya.html"/>
    <id>http://blog.1314171.xyz/post/231222linuxv2raya.html</id>
    <published>2024-01-31T14:01:59.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="2024-07-27更新"><a href="#2024-07-27更新" class="headerlink" title="2024-07-27更新"></a>2024-07-27更新</h1><p>最近因为各种服务器都需要连网，因此自己写了一个可以在短期内很好的遵循的指导（tutorial）来配置v2raya代理，欢迎大家试用。debian系如Ubuntu，raspbian等都可以使用。</p><p>项目链接:<a href="https://github.com/TT2TER/autodl_proxy">一个简易的不自动化的autodl部署自己的代理的指南，帮助下载huggingface的模型</a></p><h1 id="在windows上使用v2rayn代理即可"><a href="#在windows上使用v2rayn代理即可" class="headerlink" title="在windows上使用v2rayn代理即可"></a>在windows上使用v2rayn代理即可</h1><h1 id="在Linux上使用v2raya代理"><a href="#在Linux上使用v2raya代理" class="headerlink" title="在Linux上使用v2raya代理"></a>在Linux上使用v2raya代理</h1><blockquote><p>以Ubuntu为例（大家都喜欢！</p></blockquote><h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><p><a href="https://v2raya.org/docs/prologue/installation/debian/">安装v2raya</a></p><p>两种办法，一种是deb包，一种是直接apt下载，这两种方法都亲测可用</p><p>dab包可以留下来以供未来需要</p><p>官方说的很清楚</p><p>之前安装时尝试未成功应该是因为clash在运行而且我的clash被我调的占用了10809端口</p><p>以下是官方文档的备份，用不用安装xray根据自己机场的协议情况来</p><h3 id="方法一：通过软件源安装"><a href="#方法一：通过软件源安装" class="headerlink" title="方法一：通过软件源安装"></a>方法一：通过软件源安装</h3><h4 id="添加公钥"><a href="#添加公钥" class="headerlink" title="添加公钥"></a>添加公钥</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo <span class="hljs-built_in">tee</span> /etc/apt/keyrings/v2raya.asc<br></code></pre></td></tr></table></figure><h4 id="添加-V2RayA-软件源"><a href="#添加-V2RayA-软件源" class="headerlink" title="添加 V2RayA 软件源"></a>添加 V2RayA 软件源</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;deb [signed-by=/etc/apt/keyrings/v2raya.asc] https://apt.v2raya.org/ v2raya main&quot;</span> | sudo <span class="hljs-built_in">tee</span> /etc/apt/sources.list.d/v2raya.list<br>sudo apt update<br></code></pre></td></tr></table></figure><h4 id="安装-V2RayA"><a href="#安装-V2RayA" class="headerlink" title="安装 V2RayA"></a>安装 V2RayA</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo apt install v2raya v2ray <span class="hljs-comment">## 也可以使用 xray 包</span><br></code></pre></td></tr></table></figure><h3 id="方法二：手动安装-deb-包"><a href="#方法二：手动安装-deb-包" class="headerlink" title="方法二：手动安装 deb 包"></a>方法二：手动安装 deb 包</h3><p><a href="https://github.com/v2rayA/v2rayA/releases">从 Release 下载 v2rayA 的 deb 包</a>后可以使用 Gdebi、QApt 等图形化工具来安装，也可以使用命令行：</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo apt install /path/download/installer_debian_xxx_vxxx.deb <span class="hljs-comment">### 自行替换 deb 包所在的实际路径</span><br></code></pre></td></tr></table></figure><p>V2Ray &#x2F; Xray 的 deb 包可以在 <a href="https://github.com/v2rayA/v2raya-apt/tree/master/pool/main/">APT 软件源中</a>找到。</p><h2 id="启动-v2rayA-设置-v2rayA-自动启动"><a href="#启动-v2rayA-设置-v2rayA-自动启动" class="headerlink" title="启动 v2rayA &#x2F; 设置 v2rayA 自动启动"></a>启动 v2rayA &#x2F; 设置 v2rayA 自动启动</h2><blockquote><p>从 1.5 版开始将不再默认为用户启动 v2rayA 及设置开机自动。</p></blockquote><ul><li><p>启动 v2rayA</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl start v2raya.service<br></code></pre></td></tr></table></figure></li><li><p>设置开机自动启动</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">sudo systemctl <span class="hljs-built_in">enable</span> v2raya.service<br></code></pre></td></tr></table></figure></li><li><p>好像不用systemctl启动也行，直接运行v2raya就行</p>  <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">v2raya<br></code></pre></td></tr></table></figure></li></ul><h2 id="使用方法"><a href="#使用方法" class="headerlink" title="使用方法"></a>使用方法</h2><p>没啥大问题，摸索以下就行了</p>]]></content>
    
    
    <summary type="html">鉴于clash的作者已经不再维护clash，而且最近在用很多国内的linux服务器跑代码，所以就想着在linux上使用v2raya代理</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="proxy" scheme="http://blog.1314171.xyz/tags/proxy/"/>
    
    <category term="v2raya" scheme="http://blog.1314171.xyz/tags/v2raya/"/>
    
  </entry>
  
  <entry>
    <title>大三前三周（小学期）周报</title>
    <link href="http://blog.1314171.xyz/post/230908dockerproxywithclash.html"/>
    <id>http://blog.1314171.xyz/post/230908dockerproxywithclash.html</id>
    <published>2023-09-21T11:35:11.000Z</published>
    <updated>2025-09-01T13:35:59.375Z</updated>
    
    <content type="html"><![CDATA[<h1 id="大三第一二周周报"><a href="#大三第一二周周报" class="headerlink" title="大三第一二周周报"></a>大三第一二周周报</h1><p>总之这两周就是疯狂敲代码</p><p>写了一个即时通讯软件，代码见<a href="https://github.com/TT2TER/Echoplex">github</a></p><p>最大的感想就是前后端的配合如果没有提前沟通好接口，那就是灾难</p><p>我在项目中全权负责Qt界面，同时因为需要和客户端配合，所以也参与了客户端的一些开发，尤其是接口部分。</p><p>由于大家都是第一次写程序，所以有很多地方都没有提前预估好，比如在实现文件发送功能的时候，接口消息格式不是很全，导致界面没法按照<br>预想显示进度条和消息，这本来是一个很好解决的问题，但当时大家都很着急，于是几乎重写了整个消息头的参数（虽然改起来很好改，但是还是很麻烦）</p><p>Qt界面其实很简单，但是美化我一直没有涉猎到精髓，感觉这一块确实还可以继续探索，消息框和聊天气泡都是扁平化的风格，其他按键不是很完美。</p><p>就这样吧，没什么别的事情了</p><h1 id="大三第三周周报"><a href="#大三第三周周报" class="headerlink" title="大三第三周周报"></a>大三第三周周报</h1><p>第三周是并行编程，还可以，事情不多，于是就有时间折腾点其他的……</p><h2 id="Docker摸索，为nas配一个clash代理"><a href="#Docker摸索，为nas配一个clash代理" class="headerlink" title="Docker摸索，为nas配一个clash代理"></a>Docker摸索，为nas配一个clash代理</h2><h3 id="先说起因"><a href="#先说起因" class="headerlink" title="先说起因"></a>先说起因</h3><ul><li><p>上课发现自己的图床服务器忘了续费已经停机了，匆匆忙忙续费。6欧每年真的实惠，还好数据什么的服务商还都给保留着，要不然真的是鸡飞狗跳的一天了</p><ul><li>这里给自己加个todo，服务器只有10G空间，现在用了5G了，图床虽然占不了很大空间，但如果以后要换服务商，暂时还没有学习如何迁移图床，另外可能的话数据放nas上是最好的。</li></ul></li><li><p>然后突然想起来之前自己想selfhost一个类似<a href="https://getpocket.com/home">pocket</a>的稍后阅读书签和浏览器快照存档的东西。这个在 <li><a href="/post/2023week1"  tags="">第一周周报</li> </p></li><li><p>中提到过。既然恰好没啥事情，就搭建一个吧</p></li><li><p>然后在当时找到的四个比较符合要求的里面找了一个ui最好看的（这里巨大伏笔，小丑的源头</p></li></ul><h3 id="我看上了linkwarden"><a href="#我看上了linkwarden" class="headerlink" title="我看上了linkwarden"></a>我看上了linkwarden</h3><p>先放链接：<a href="https://github.com/Daniel31x13/linkwarden">linkwarden</a></p><h4 id="build无法连接网路"><a href="#build无法连接网路" class="headerlink" title="build无法连接网路"></a>build无法连接网路</h4><p>当时首先的想法是在nas上部署这个服务，从文档看，需要自己在本地从Dockerfile开始build主程序，同时dockerhub上别人构建好的也没说怎么用（当然现在我会用了）。nas被阉割了git，所以将文件拷贝到nas上，正常使用docker-compose up来运行，发现卡死在了</p><figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs Dockerfile"><span class="hljs-keyword">RUN</span><span class="language-bash"> yarn</span><br></code></pre></td></tr></table></figure><p>这一步，报错内容是</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs bash">=&gt; =&gt; <span class="hljs-comment"># yarn install v1.22.19                                                  </span><br>=&gt; =&gt; <span class="hljs-comment"># [1/4] Resolving packages...                                            </span><br>=&gt; =&gt; <span class="hljs-comment"># [2/4] Fetching packages... </span><br></code></pre></td></tr></table></figure><p>总之是因为网路问题导致无法连接下载所需要的node包吧，当时我的nas是没代理的，我寻思着，那就去在我电脑ubuntu双系统中去build完再想办法传给nas运行呗</p><h4 id="Ubuntu也不能连接网路"><a href="#Ubuntu也不能连接网路" class="headerlink" title="Ubuntu也不能连接网路"></a>Ubuntu也不能连接网路</h4><p>双系统没有安装docker，重新装，还是没用搭理docker desktop，直接装engin。</p><ul><li>题外话：在装compose的时候发现，现在已经不建议单独安装docker-compose了。也就是说docker-compose命令将成为过去时，以后会被plugin版本的docker compose完全替代</li></ul><p>笑死，也连不上网是显而易见的，肉身在哪，网就在哪。</p><p>但能够尝试配置代理</p><p>这个坑尝试填了一下，把新下的docker的配置文件整的千疮百孔（不是）依旧卡在那一步。（现在来看应该只需要仔细阅读文档然后配置好build步骤的代理就行了，TODO:</p><p>当时没整成，又尝试去改Dockerfile文件里的命令，FROM RUN CMD啥的都了解了一下，在这里尝试加代理的环境变量，尝试给yarn换国内镜像源，无解（也许是因为docker千疮百孔了。</p><h4 id="退一步，也没有海阔天空"><a href="#退一步，也没有海阔天空" class="headerlink" title="退一步，也没有海阔天空"></a>退一步，也没有海阔天空</h4><p>既然是国内网络问题，那就用vps build，然后……卡在了更早的一步，还不如本地跑的进度好，我也懒得去解决依赖的问题。</p><p>转头又去dockerhub上认真看了看其他人构建好的镜像，发现有个国人<a href="https://laosu.cf/">老苏</a>十几天前构建的镜像虽然还没介绍怎么用，但也写明白了镜像构建过程，可以直接拿来用的单独的image…(只可惜一开始我既不懂docker build命令，也不懂docker image 和layer 以及stack的关系，反正就是之前不会用人家构建好的镜像)，但在这个时间点折腾过之前的东西之后我才能看明白，也才有机会自己写compose配置</p><p>镜像链接:<a href="https://registry.hub.docker.com/r/wbsu2003/linkwarden">wbsu2003&#x2F;linkwarden</a><br>其中详细记述了构建过程</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 下载代码</span><br>git <span class="hljs-built_in">clone</span> https://github.com/linkwarden/linkwarden.git<br><br><span class="hljs-comment"># 或者加个代理</span><br>git <span class="hljs-built_in">clone</span> https://ghproxy.com/github.com/linkwarden/linkwarden.git<br><br><span class="hljs-comment"># 进入目录  </span><br><span class="hljs-built_in">cd</span> linkwarden<br><br><span class="hljs-comment"># 构建镜像</span><br>docker build -t wbsu2003/linkwarden:v1 .<br></code></pre></td></tr></table></figure><h4 id="跑起来程序之后，才后知后觉意识到docker里面依旧访问不了外网"><a href="#跑起来程序之后，才后知后觉意识到docker里面依旧访问不了外网" class="headerlink" title="跑起来程序之后，才后知后觉意识到docker里面依旧访问不了外网"></a>跑起来程序之后，才后知后觉意识到docker里面依旧访问不了外网</h4><p>自己写照着文档写docker-compose.yml，配合上数据库，在双系统ubuntu跑起来了</p><p>发现只能快照百度等国内网站，不能对google，github等不存在的网站进行快照</p><p>在此前已经见识过代理配置的复杂，更何况最后这个项目不能部署在笔记本上，要不就是nas，要不就是vps</p><p>于是转战vps</p><h4 id="vps一点空间没有"><a href="#vps一点空间没有" class="headerlink" title="vps一点空间没有"></a>vps一点空间没有</h4><p>这个逆天玩意儿build完的镜像加起来有2个多g，之前提到的剩余空间已经不够了</p><p>不够先pull下压缩包再解压的空间，于是在vps上构建的这条路走不通了</p><h3 id="看向定制系统的nas，硬着头皮去解决在docker里面弄一个clash以及其他docker链接这个clash"><a href="#看向定制系统的nas，硬着头皮去解决在docker里面弄一个clash以及其他docker链接这个clash" class="headerlink" title="看向定制系统的nas，硬着头皮去解决在docker里面弄一个clash以及其他docker链接这个clash"></a>看向定制系统的nas，硬着头皮去解决在docker里面弄一个clash以及其他docker链接这个clash</h3><p>现在看在解决这个问题的时候，很多疑惑都受限于自己本身的能力限制理解不了报错，找不到问题原因，筛选不出正确的解决办法。</p><p>如果我对操作系统或计算机网络有更深的理解，可能问题会少很多。</p><p>在和Google以及gpt的激情交流下，我最后终于让服务在nas上跑起来了</p><h4 id="先跑clash"><a href="#先跑clash" class="headerlink" title="先跑clash"></a>先跑clash</h4><p>用的是dreamacro&#x2F;clash:latest镜像</p><p>要把7890-7891代理的端口和9090ui面板的端口分别绑定到主机(如果不需要宿主机访问clash，就不用绑定代理的端口)</p><p>将配置文件绑定到&#x2F;root&#x2F;.config&#x2F;clash&#x2F;config.yaml，配置文件从电脑拷贝就行，奇怪的是我直接拷贝的文件clash不识别，但是我打开配置全选拷贝内容就可以</p><p>这一步参考的一些教程<br><a href="https://fugary.com/?p=363">参考1</a><br><a href="http://www.qince.net/dockery7t0.html">参考2</a></p><p>然后用nas自己的代理，设置到绑定的clash的端口，在nas终端中运行wget google.com，成功！说明clash在nas里跑起来了</p><h4 id="得让容器之间互相通信"><a href="#得让容器之间互相通信" class="headerlink" title="得让容器之间互相通信"></a>得让容器之间互相通信</h4><p>凭借着前世对docker网络的一点点理解，我知道在同一个network下docker自动有一个类似dns的东西能直接将容器名解析为容器在network下的地址</p><p>所以大概的思路就出来了</p><p>即，让linkwarden，数据库，clash写在同一个docker-compose文件中</p><p>中间疑惑了半天代理应该怎么配置，如果之前对环境变量的理解深一点，就不会像现在这样狼狈</p><p>先贴上最后的docker-compose文件吧</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">&quot;3.5&quot;</span><br><span class="hljs-attr">networks:</span><br>  <span class="hljs-attr">my_network:</span><br>    <span class="hljs-attr">driver:</span> <span class="hljs-string">bridge</span><br><br><span class="hljs-attr">services:</span><br>  <span class="hljs-attr">postgres:</span><br>    <span class="hljs-attr">image:</span> <span class="hljs-string">postgres</span><br>    <span class="hljs-attr">env_file:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">.env</span><br>    <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br>    <span class="hljs-attr">networks:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">my_network</span><br>    <span class="hljs-attr">volumes:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">./postgres:/var/lib/postgresql/data</span><br><br>  <span class="hljs-attr">linkwarden:</span><br>    <span class="hljs-attr">image:</span> <span class="hljs-string">wbsu2003/linkwarden:latest</span><br>    <span class="hljs-attr">env_file:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">.env</span><br>    <span class="hljs-attr">environment:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">DATABASE_URL=postgresql://postgres:$&#123;POSTGRES_PASSWORD&#125;@postgres:5432/postgres</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">http_proxy=http://clash_linkwarden:7890</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">https_proxy=http://clash_linkwarden:7890</span><br>    <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br>    <span class="hljs-attr">ports:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-number">0000</span><span class="hljs-string">:3000</span><br>    <span class="hljs-attr">volumes:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">/your_path/data:/data/data</span><br>    <span class="hljs-attr">depends_on:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">postgres</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">clash_linkwarden</span><br>    <span class="hljs-attr">networks:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">my_network</span><br>    <span class="hljs-attr">dns:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-number">8.8</span><span class="hljs-number">.8</span><span class="hljs-number">.8</span><br><br>  <span class="hljs-attr">clash_linkwarden:</span><br>    <span class="hljs-attr">image:</span> <span class="hljs-string">dreamacro/clash:latest</span><br>    <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br>    <span class="hljs-attr">ports:</span> <br>      <span class="hljs-bullet">-</span> <span class="hljs-number">0000</span><span class="hljs-string">:7890</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-number">0000</span><span class="hljs-string">:7891</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-number">0000</span><span class="hljs-string">:9090</span><br>    <span class="hljs-attr">volumes:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">/your_path/clash/config.yaml:/root/.config/clash/config.yaml</span><br>    <span class="hljs-attr">networks:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-string">my_network</span><br>    <span class="hljs-attr">dns:</span><br>      <span class="hljs-bullet">-</span> <span class="hljs-number">8.8</span><span class="hljs-number">.8</span><span class="hljs-number">.8</span> <br></code></pre></td></tr></table></figure><p>其中$.env$里放的是linkwarden官方要求的一些环境变量，放在和compose.yml同目录下</p><p>说一下里面的一些坑和仍未解决的问题吧</p><ol><li>network自己新建，也可以不，compose会自动为里面的所有应用新建一个network</li><li>$- http_proxy&#x3D;<a href="http://clash_linkwarden:7890/">http://clash_linkwarden:7890</a> - https_proxy&#x3D;<a href="http://clash_linkwarden:7890$">http://clash_linkwarden:7890$</a> 这两句环境变量，用名称clash_linkwarden直接找到clash，此外，端口用clash原本的端口，而不是绑定之后的主机的端口，因为在这个网域下，其他容器对clash访问是直接的。同时，要用$http_proxy$和$https_proxy$而不是$HTTP_PROXY$和$HTTPS_PROXY$,这里environment:里的环境变量，就是容器中env命令显示出来的环境变量。</li></ol><p>未解决的问题：</p><ol><li>clash每次启动都需要设置allow lan?不确定，还没测试。如果需要好像得写在comfig.yaml里</li><li>某些链接会出现以下报错<code>TypeError: fetch failed  at Object.fetch (node:internal/deps/undici/undici:11576:11)  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)  at async imageOptimizer (/data/node_modules/next/dist/server/image-optimizer.js:521:29)  at async cacheEntry.imageResponseCache.get.incrementalCache (/data/node_modules/next/dist/server/next-server.js:414:72)  at async /data/node_modules/next/dist/server/response-cache/index.js:99:36 &#123;  cause: ConnectTimeoutError: Connect Timeout Error at onConnectTimeout (node:internal/deps/undici/undici:8522:28) at node:internal/deps/undici/undici:8480:50 at Immediate._onImmediate (node:internal/deps/undici/undici:8511:13) at process.processImmediate (node:internal/timers:478:21) &#123;  code: &#39;UND_ERR_CONNECT_TIMEOUT&#39;  &#125;   &#125;</code></li><li>一些复杂域名好像没法解析，比如像github某个仓库的一个界面。这里我尝试 配置了dns地址，但没有用，应该是2.这里的同源问题</li><li>跨network域访问docker中clash，以解决现在把docker莫名的放在了其他服务的compose里，而且这种解决办法以后每次有应用需要代理，就得新启动一个clash docker，多少有点离谱</li></ol><p>此外就是一些小细节</p><ol><li>ui的界面可以使用公共的<a href="http://yacd.haishan.me/">http://yacd.haishan.me</a>，填写你的域名以及绑定在9090的实际的端口，在上面的例子里就是0000（笑死，上面所有0000都要替换一个空的端口。</li><li>不知道为什么nas配置了代理之后上面ui界面等就会都走代理，而不是直接访问nas，因此这一块还得再研究怎么不冲突（其实nas暂时还没有用代理的需求，软件都是docker部署的。</li><li>此外就是可以不用端口转发绑定ipv6的外网访问，可以用</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">socat TCP6-LISTEN:0000,ipv6-v6only=1,reuseaddr,fork TCP4:127.0.0.1:0000<br></code></pre></td></tr></table></figure><p>但这个只能在当前窗口启动时使用，解决以及开机自启动详见：</p><li><a href="/post/220705tcp6-tcp4"  tags="">IPV6访问NAS中Docker的服务</li> <h2 id="copilot搭配vscode"><a href="#copilot搭配vscode" class="headerlink" title="copilot搭配vscode"></a>copilot搭配vscode</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs css"><span class="hljs-selector-attr">[ERROR]</span> <span class="hljs-selector-attr">[default]</span> <span class="hljs-selector-attr">[2023-09-10T09:55:28.610Z]</span> GitHub Copilot could not connect <span class="hljs-selector-tag">to</span> server. Extension <span class="hljs-selector-tag">a</span>……<br></code></pre></td></tr></table></figure><p>配置代理就好了<br><a href="https://docs.github.com/zh/copilot/configuring-github-copilot/configuring-network-settings-for-github-copilot">https://docs.github.com/zh/copilot/configuring-github-copilot/configuring-network-settings-for-github-copilot</a></p>]]></content>
    
    
    <summary type="html">记述一下小学期的代码实践，记录一下一次长达一天的docker代理相关的摸索</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/Diary/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
    <category term="proxy" scheme="http://blog.1314171.xyz/tags/proxy/"/>
    
    <category term="clash" scheme="http://blog.1314171.xyz/tags/clash/"/>
    
    <category term="Docker" scheme="http://blog.1314171.xyz/tags/Docker/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 8</title>
    <link href="http://blog.1314171.xyz/post/2023week8.html"/>
    <id>http://blog.1314171.xyz/post/2023week8.html</id>
    <published>2023-04-22T10:45:35.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="这周周末活动多，导致没来得及写周报，现在才补上"><a href="#这周周末活动多，导致没来得及写周报，现在才补上" class="headerlink" title="这周周末活动多，导致没来得及写周报，现在才补上"></a>这周周末活动多，导致没来得及写周报，现在才补上</h1><h1 id="先说说这周看到的有趣链接"><a href="#先说说这周看到的有趣链接" class="headerlink" title="先说说这周看到的有趣链接"></a>先说说这周看到的有趣链接</h1><ol><li><a href="https://www.phind.com/">一个转为developers打造的GPT搜索引擎</a></li></ol><p>给我的感觉是可以用，代码什么的可能比原本的好一点）可能就是提示词吧</p><p><a href="https://news.ycombinator.com/item?id=35543668">这是hackernews对它的讨论</a></p><ol start="2"><li><a href="https://github.com/chathub-dev/chathub">这是一个浏览器插件能时刻使用上bing</a></li></ol><p>我的bing也开始跳转国内了，这个插件还不错，能正确显示代码块</p><p>此外我很乐意展示我使用bing的一次示例，帮我完成课内代码：</p><h3 id="一次new逼使用纪实"><a href="#一次new逼使用纪实" class="headerlink" title="一次new逼使用纪实"></a>一次new逼使用纪实</h3><p><strong>user</strong>: can you read this code?</p><figure class="highlight plaintext"><figcaption><span>squares algorithm</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs %least">phiN = [y(3:1e6-1,1),y(2:1e6-2,1),y(1:1e6-3,1),u(3:1e6-1,1),u(2:1e6-2,1),u(1:1e6-3,1)];<br>yN = [y(4:1e6)];<br>disp(&quot;least squares algorithm&quot;);<br>theta = (phiN&#x27;*phiN)\phiN&#x27;*yN<br></code></pre></td></tr></table></figure><p><strong>bing</strong>: Yes, I can read this code. It is a MATLAB code that implements the least squares algorithm to estimate the parameters of a linear system. The code does the following steps:</p><ul><li>It defines a matrix phiN that contains the past values of the output y and the input u of the system. The matrix has 999997 rows and 6 columns.</li><li>It defines a vector yN that contains the current values of the output y of the system. The vector has 999997 elements.</li><li>It displays the message “least squares algorithm” on the screen.</li><li>It calculates the vector theta that contains the estimated parameters of the system. The vector has 6 elements. The calculation uses the formula theta &#x3D; (phiN’*phiN)\phiN’<em>yN, which is derived from minimizing the sum of squared errors between yN and phiN</em>theta.</li></ul><p><strong>user</strong>: please rewrite it by using Recursive Least-Squares Algorithm</p><p><strong>bing</strong>: [1]: <a href="https://www.mathworks.com/help/ident/ref/recursiveleastsquaresestimator.html">https://www.mathworks.com/help/ident/ref/recursiveleastsquaresestimator.html</a> “Estimate model coefficients using recursive least squares (RLS …”<br>[2]: <a href="https://www.mathworks.com/matlabcentral/fileexchange/56360-recursive-least-squares">https://www.mathworks.com/matlabcentral/fileexchange/56360-recursive-least-squares</a> “Recursive Least Squares - File Exchange - MATLAB Central - MathWorks”<br>[3]: <a href="http://freesourcecode.net/matlabprojects/59802/rls-matlab-code">http://freesourcecode.net/matlabprojects/59802/rls-matlab-code</a> “Rls Matlab Code | download free open source Matlab toolbox, matlab code …”<br>[4]: <a href="https://ai.stackexchange.com/questions/5715/can-we-use-the-recursive-least-squares-as-a-learning-algorithm-to-an-adaline">https://ai.stackexchange.com/questions/5715/can-we-use-the-recursive-least-squares-as-a-learning-algorithm-to-an-adaline</a> “Can we use the recursive least squares as a learning algorithm to an …”<br>[5]: <a href="https://www.eit.lth.se/fileadmin/eit/courses/ett042/CE/CE5e.pdf">https://www.eit.lth.se/fileadmin/eit/courses/ett042/CE/CE5e.pdf</a> “Computer exercise 5: Recursive Least Squares (RLS)”</p><p>The Recursive Least-Squares (RLS) algorithm is a method to estimate the parameters of a system that is linear in those parameters, by minimizing a weighted sum of squared errors. The RLS algorithm updates the parameter estimates recursively as new data arrives, and uses a forgetting factor to give less weight to old data.</p><p>To rewrite the code by using RLS algorithm, you can use the following steps:</p><ul><li>Define the forgetting factor lambda and the initial values of the parameter vector theta, the estimation error covariance matrix P, and the regressor vector phi.</li><li>Initialize a loop to iterate over the data points from 4 to 1e6.</li><li>Update phi with the current values of y and u.</li><li>Update theta and P using the RLS formulae.</li><li>End the loop.</li></ul><p>The rewritten code is:</p><figure class="highlight matlab"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><code class="hljs matlab"><span class="hljs-comment">% Recursive Least-Squares algorithm</span><br>lambda = <span class="hljs-number">0.99</span>; <span class="hljs-comment">% forgetting factor</span><br>theta = <span class="hljs-built_in">zeros</span>(<span class="hljs-number">6</span>,<span class="hljs-number">1</span>); <span class="hljs-comment">% initial parameter vector</span><br>P = <span class="hljs-built_in">eye</span>(<span class="hljs-number">6</span>); <span class="hljs-comment">% initial error covariance matrix</span><br>phi = <span class="hljs-built_in">zeros</span>(<span class="hljs-number">6</span>,<span class="hljs-number">1</span>); <span class="hljs-comment">% initial regressor vector</span><br><span class="hljs-keyword">for</span> k = <span class="hljs-number">4</span>:<span class="hljs-number">1e6</span><br>    phi = [y(k<span class="hljs-number">-1</span>); y(k<span class="hljs-number">-2</span>); y(k<span class="hljs-number">-3</span>); u(k<span class="hljs-number">-1</span>); u(k<span class="hljs-number">-2</span>); u(k<span class="hljs-number">-3</span>)]; <span class="hljs-comment">% update regressor vector</span><br>    g = P*phi/(lambda + phi&#x27;*P*phi); <span class="hljs-comment">% gain vector</span><br>    theta = theta + g*(y(k) - phi&#x27;*theta); <span class="hljs-comment">% update parameter vector</span><br>    P = (P - g*phi&#x27;*P)/lambda; <span class="hljs-comment">% update error covariance matrix</span><br><span class="hljs-keyword">end</span><br><span class="hljs-built_in">disp</span>(<span class="hljs-string">&#x27;Recursive Least-Squares algorithm&#x27;</span>);<br>theta <span class="hljs-comment">% display final parameter vector</span><br></code></pre></td></tr></table></figure><p><strong>user</strong>: could give me a RLS code without forgetting factor lambda</p><p><strong>bing</strong>: [1]: <a href="https://bing.com/search?q=matlab+rls+without+forgetting+factor">https://bing.com/search?q=matlab+rls+without+forgetting+factor</a> “Compute forgetting factor required for streaming input data - MATLAB …”<br>[2]: <a href="https://www.mathworks.com/help/dsp/ref/rlsfilter.html">https://www.mathworks.com/help/dsp/ref/rlsfilter.html</a> “Compute filtered output, filter error, and filter weights for given …”<br>[3]: <a href="https://www.mathworks.com/help/fixedpoint/ref/fixed.forgettingfactor.html">https://www.mathworks.com/help/fixedpoint/ref/fixed.forgettingfactor.html</a> “Compute forgetting factor required for streaming input data - MATLAB …”<br>[4]: <a href="https://www.researchgate.net/publication/251910252_A_variable_forgetting_factor_RLS_adaptive_filtering_algorithm">https://www.researchgate.net/publication/251910252_A_variable_forgetting_factor_RLS_adaptive_filtering_algorithm</a> “A variable forgetting factor RLS adaptive filtering algorithm”</p><p>To give a RLS code without forgetting factor lambda, you can simply set lambda to 1 in the previous code. This means that the algorithm does not forget any past data and gives equal weight to all data points. The code is:</p><figure class="highlight matlab"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><code class="hljs matlab"><span class="hljs-comment">% Recursive Least-Squares algorithm without forgetting factor</span><br>lambda = <span class="hljs-number">1</span>; <span class="hljs-comment">% no forgetting factor</span><br>theta = <span class="hljs-built_in">zeros</span>(<span class="hljs-number">6</span>,<span class="hljs-number">1</span>); <span class="hljs-comment">% initial parameter vector</span><br>P = <span class="hljs-built_in">eye</span>(<span class="hljs-number">6</span>); <span class="hljs-comment">% initial error covariance matrix</span><br>phi = <span class="hljs-built_in">zeros</span>(<span class="hljs-number">6</span>,<span class="hljs-number">1</span>); <span class="hljs-comment">% initial regressor vector</span><br><span class="hljs-keyword">for</span> k = <span class="hljs-number">4</span>:<span class="hljs-number">1e6</span><br>    phi = [y(k<span class="hljs-number">-1</span>); y(k<span class="hljs-number">-2</span>); y(k<span class="hljs-number">-3</span>); u(k<span class="hljs-number">-1</span>); u(k<span class="hljs-number">-2</span>); u(k<span class="hljs-number">-3</span>)]; <span class="hljs-comment">% update regressor vector</span><br>    g = P*phi/(lambda + phi&#x27;*P*phi); <span class="hljs-comment">% gain vector</span><br>    theta = theta + g*(y(k) - phi&#x27;*theta); <span class="hljs-comment">% update parameter vector</span><br>    P = (P - g*phi&#x27;*P)/lambda; <span class="hljs-comment">% update error covariance matrix</span><br><span class="hljs-keyword">end</span><br><span class="hljs-built_in">disp</span>(<span class="hljs-string">&#x27;Recursive Least-Squares algorithm without forgetting factor&#x27;</span>);<br>theta <span class="hljs-comment">% display final parameter vector</span><br></code></pre></td></tr></table></figure><ol start="3"><li>一些不知疲惫的“制作无限曲别针”的GPT</li></ol><p>2003年人类对强人工智能提出了一个<a href="https://www.douban.com/note/642211177/?from=tag_all&_i=21573201Oe3vhp">曲别针制造机假说</a>，提出制造曲别针这个无害的指令也会对人类造成不可挽回的后果。</p><p>最近有很多类似的项目出来了</p><p>最初的<a href="https://news.ycombinator.com/item?id=35506069">babyGPT</a><a href="https://github.com/yoheinakajima/babyagi">这里可能是对应代码，我没细看</a></p><p>然后出现了 <a href="https://github.com/Significant-Gravitas/Auto-GPT">autogpt</a></p><p>这个玩意儿短短几天就102kstar了，比比特币疯狂多了</p><p>他相当于第一次打开了制造曲别针的这个潘多拉魔盒</p><p>以及从autoGPT衍生出来的<a href="https://github.com/reworkd/AgentGPT">agentGPT,这是个网页版本，可以填上api直接跑，虽然效果很傻</a></p><ol start="4"><li><a href="https://www.cnblogs.com/softcorns/p/16369045.html">colab教程</a></li></ol><p>让我在使用colab上有迹可依</p><ol start="5"><li><p>因为睡午觉而错过了4月20号北京首钢主场球票开售的我，不得不经历一系列问题，于大麦网抢票打交道，因此萌生了做抢票脚本的想法。但是网上没有开源的东西，毕竟这种东西对黄牛来说违法又赚钱，只能自己想办法以后多学学了。</p></li><li><p>这个xqc让我短暂萌生了做tts的想法，后来调查了一下发现人家帮他做这个东西的粉丝是个真的大牛，遂感叹自己弱鸡</p></li></ol><iframe src="//player.bilibili.com/player.html?aid=269984325&bvid=BV1Xc411p7SE&cid=1093662519&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe><p><a href="https://www.bilibili.com/video/BV1Xc411p7SE/?share_source=copy_web&vd_source=42c6d53548a69758e45332a23b4e625b">视频链接，如果上面视频不能播放的话）</a></p><p><a href="https://twitter.com/RoaringIron">这里</a>是大牛的推特</p><h1 id="其他岁岁念"><a href="#其他岁岁念" class="headerlink" title="其他岁岁念"></a>其他岁岁念</h1><p>这是丰富的一周，周一去五棵松和周帆看血虐复仇吉林</p><p>周六又去新工体看国安三年来第一场比赛</p><p><img src="https://pic.1314171.xyz/i/2023/04/22/6331a4a16f12a82e5bc78a9a277ad6d.jpg"><br><img src="https://pic.1314171.xyz/i/2023/04/22/95be92db81147ab0d4c422f98f17af6.jpg"><br><img src="https://pic.1314171.xyz/i/2023/04/22/79d5c5fffabf5346cc90f7af4f923ab.jpg"><br><img src="https://pic.1314171.xyz/i/2023/04/22/99c5d92ae7c018a21ca8b1cdf08a8ca.jpg"><br><img src="https://pic.1314171.xyz/i/2023/04/22/a2c5ca46950075de5b7ea220476bc86.jpg"></p><p>可以看出来新工体相当的震撼</p><p><img src="https://pic.1314171.xyz/i/2023/04/22/21a4e1853b7cdf7569999e950d12d8d.jpg"><br>我在前排摇旗子，相当有面子</p><p>周中某个中午，我正在睡梦中，首钢放出了4月20日打辽宁的票，我错过了。（12点开票11点50发公告）</p><p>我经历了在众多翻倍三倍的黄牛中找到加价70的票，纸质票不发转电子票二手票不能进场，去工体路上为了更好网速专门出地铁抢黄牛的退票，在某个下午无意间看到球迷群中说放了一大波票有幸抢到这一离奇过程。</p><p>这之后我由衷的对票务代理和大麦网产生了抗拒情绪</p><p>也想自己试着整整抢票脚本）加油吧</p><p>周日又和同学一起去金海湖烧烤<br><img src="https://pic.1314171.xyz/i/2023/04/22/8f4ccf572a257ea0f6438d68b8f884b.jpg"><br><img src="https://pic.1314171.xyz/i/2023/04/22/6abf48e7590171cf7fe221b11e844e0.jpg"></p><h1 id="疫情放开后的日子确实过的滋润了"><a href="#疫情放开后的日子确实过的滋润了" class="headerlink" title="疫情放开后的日子确实过的滋润了"></a>疫情放开后的日子确实过的滋润了</h1>]]></content>
    
    
    <summary type="html">GPT, 看球， 抢票</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 7</title>
    <link href="http://blog.1314171.xyz/post/2023week7.html"/>
    <id>http://blog.1314171.xyz/post/2023week7.html</id>
    <published>2023-04-07T11:13:31.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="居然已经第七周学期过半了"><a href="#居然已经第七周学期过半了" class="headerlink" title="居然已经第七周学期过半了"></a>居然已经第七周学期过半了</h1><p>现在每周过的太快了，虽然每周都会出去转悠去玩，但是周中的课程日复一日，感觉上来讲周中什么特别的都没有。</p><p>但是没期中考试所以没有学期过半的危机感</p><h2 id="哦，其实周中过的还不错"><a href="#哦，其实周中过的还不错" class="headerlink" title="哦，其实周中过的还不错"></a>哦，其实周中过的还不错</h2><p>马里奥大电影在我看来是平均水准以上的好片（但陪我去的同学评价不高</p><h2 id="chatGPT大规模封号"><a href="#chatGPT大规模封号" class="headerlink" title="chatGPT大规模封号"></a>chatGPT大规模封号</h2><p>我的账号没能幸免，不过newbing已经能解决大部分问题了，所以，暂时没有再注册一个的需求。</p><p>使用的时候还是要注意稳定一下登陆的ip</p><h1 id="links"><a href="#links" class="headerlink" title="links"></a>links</h1><h2 id="杂"><a href="#杂" class="headerlink" title="杂"></a>杂</h2><ol><li><a href="https://english.elpais.com/science-tech/2023-01-10/if-parrots-can-talk-why-cant-monkeys.html">鹦鹉比猩猩牛在哪？</a></li></ol><blockquote><p>这篇文章讲了人能说话的决定性因素是神经控制</p></blockquote><ol start="2"><li><a href="https://einverne.github.io/post/2023/04/why-we-sleep-notes.html#%E5%90%AF%E5%8F%91%E6%88%96%E6%83%B3%E6%B3%95">《我们为什么要睡觉》读书笔记 </a></li></ol><blockquote><p>感觉互联网上的主流对睡眠的说法是从这本书出来的</p></blockquote><blockquote><p>周三晚上躺床上好久没睡着，感觉是一种认为自己睡不着的状态。最后睡着了大概是脑子累了</p></blockquote><ol start="3"><li><a href="https://www.bilibili.com/video/BV1Yo4y1W7Yc/?buvid=XX3154F3AD73907271B038E44105213DE6445&is_story_h5=false&mid=anhNAo1ifRpxkYRm1vfRBQ==&p=1&plat_id=116&share_from=ugc&share_medium=android&share_plat=android&share_session_id=08e6087d-3c92-4236-a843-24fdd694f0a9&share_source=COPY&share_tag=s_i&timestamp=1680424967&unique_k=3A8zcpG&up_id=11836186&vd_source=a778efc7f877dcbdee2bfd2ed7b4af49">取消文化</a></li></ol><iframe src="//player.bilibili.com/player.html?aid=396852210&bvid=BV1Yo4y1W7Yc&cid=1077188119&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe><blockquote><p>想起娱乐圈了，或者说互联网时代这种“取消”变得普遍且影响深远了。很多媒体资源是能够通过互联网及时获取的（并且缓存是临时的），导致如果在信息提供出对其进行阻断，那么你就再也不能获得该信息。</p></blockquote><blockquote><p>在过去信息的传播是通过纸质媒介，光盘，磁带。信息最终分发保留在每个信息的尽头。甚至图书馆也做不到立刻下架所有需要“取消”的内容。互联网不同，一行代码解决一切（没准GPT能独立做到60%）。</p></blockquote><blockquote><p>体现出来的是重要信息存档的重要意义。</p></blockquote><h3 id="关于你的大脑"><a href="#关于你的大脑" class="headerlink" title="关于你的大脑"></a>关于你的大脑</h3><ol start="4"><li><a href="https://www.quantamagazine.org/brains-speed-up-perception-by-guessing-whats-next-20190502/">Brains Speed Up Perception by Guessing What’s Next</a></li></ol><blockquote><p>文章中理论的部分没怎么看懂，但它的内容意味着：<strong>如果一个人能够更好的预测正确短期的未来会发生的事情，他的工作状态和结果会更加顺利。</strong></p></blockquote><blockquote><p>我想到了之前一直困扰我的几件事情，一件事情是<strong>如何明确理想让它成为一种低成本的内驱力</strong>，另一件事情是<strong>如何使用零散的时间完成一整个任务</strong>。我也许会在下周具体阐述这两个问题和我的思考）</p></blockquote><blockquote><p>先简单说，关于理想（或者说志向）不论是立大志还是赚大钱，对我来说都是比较缥缈的，身边有同学能够仅仅以这两种理想驱动来完成每天的工作并且能循环往复不需要用大众娱乐来调剂自己的精神（这种精神力量在我看来无疑是低成本的）。我是很羡慕的。第二个事情可以用这样一个场景描述：某个作业我预计要4小时写完，那么今天晚上9点下课到睡觉还有2-3小时可以自由支配的空间。本真的我会选择不去动这个作业，去干别的比如2-3小时能干完的工作或者干脆进行大众化娱乐。也就是说，我有的时间放不下整个工作的时候，我大概率会放弃在这段时间做它。这样的情况让我对零散时间，甚至是较短的整块时间的利用不是很高效。其中一个可能的原因是：干不完的工作需要在未来重启，而工作中一些新接触到的技术和概念会在中间空档期忘掉，导致重启的成本很高。当然，也许任务极端的碎片话，每次重启需要回顾的内容变短，而且对新东西的反复应用近似记忆曲线，那么可能问题就解决了。但稍后的一篇文章提到了重启的高昂成本。</p></blockquote><blockquote><p>这篇文章，对第一个问题，也许可以解释为什么理想不能很好的具象化并成为内驱力，因为大脑并不能预设一个明确的行为方向，加速外界的刺激（也就是改变局部的势平面”these dynamics to a ball moving through a landscape filled with troughs”，外界刺激更容易到局部最低点）。而短期的目标是可以被大脑预设出来的。当然，<strong>也许理想足够强大清晰时，我们应该可以让整个势平面整体倾斜</strong></p></blockquote><blockquote><p>对第二个问题，从文章的理论，如果我能预设到未来这段时间内是否会被打断，预设出我可以在这段时间内完成多少比例的工作或者将工作完成到什么程度，或者正确预测到工作中的困难，也许在3小时内的工作是高效的。重启的时间成本可以被节省出来。</p></blockquote><blockquote><p>总得来说，文章提出的是一个脑神经网络的模型，能帮助我思考我面临的困境。</p></blockquote><ol start="5"><li><a href="https://contextkeeper.io/blog/the-real-cost-of-an-interruption-and-context-switching/">Programmer Interrupted: The Real Cost of Interruption and Context Switching</a></li></ol><blockquote><p>讨论了被打断后重建的成本。并给出了在撰写代码工作流方面的解决方法，有趣的是这篇文章主要参考了整整10年前的博客。十年之后，问题依旧。</p></blockquote><blockquote><p>这篇文章证实了我对被打断的憎恶（或者对中断工作的憎恶，哪怕这是可预测的）。写这个周报的时候，就因为各种事情中断了两次（长达几小时），中断时写的半句话当时肯定觉得自己能想起来，但实际上我完全不能理解我当时想说啥。这种情况也出现在收集链接和评论上。周中收集链接时想到的评价和周末汇总时写出的总是不一样的。</p></blockquote><blockquote><p>我觉得文章中提到的Prospective Memory可能是这种问题的终极解法。让未来可能会用到的内容从脑中显像化在外部存储中（纸张，代码注释等）</p></blockquote><p><a href="https://news.ycombinator.com/item?id=35459333">hackernews上对这个问题的讨论</a></p><h2 id="技术"><a href="#技术" class="headerlink" title="技术"></a>技术</h2><ol><li><a href="https://github.com/hocus-dev/hocus">一个新的自托管的workspace</a></li></ol><blockquote><p>感觉周中刷到的时候是因为他宣传有AI加持但是我好想没看到</p></blockquote><ol start="2"><li><a href="https://www.nature.com/articles/s41567-023-01993-w">Double-slit time diffraction at optical frequencies</a></li></ol><blockquote><p>不小心刷到了看起来很吊的干涉</p></blockquote><ol start="3"><li><a href="https://news.ycombinator.com/item?id=35459031">DL学习路径</a><br><a href="https://karpathy.ai/zero-to-hero.html">大佬karpathy做的Neural Networks: Zero to Hero</a></li></ol><blockquote><p>在班里十个人九个在搞DL另一个已经精通的大环境下，有必要从头学一下了<br>问了一下newbing，他说：”……I think this website is useful for learning deep learning, especially if you want to follow along with the code and build neural networks from scratch. The website is created by <strong>Andrej Karpathy</strong>, who is a well-known expert and practitioner in deep learning³. He is currently the Director of AI at Tesla and a former research scientist at OpenAI³. The website contains a series of YouTube videos where he explains the key concepts and terminologies of deep learning without any code, and then shows how to implement them in Python using PyTorch¹. The website also provides Jupyter notebooks and GitHub repositories for each video, as well as exercises for practice². The website covers topics such as backpropagation, language modeling, multilayer perceptrons, activations, gradients, batch normalization, and more¹. The website is aimed at beginners who have some basic knowledge of Python and calculus¹.”<br>并且bing推荐用kaggle,这也是大部分同学用的“Learn from online courses or platforms like Kaggle that offer interactive lessons, quizzes, and competitions on deep learning topics”</p></blockquote><p>以下是bing给出的计划</p><p>I cannot give you a definitive learning plan for 30 days, as different learners may have different preferences and goals. However, I can suggest a possible outline that you can modify according to your needs and interests. Here is an example of a 30-day learning plan to build your own neural network:</p><ul><li>Day 1-5: Review the basics of Python and PyTorch, and learn how to use Kaggle Notebooks. You can use the resources from Kaggle Learn or other online courses or books.</li><li>Day 6-10: Watch the first video from the website and learn how to build micrograd, a minimal automatic differentiation library. Follow along with the code and exercises in your notebook. Try to understand the concepts and math behind backpropagation and gradient descent.</li><li>Day 11-15: Watch the second video from the website and learn how to build makemore, a character-level language model. Follow along with the code and exercises in your notebook. Try to understand the concepts and techniques behind language modeling, such as embeddings, softmax, cross entropy loss, sampling, etc.</li><li>Day 16-20: Watch the third video from the website and learn how to extend makemore into a multilayer perceptron (MLP) language model. Follow along with the code and exercises in your notebook. Try to understand the basics of machine learning, such as model training, learning rate tuning, hyperparameters, evaluation, train&#x2F;dev&#x2F;test splits, under&#x2F;overfitting, etc.</li><li>Day 21-25: Watch the fourth video from the website and learn how to improve makemore with batch normalization. Follow along with the code and exercises in your notebook. Try to understand the internals of MLPs with multiple layers, such as activations, gradients, scaling issues, diagnostic tools, etc.</li><li>Day 26-30: Watch the fifth video from the website and learn how to backpropagate through makemore manually without using PyTorch autograd. Follow along with the code and exercises in your notebook. Try to understand how gradients flow backwards through the compute graph and on the level of efficient tensors.</li></ul><p>By the end of this learning plan, you should be able to build your own neural network from scratch using Python and PyTorch. You should also have a solid foundation of deep learning concepts and terminologies that you can apply to other domains and problems. Of course, this is not the end of your learning journey, but rather a starting point for further exploration and improvement. I hope this helps you achieve your goal. Good luck! 😊</p><p><a href="https://www.kaggle.com/">kaggle：算力，教程，刷榜阿巴阿巴</a></p><blockquote><p>少玩点游戏吧少年</p></blockquote><ol start="4"><li><a href="https://segment-anything.com/">所谓图像领域的GPT3，AI “cut out” any object</a></li></ol><blockquote><p>用之前stablediffusion生成的图片试了试，感觉简单图片它干的很不错了</p></blockquote><p>这是效果</p><p><img src="https://pic.1314171.xyz/i/2023/04/07/%E6%97%A0%E6%A0%87%E9%A2%98.png"></p><p>原图是这样的</p><p><img src="https://pic.1314171.xyz/i/2023/04/07/front_shot_of_a_weasel_doctor__intricate__elegant__highly_detailed__centered__concept_art__smooth_sh_Seed-7886292_Steps-50_Guidance-172.png"></p><ol start="5"><li><a href="https://dmesg.app/cf-zero-trust.html">一个创建内网的方式</a></li></ol><blockquote><p>现在没用，以后也许会有用</p></blockquote><ol start="6"><li><a href="https://robotic.substack.com/p/behind-the-curtain-ai">Behind the curtain: what it feels like to work in AI right now</a></li></ol><blockquote><p>以下是newBing对这个文章的总结，和自己看英文内容比，这样确实快很多，而且比简单的机器翻译要更达意。</p></blockquote><p>这篇文章是由Nathan Lambert撰写的，讲述了ChatGPT这一大型语言模型对AI行业的影响，以及AI研究者和工程师在这个快速发展的领域面临的挑战和机遇。文章主要包括以下几个方面：</p><ul><li>ChatGPT是OpenAI开发的一种基于海量文本数据训练的AI系统，被认为是AI领域的第一个iPhone时刻，引发了人们对AI的兴趣和变革。</li><li>ChatGPT的出现导致了AI行业的大量变化，包括职业转变、新公司的创建、项目的放弃等。整个行业充满了活力，但也带来了竞争、噪音、影响力、财务上升、道德担忧等方面的压力。</li><li>AI研究者和工程师在这个环境中工作非常紧张，既有强烈的动力，也有严重的倦怠。他们需要在第一或最好的综合征（以及开放性）之间做出选择，同时保持专注和创新。文章认为，这些压力使得人们在构建AI产品时忽视了工程和文档的完善性，而更注重点击率。</li><li>文章还提出了两个基本假设：大型语言模型（LLMs）将成为机器学习工具箱中跨领域的常用部分；AI安全是一个真实的问题，需要引起公众的关注和讨论。文章指出，这两个假设使得AI领域更加复杂和有趣，但也更加危险和不稳定。</li><li>文章最后呼吁AI社区保持谦逊和合作，避免陷入资本主义驱动的AI竞赛，而是关注AI对人类社会的长期影响和价值。</li></ul><h1 id="春天快乐，没有感冒的一次换季体验是爽快的"><a href="#春天快乐，没有感冒的一次换季体验是爽快的" class="headerlink" title="春天快乐，没有感冒的一次换季体验是爽快的"></a>春天快乐，没有感冒的一次换季体验是爽快的</h1>]]></content>
    
    
    <summary type="html">一周内刷到的链接合集</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 6</title>
    <link href="http://blog.1314171.xyz/post/2023week6.html"/>
    <id>http://blog.1314171.xyz/post/2023week6.html</id>
    <published>2023-04-01T12:52:44.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="技术向-更新"><a href="#技术向-更新" class="headerlink" title="技术向&amp;更新"></a>技术向&amp;更新</h1><ol><li><a href="https://blog.gslin.org/archives/2023/03/29/11118/%E6%94%B9%E7%94%A8-ifttt-%E5%88%86%E4%BA%AB%E5%88%B0-twitter/">IFTTT 分享博客（借用rss）到 Twitter</a></li></ol><blockquote><p>试一下吧，看看有没有效果，这周的应该就能自动发推特上了</p></blockquote><ol start="2"><li><a href="https://github.com/usememos/memos">本来是碎片知识管理，被我用成了时间线梳理</a></li></ol><blockquote><p>这个项目很好，我自己搭了一个，能记录自己都干了啥，有tgbot很方便，也很漂亮</p></blockquote><p><img src="https://pic.1314171.xyz/i/2023/04/01/20230401204847.png" alt="时间线效果图"></p><h1 id="杂"><a href="#杂" class="headerlink" title="杂"></a>杂</h1><ol><li><a href="https://www.guokr.com/article/463680/">你写的每个“的地得”，都可能成为呈堂证供</a></li></ol><blockquote><p>我写的每篇博客都将成为我的呈堂证供</p></blockquote><ol start="2"><li><a href="https://www.bilibili.com/video/BV11g4y137yo/?spm_id_from=333.337.search-card.all.click&vd_source=81d250ace1f03d943723e87ae82d6bfe">看超级小桀看塞尔达2预告</a></li></ol><blockquote><p>任天堂的游戏发展到现在依旧不是靠特效靠画质取胜，从预告的内容来看，要是提到的所有功能都能实现，是开放性世界游戏的一大开创性进步，希望bug少一点，如果4月份马里奥大电影官宣下一代主机，那这波配合非常好</p></blockquote><iframe src="//player.bilibili.com/player.html?aid=824311046&bvid=BV11g4y137yo&cid=1075670771&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe><ol start="3"><li><a href="https://www.bjp.org.cn/APOD/4028c1368724a846018726c03f3b0003.shtml">一次多重绿闪日落</a></li></ol><blockquote><p>真的很漂亮</p></blockquote><p><img src="https://pic.1314171.xyz/i/2023/04/01/1679982160949011264.jpg"></p><ol start="4"><li><a href="https://wiki.qunn.eu/books/b1d10/page/72b32">舍友煎包对搜索引擎（英文为主）的纵览文章的翻译</a></li></ol><blockquote><p>其实我觉得没啥用（小声，but煎包推荐的东西还是有前瞻性的</p></blockquote><ol start="5"><li><a href="https://news.ycombinator.com/item?id=35348353">对暂停大模型训练公开信的外网讨论</a></li></ol><blockquote><p>上周说过了关于马斯克的，其实当时我也想到了我认知里做到人类共同停止进步的领域就是俩，一个是核武器，一个是克隆人（or可以说是应用在人类身上的有伦理风险的技术）。<br>这封公开信已经被确认好多签名造假而暂停签名了</p></blockquote><ol start="6"><li><a href="https://mp.weixin.qq.com/s/snUKQAhKrDbrGaWzxQUYXw">一篇想让我去台湾见见世面的文章</a></li></ol><blockquote><p>台湾的风土人情还是和大陆有蛮大的差别的（或者说和我生活的北方比）<br>希望能在明年12月（也就是梧桐前）去一次台湾</p></blockquote><ol start="7"><li><a href="https://www.bilibili.com/video/BV1DY4y1S796/?buvid=XX3154F3AD73907271B038E44105213DE6445&is_story_h5=false&mid=anhNAo1ifRpxkYRm1vfRBQ==&p=1&plat_id=116&share_from=ugc&share_medium=android&share_plat=android&share_session_id=efc7f098-746b-453a-bee5-25ddc0f38bc6&share_source=COPY&share_tag=s_i&timestamp=1680153764&unique_k=czz92bA&up_id=511148568&vd_source=81d250ace1f03d943723e87ae82d6bfe">入狱养老</a></li></ol><blockquote><p>评论里说：视频信息不足，我来补充一些：1、08年付达信69岁，一辈子都没娶过亲，作为五保户，从03年起，领一年300元的补助，到07年涨到600元，平时捡废品补贴家用，进去前已经两年没吃过肉；2、进去后，天天有馒头吃，老年人每天早晨加一个鸡蛋，两年来第一次吃到了肉，三个月胖了10斤；3、每年600元的五保户补助依然发放，村里会计把钱邮寄过来，在里面可以买到一些东西改善伙食；4、里面60岁以上老人不需要劳动，每天早晨6点30起床，别人出工后，付回舍休息，看书看报、背唐诗、写字；5、做了有生以来第一次体检，查出“脑血管硬化、骨质增生、双肾结石、前列腺炎”，每天均有医生巡诊，某次前列腺炎发作，由四个帽子叔叔陪同去外面社会医院诊治。<br>我想，是不是可以拿纳税的钱建一点类似监狱生活水平的养老院？如果社会上真的很多老人的生活不如在牢笼里的话</p></blockquote><ol start="8"><li><a href="https://www.zhihu.com/question/50987348/answer/2956578292">猫为什么会经常聚在一起？猫咪定期开会的意义是什么？ - 美味大夜壶的回答 - 知乎</a></li></ol><blockquote><p>这个回答说猫咪开会为了“定期观察情况（猫咪社会地位等）有没有大变化”<br>人也一样，有道理“ 你开会开不出什么结果，但是不开会一定出积小乱为大乱。国际上也一样。</p></blockquote><ol start="9"><li><a href="https://www.zhihu.com/question/583365135/answer/2894927545">如果博士论文要求创新，那么是不是意味着以后的博士会越来越少，毕竟人总有江郎才尽的一天? - 韩愈字退之的回答 - 知乎</a></li></ol><blockquote><p>我以后可能会成为文中白银或者青铜段位的，作者评价为：“要么是迎合热点炒噱头，要么是为赋新词强说愁，其对社会的唯一贡献在于消耗科研经费。此类研究做得再花哨也不会产生任何实际作用，毕竟，就算你角度和力度算的再准，也不会有人真拿量角器和测力计对着切菜的。如果能在这个level拔尖，大概率能获得《＊年＊篇顶刊！为这个智慧与颜值并存的学霸女神&#x2F;男神点赞！》的学校官微推文一篇，基本可以视为优秀博士生的天花板。<br>但我认为只要有经济头脑，是可以将这些技术细节成果转化的，人不能把控的让机器来，机器切菜总可以计算力度额角度吧</p></blockquote><h1 id="看到一个人写的对自杀者的探究文章，还有点意思"><a href="#看到一个人写的对自杀者的探究文章，还有点意思" class="headerlink" title="看到一个人写的对自杀者的探究文章，还有点意思"></a>看到一个人写的对自杀者的探究文章，还有点意思</h1><ol><li><p><a href="https://mp.weixin.qq.com/s/9w4eilNJDd3PmyOuGe3Btw">一位僧侣与自杀的对抗之旅</a></p><blockquote><p>我不做评论了，声明，本人没有半点自杀倾向</p></blockquote></li><li><p><a href="https://mp.weixin.qq.com/s/u3jTkN8yL0CSZmAZTfvZ-A">动物会自杀吗</a></p><blockquote><p>动物自杀也和上周提到对人工智能同样适用的没有自我意识来解释</p></blockquote></li></ol>]]></content>
    
    
    <summary type="html">一周内刷到的链接合集</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>IFTTT?IF THIS THEN THAT!</title>
    <link href="http://blog.1314171.xyz/post/220807ifttt.html"/>
    <id>http://blog.1314171.xyz/post/220807ifttt.html</id>
    <published>2023-04-01T12:22:10.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="什么是IFTTT"><a href="#什么是IFTTT" class="headerlink" title="什么是IFTTT"></a>什么是IFTTT</h1><p><a href="https://sspai.com/post/43731">请参考</a></p><h1 id="相关链接"><a href="#相关链接" class="headerlink" title="相关链接"></a>相关链接</h1><p><a href="https://ifttt.com/">官网</a></p><p><a href="https://ifttt.com/qnap">官网威联通接口</a></p><p><a href="https://www.qnap.com.cn/solution/ifttt_agent/zh-cn#flexible">威联通官网</a></p><p><a href="https://www.qnap.com/en/how-to/tutorial/article/ifttt-agent-user-guide">威联通官方教程</a></p>]]></content>
    
    
    <summary type="html">还是为了更高效的把nas用起来</summary>
    
    
    
    <category term="教程" scheme="http://blog.1314171.xyz/categories/%E6%95%99%E7%A8%8B/"/>
    
    
    <category term="nas" scheme="http://blog.1314171.xyz/tags/nas/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 5</title>
    <link href="http://blog.1314171.xyz/post/2023week5.html"/>
    <id>http://blog.1314171.xyz/post/2023week5.html</id>
    <published>2023-03-29T16:22:36.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="这周啥也meigan"><a href="#这周啥也meigan" class="headerlink" title="这周啥也meigan"></a>这周啥也meigan</h1><p>但是有一些新的值得分享的链接：</p><h2 id="首先是ChatGPT延伸出来的话题"><a href="#首先是ChatGPT延伸出来的话题" class="headerlink" title="首先是ChatGPT延伸出来的话题"></a>首先是ChatGPT延伸出来的话题</h2><p>1.<br><a href="https://www.guokr.com/article/463654/">gpt是否具有自我意识</a></p><p>有关研究GPT的心理理论水平的科普，结论是GPT没有9岁的心智，但可以由简单的【心理理论（Theory of Mind）能力，有时也被译为“心理推理能力”，通常是指理解他人内心状态的能力，包括推断他人意图、信念、情绪等等。】能力。</p><p>2.<br><a href="https://mp.weixin.qq.com/s/ytBdm7CgaVTVeIgShignUw">究竟在哪个问题上, ChatGPT逼得思想无路可走?</a></p><p>这是一个人文社科报社的文章，我也不是很明白文中提到的哲学相关的话题。从一个技术外行角度（从原文遣词造句可以看出来）给出了对人工智能这次在社会层面大爆发的评价。</p><p>文章同样提到了GPT没有自我意识，文中提到图灵测试和GPT的关系,GPT对政治正确的执念以及GPT的思维黑箱。</p><blockquote><p>目前的人工智能都属于图灵机，可是图灵测试却恐怕已经失灵了，这个有趣的事情说明，图灵把测试标准定得太低，难不倒GPT系列人工智能，反倒只能从过于标准化或过于政治正确的回答来推测谁是人工智能——**正常人大概不会坚持不懈地说些滴水不漏的政治正确的废话，除非是神经病或人工智能。**GPT（包括最新的GPT-4）提出的新问题是，它属于图灵机，却有能力通过图灵测试。“像人而不是人”这个新问题废掉了图灵测试。为什么可以这样？这就需要分析GPT的思维原则。**目前的人工智能都采取经验主义和进化论原则，这样的思维水平大致相当于原始人。**人工智能的“学习”，主要意思是收集材料和记忆，而其“训练”的主要意思是吃一堑长一智。如此简单听起来令人失望，但加上无敌的运算速度就有神奇效果了。</p></blockquote><blockquote><p>传统图灵机相当于数学直觉主义的信徒，且称之为“布劳威尔型号”，其知识生产限于能行有限步骤可实现的确定必然结果，就是说，它能够承认的知识是封闭领域里的确定知识。有限步骤无法解决的问题就出事了，比如说让它运算个悖论或者圆周率之类，不知道会死机还是永不停机。这种图灵机只按照给定规则去做作业，显然没有主体性，是工具而不是主体，其思维方式可称为机械主义。GPT是图灵机的升级版（很快还会有更高级的），其思维方式已经从机械主义切换为经验主义和进化论。GPT的思维没有实现封闭化，超越了“布劳威尔型号”，变成了“维特根斯坦2型”（符合后期维特根斯坦哲学），其思维居然有了黑箱，它在建立信息或语言关联时有着语境化的不确定性、灵活性或即兴性，因此形成了思维不完全透明的黑箱效果，即使设计者也不完全知道它是怎么想的，比如说不清楚它在什么时候和为什么会突然“一本正经地胡说八道”。<strong>但这种“自主性”可不是主体性，GPT并没有自己的信念和想法。</strong></p></blockquote><p>给出了一个新芝诺问题的假设：</p><blockquote><p>新芝诺问题的要点在于，人类知识可以无限发展，<strong>但受到生物学的限制，人类的智能存在着极限（心灵和身体的能力都有其极限）</strong>，相当于智能被上帝锁死，因此人类智能有着某种无法超越的智能常数，类似于光速是宇宙的一个不可超越的常数，而人工智能的设计智能来自人类，那么，给定人工智能限于图灵机，合理推测是，图灵机人工智能可以无限逼近人的知识，但无法超过人的智能常数，类似于不可能比光速更快。</p></blockquote><p>认为人工智能可以无限逼近人的知识，但无法超过人的智能常数。在智能常数的限制下，人工智能阿基里斯就真的追不上人类乌龟了，当然两者会无限逼近。给定这个情况，无限逼近人类智能的图灵机将是人类最好的工具，能够帮助人类创造更好的生活。</p><p>最后，文章讨论了“自虐”问题：人工智能何时超越人成为新主体？<strong>人类提心吊胆而兴奋地等待这一天的到来。</strong></p><blockquote><p>人工智能突破奇点有两种可能性：（1）超越人类的智能常数，这必须能够产生与人不同而高于人的另一种思维；（2）达到人类的智能常数，又有着比人类智能更大的运作能量。可能性（2）是安全奇点，看起来非常可能，只是需要时间，但可能性（1）是危险奇点，幸亏目前还难以想象。从根本上说，人工智能突破奇点需要获得自我意识、反思性、创造性。这三者密切相关。</p></blockquote><p>哲学的角度讨论自我意识</p><blockquote><p>看来自我意识先需要具备反思能力。反思不仅仅是认识自身，更重要的是拥有自身，即对自身拥有所有权、自主权和立法权，就是康德说的“autonomy”。目前人工智能之所以还不是主体，不在于能力还不够强（能力的局限性会在高速迭代中被解决），而在于它的思维能力虽然落户在机器上，但并不属于机器而属于人类，<strong>人工智能并没有拥有思维，只有思维的使用权，却没有思维的所有权、自主权和立法权</strong>，相当于说，人工智能是人类智能的经理，却不是主权人。假如反思性仅仅达到认识自身，就只是自我意识的必要条件而不是充分条件。如果反思没有建构性（创造秩序或系统的能力），自我意识就功败垂成。</p></blockquote><p>文章谈到了我一直以来认为的AI生成领域最大的弊端：1. 人工智能给出的内容是现有内容的集合，存在创造力边界就是人类现有创造水平。2. 人工智能生成内容的“逻辑”是依靠权重，数据概率相关的，而非“理解”如果那么这种人类逻辑。</p><blockquote><p>从存在论意义上说，人工智能的思想对象都是已经存在的，它不能处理尚未存在的事情。人类的思维对象不仅包括给定的数据（相当于已经存在的事情），而且包括尚未存在的事情，表现为“可能性”，同时在逻辑上也自动包含了“不可能性”。</p></blockquote><p>综上，人工智能距离颠覆创造性工作还有很长的路要走，但对基础性的技术工作可能会在一定程度上超越人类自身。也就是说，从菜鸟到大牛之间这一段区域将能够被人工智能完全填充，我认为未来人类可能在AI的压力下发展为大学学习基本理论知识和理解AI技术后攻坚各种人类边界问题</p><ol start="3"><li></li></ol><p><a href="https://blog.sciencenet.cn/blog-829-1381783.html">警惕！ChatGPT或将重塑我们的情感模式</a></p><p>讲GPT虽然不能超越人类，但有可能像TikTok算法产生信息茧房一样产生情感茧房，从而影响人类。</p><p><strong>超时空差一句话话</strong> 23年3月29号（也就是下周）看到马斯克带头签了一个倡议<a href="https://futureoflife.org/open-letter/pause-giant-ai-experiments/">Pause Giant AI Experiments: An Open Letter</a>, 暂停超越GPT4的大模型。不论是不是出于商业目的）</p><h2 id="一些题外话"><a href="#一些题外话" class="headerlink" title="一些题外话"></a>一些题外话</h2><p><a href="https://blog.sciencenet.cn/blog-729911-1381943.html">做科研是一种贵族行为</a></p><p><a href="https://lala.im/8634.html">自建游戏加速器</a></p>]]></content>
    
    
    <summary type="html">一周内刷到的链接合集</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 4</title>
    <link href="http://blog.1314171.xyz/post/2023week4.html"/>
    <id>http://blog.1314171.xyz/post/2023week4.html</id>
    <published>2023-03-22T09:37:31.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="充实的周末"><a href="#充实的周末" class="headerlink" title="充实的周末"></a>充实的周末</h1><h2 id="指丢了回自行车"><a href="#指丢了回自行车" class="headerlink" title="指丢了回自行车"></a>指丢了回自行车</h2><p>详情:<br><img src="https://pic.1314171.xyz/i/2023/03/22/bca1ac9fedd8b5818fc9925acf7fa59.jpg"></p><p>录完笔录坐公交还做过站了<br><img src="https://pic.1314171.xyz/i/2023/03/22/d69feb7390eee75cc278d423ce965eb.jpg"></p><p>周末白天在中关村校区，<br><img src="https://pic.1314171.xyz/i/2023/03/22/8f69b6f91c860e99cb6111b0d84f6f0.jpg"></p><h1 id="链接们："><a href="#链接们：" class="headerlink" title="链接们："></a>链接们：</h1><p><a href="https://blog.csdn.net/weixin_47319327/article/details/122967712?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-122967712-blog-81231044.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-122967712-blog-81231044.pc_relevant_recovery_v2&utm_relevant_index=1">【论文整理】风格迁移中格拉姆矩阵（Gram Matrix）的使用</a></p><p><a href="https://zhuanlan.zhihu.com/p/356938640?utm_id=0">现代控制理论：速成&#x2F;不求甚解版</a></p><p><a href="https://wandb.ai/">深度学习可视化工具</a></p><p><a href="https://www.youtube.com/watch?v=CRlN-cYFxTk">Nerf讲解</a></p><p><a href="https://blog.sciencenet.cn/blog-412323-1380422.html">零基础作科研更可能取得大成就</a></p>]]></content>
    
    
    <summary type="html">一周内刷到的链接合集</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 3</title>
    <link href="http://blog.1314171.xyz/post/2023week3.html"/>
    <id>http://blog.1314171.xyz/post/2023week3.html</id>
    <published>2023-03-09T13:57:54.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h2 id="周四"><a href="#周四" class="headerlink" title="周四"></a>周四</h2><p>控制理论作业强迫我们用$\LaTeX$写，被迫捡起大一参加数模时学的技能。</p><pre><code class="hljs">当时学LaTeX之后，我对他的评价就是，非常牛的排版工具，但是成本太高（主要是学习成本，毕竟相当于一种标记语言了（类html吧）。很多可以炫技的地方,比如上面的花体LaTeX（最不值一提但新接触时会眼前一亮的点）。如果科研水平到了一定的程度，我相信一定离不开它的。但它真的太繁琐了，我目前需要的功能Word基本都能提供给我，更别提LaTeX环境配置也有更高一点的要求（其实没啥），当时一轮校赛过后，我就不想碰它了。它的社区生态不如Markdown成熟，但Markdown也在不断融合进LaTeX的优点比如成熟的公式输入体系。同时，如果没有模板，从0开始自己用LaTeX写东西简直是天方夜谭。最后，对要求用LaTeX交作业，我的想法是，对我们有好处，但完全没必要。</code></pre><p>记录一些作业上经常出现的公式代码和效果</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs Latex"><span class="hljs-keyword">\begin</span>&#123;equation&#125;<br><span class="hljs-keyword">\left</span><span class="hljs-keyword">\&#123;</span><br><span class="hljs-keyword">\begin</span>&#123;array&#125;&#123;cl&#125;<br>u<span class="hljs-built_in">_</span>&#123;i&#125;=i<span class="hljs-built_in">_</span>&#123;1&#125;R<span class="hljs-built_in">_</span>&#123;1&#125;+u<span class="hljs-built_in">_</span>l+i<span class="hljs-built_in">_</span>&#123;1&#125;R<span class="hljs-built_in">_</span>&#123;2&#125;-i<span class="hljs-built_in">_</span>&#123;2&#125;R<span class="hljs-built_in">_</span>&#123;2&#125;<span class="hljs-keyword">\\</span><br>u<span class="hljs-built_in">_</span>c+i<span class="hljs-built_in">_</span>&#123;2&#125;(R<span class="hljs-built_in">_</span>&#123;3&#125;+R<span class="hljs-built_in">_</span>&#123;2&#125;)=i<span class="hljs-built_in">_</span>&#123;1&#125;R<span class="hljs-built_in">_</span>&#123;2&#125;<span class="hljs-keyword">\label</span>&#123;1&#125;<br><span class="hljs-keyword">\end</span>&#123;array&#125;<br><span class="hljs-keyword">\right</span>.<br><span class="hljs-keyword">\end</span>&#123;equation&#125;<br></code></pre></td></tr></table></figure><p>$\begin{equation}<br>\left{<br>\begin{array}{cl}<br>u_{i}&#x3D;i_{1}R_{1}+u_l+i_{1}R_{2}-i_{2}R_{2}\<br>u_c+i_{2}(R_{3}+R_{2})&#x3D;i_{1}R_{2}<br>\end{array}<br>\right.<br>\end{equation}$</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs latex"><span class="hljs-built_in">$</span>i<span class="hljs-built_in">_</span>&#123;2&#125;=c<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;u<span class="hljs-built_in">_</span>c&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t&#125;<span class="hljs-built_in">$</span><br></code></pre></td></tr></table></figure><p>$i_{2}&#x3D;c\dfrac{\mathrm{d}u_c}{\mathrm{d}t}$</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs latex"><span class="hljs-keyword">\begin</span>&#123;equation&#125;<br><span class="hljs-keyword">\begin</span>&#123;split&#125;<br><span class="hljs-built_in">&amp;</span><span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;<span class="hljs-built_in">^</span>&#123;3&#125;u<span class="hljs-built_in">_</span>o&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t<span class="hljs-built_in">^</span>3&#125;+(<span class="hljs-keyword">\dfrac</span>&#123;R<span class="hljs-built_in">_</span>1R<span class="hljs-built_in">_</span>2C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2+C<span class="hljs-built_in">_</span>1L&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2L&#125;)<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;<span class="hljs-built_in">^</span>&#123;2&#125;u<span class="hljs-built_in">_</span>o&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t<span class="hljs-built_in">^</span>2&#125;+(<span class="hljs-keyword">\dfrac</span>&#123;R<span class="hljs-built_in">_</span>1+R<span class="hljs-built_in">_</span>2&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>2L&#125;)<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;u<span class="hljs-built_in">_</span>o&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t&#125;+<span class="hljs-keyword">\dfrac</span>&#123;1&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2L&#125;u<span class="hljs-built_in">_</span>o<br>=<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;<span class="hljs-built_in">^</span>&#123;3&#125;u<span class="hljs-built_in">_</span>i&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t<span class="hljs-built_in">^</span>3&#125;<span class="hljs-keyword">\\</span><span class="hljs-built_in">&amp;</span>+(<span class="hljs-keyword">\dfrac</span>&#123;R<span class="hljs-built_in">_</span>1R<span class="hljs-built_in">_</span>2C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2+C<span class="hljs-built_in">_</span>1L+C<span class="hljs-built_in">_</span>2L&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2L&#125;)<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;<span class="hljs-built_in">^</span>&#123;2&#125;u<span class="hljs-built_in">_</span>i&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t<span class="hljs-built_in">^</span>2&#125;+(<span class="hljs-keyword">\dfrac</span>&#123;C<span class="hljs-built_in">_</span>1R<span class="hljs-built_in">_</span>1+C<span class="hljs-built_in">_</span>1R<span class="hljs-built_in">_</span>2+C<span class="hljs-built_in">_</span>2R<span class="hljs-built_in">_</span>1&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2L&#125;)<span class="hljs-keyword">\dfrac</span>&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;u<span class="hljs-built_in">_</span>i&#125;&#123;<span class="hljs-keyword">\mathrm</span>&#123;d&#125;t&#125;+<span class="hljs-keyword">\dfrac</span>&#123;1&#125;&#123;R<span class="hljs-built_in">_</span>&#123;2&#125;C<span class="hljs-built_in">_</span>1C<span class="hljs-built_in">_</span>2L&#125;u<span class="hljs-built_in">_</span>i<br><span class="hljs-keyword">\end</span>&#123;split&#125;<span class="hljs-keyword">\end</span>&#123;equation&#125;<br></code></pre></td></tr></table></figure><p><img src="https://pic.1314171.xyz/i/2023/03/09/20230309215433.png" alt="效果3"></p><h3 id="公式速查表"><a href="#公式速查表" class="headerlink" title="公式速查表"></a>公式速查表</h3><p><a href="https://www.caam.rice.edu/~heinken/latex/symbols.pdf">rice大学速查手册</a><br><a href="https://lindexi.gitee.io/post/Latex-%E5%85%AC%E5%BC%8F%E9%80%9F%E6%9F%A5.html#%E5%BE%AE%E5%88%86">中文速查（不是很全</a></p>]]></content>
    
    
    <summary type="html">LaTeX，</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
  <entry>
    <title>Weekly Report Week 2</title>
    <link href="http://blog.1314171.xyz/post/2023week2.html"/>
    <id>http://blog.1314171.xyz/post/2023week2.html</id>
    <published>2023-03-09T07:44:52.000Z</published>
    <updated>2025-09-01T13:35:59.371Z</updated>
    
    <content type="html"><![CDATA[<h1 id="Weekly-Report-Week-2"><a href="#Weekly-Report-Week-2" class="headerlink" title="Weekly Report Week 2"></a>Weekly Report Week 2</h1><h2 id="学了啥）"><a href="#学了啥）" class="headerlink" title="学了啥）"></a>学了啥）</h2><p>模电有点费脑子，电磁场讲的有点快，还没来得及复习六级</p><h2 id="周三"><a href="#周三" class="headerlink" title="周三"></a>周三</h2><p>尝试和煎包复现论文代码，卡在了数据集的获取上 <a href="https://github.com/SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019">github链接</a></p><p>王晶他们组整的挺好。</p><h2 id="其他琐碎"><a href="#其他琐碎" class="headerlink" title="其他琐碎"></a>其他琐碎</h2><ol><li><p>openAI 开放了GPT3.5的API 但我不想整任何东西</p></li><li><p>stable diffusion 和脑科学结合，利用了扩散模型对羽翼的优势<a href="https://mp.weixin.qq.com/s/1wloJt03QdCTRBTe7qZSvA">大脑视觉信号被Stable Diffusion复现图像！“人类的谋略和谎言不存在了” | CVPR2023</a></p></li><li><p>就酱紫吧 over</p></li><li><p>其实我之前还疏漏了一个有用的项目，当然现在这个项目已经没用了。就是<a href="https://github.com/acheong08/EdgeGPT">EdgeGPT</a>,是一个“The reverse engineering the chat feature of the new version of Bing”，在开学打美赛的时候自己的微软还在排队就用舍友的cookie用这个登的微软GPT，有幸尝试到了受限制前的微软chat、</p></li><li><p>最后的最后，我的同学周帆发现了一个国人写的新项目将gpt和pdf论文结合在一起的项目。对论文阅读大有帮助！<a href="https://github.com/mukulpatnaik/researchgpt">researchgpt</a></p></li></ol>]]></content>
    
    
    <summary type="html">GPT, 人脸反欺诈</summary>
    
    
    
    <category term="Diary" scheme="http://blog.1314171.xyz/categories/Diary/"/>
    
    
    <category term="Weekly Report" scheme="http://blog.1314171.xyz/tags/Weekly-Report/"/>
    
  </entry>
  
</feed>
