<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>http://longliveforfreedom.github.io</id>
    <title>Study Notes</title>
    <subtitle></subtitle>
    <icon>http://longliveforfreedom.github.io/images/favicon.ico</icon>
    <link href="http://longliveforfreedom.github.io" />
    <author>
      <name>Eren New</name>
    </author>
    <updated>2025-02-28T07:11:57.000Z</updated>
    <entry>
        <id>http://longliveforfreedom.github.io/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/</id>
        <title>Implement-HiVT-with-Latest-pytorch-and-pl-Version</title>
        <link rel="alternate" href="http://longliveforfreedom.github.io/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/"/>
        <content type="html">&lt;h1 id=&#34;implementdeploy-hivt-with-latest-pytorchpytorch-lightning-version&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#implementdeploy-hivt-with-latest-pytorchpytorch-lightning-version&#34;&gt;#&lt;/a&gt; Implement(deploy) HiVT with latest pytorch&amp;amp;pytorch-lightning version&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;refer to &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2tkZGIxMjM0L2FydGljbGUvZGV0YWlscy8xMzY4MzEyNTg=&#34;&gt;https://blog.csdn.net/kddb1234/article/details/136831258&lt;/span&gt;, &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL3B5Zy10ZWFtL3B5dG9yY2hfZ2VvbWV0cmljL2lzc3Vlcy80MzU4&#34;&gt;https://github.com/pyg-team/pytorch_geometric/issues/4358&lt;/span&gt; and &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL2d6ZXJ2ZWFzL212dHNfdHJhbnNmb3JtZXIvaXNzdWVzLzY4&#34;&gt;https://github.com/gzerveas/mvts_transformer/issues/68&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;the official env of HiVT is pytorch 1.8, python 3.8, pytorch-geometric 1.7.2, pytorch-lightning 1.5.2 and cuda 11.1, which versions are too early. So, this blog will deploy HiVT with higher version of torch&amp;amp;pl with python 3.10, pytorch 2.1.0, pytorch-lightning 2.0.3, PyG 2.3.1 and cuda 12.1.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;preparation&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#preparation&#34;&gt;#&lt;/a&gt; Preparation&lt;/h1&gt;
&lt;figure class=&#34;highlight plaintext&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;4&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;5&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;conda create -n HiVT python=3.10&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;conda activate HiVT&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;conda install pytorch==2.1.0 cudatoolkit=12.1 -c pytorch -c conda -forge&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;conda install pytorch-geometric==2.3.1 -c rusty1s -c conda-forge&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;conda install pytorch-lightning==2.0.3 -c conda-forge&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;h1 id=&#34;modification-of-hivt-src&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#modification-of-hivt-src&#34;&gt;#&lt;/a&gt; Modification of hivt src&lt;/h1&gt;
&lt;h2 id=&#34;trainpy&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#trainpy&#34;&gt;#&lt;/a&gt; &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL3RyYWluLnB5&#34;&gt;train.py&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;the “gpus” in parser should be changed to “devices”&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/1.png&#34; class title=&#34;gpus&#34;&gt;
&lt;ul&gt;
&lt;li&gt;the ArgoverseV1DataModule has no from_argoverse_args function any more, it can be input directly like:&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/2.png&#34; class title=&#34;datamodule&#34;&gt;
&lt;ul&gt;
&lt;li&gt;similarly to the datamodule, pl.Trainer should also be fixed&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/3.png&#34; class title=&#34;trainer&#34;&gt;
&lt;h2 id=&#34;adepy&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#adepy&#34;&gt;#&lt;/a&gt; &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL2FkZS5weQ==&#34;&gt;ade.py&lt;/span&gt; and other metrics&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;the compute_on_step parameter is no need, just delete it from the input parameter of &lt;strong&gt;init&lt;/strong&gt; function&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/4.png&#34; class title=&#34;metrics&#34;&gt;
&lt;ul&gt;
&lt;li&gt;same applies to other py files in the metrics directory&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;local_encoderpy&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#local_encoderpy&#34;&gt;#&lt;/a&gt; local_encoder.py&lt;/h2&gt;
&lt;p&gt;the new version of nn.Transformer add a parameter is_causal so it should be added in the TemporalEncoder class, which employs nn.TransformerEncoder as transformer_encoder variable&lt;/p&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/5.png&#34; class title=&#34;is_causal&#34;&gt;
&lt;h1 id=&#34;modification-of-pyg-code&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#modification-of-pyg-code&#34;&gt;#&lt;/a&gt; Modification of PyG code&lt;/h1&gt;
&lt;p&gt;find the &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL2NvbGxhdGUucHk=&#34;&gt;collate.py&lt;/span&gt; in the directory .conda/envs/${your env name}/lib/python3.10/site-pacakages/torch_geometric/data/collate.py. Then find the get_incs function and delete the input variable ‘store’ of data.&lt;strong&gt;inc&lt;/strong&gt;()&lt;/p&gt;
&lt;figure class=&#34;highlight plaintext&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;2&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;cd .conda/envs/$&amp;#123;your env name&amp;#125;/lib/python3.10/site-pacakages/torch_geometric/data&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;gedit collate.py&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;img data-src=&#34;/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/6.png&#34; class title=&#34;pyg&#34;&gt;
&lt;h1 id=&#34;others&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#others&#34;&gt;#&lt;/a&gt; Others&lt;/h1&gt;
&lt;p&gt;If you encounter problems about variables, add ‘**kwargs’ in forward() function may be help&lt;/p&gt;
&lt;h1 id=&#34;now-you-can-try-to-train-hivt-follow-the-official-doc&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#now-you-can-try-to-train-hivt-follow-the-official-doc&#34;&gt;#&lt;/a&gt; Now you can try to train HiVT follow the official doc&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;official doc: &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL1ppa2FuZ1pob3UvSGlWVA==&#34;&gt;https://github.com/ZikangZhou/HiVT&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        <updated>2025-02-28T07:11:57.000Z</updated>
    </entry>
    <entry>
        <id>http://longliveforfreedom.github.io/2024/11/06/hello-world/</id>
        <title>Hello World</title>
        <link rel="alternate" href="http://longliveforfreedom.github.io/2024/11/06/hello-world/"/>
        <content type="html">&lt;p&gt;Welcome to &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvLw==&#34;&gt;Hexo&lt;/span&gt;! This is your very first post. Check &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3Mv&#34;&gt;documentation&lt;/span&gt; for more info. If you get any problems when using Hexo, you can find the answer in &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3MvdHJvdWJsZXNob290aW5nLmh0bWw=&#34;&gt;troubleshooting&lt;/span&gt; or you can ask me on &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL2hleG9qcy9oZXhvL2lzc3Vlcw==&#34;&gt;GitHub&lt;/span&gt;.&lt;/p&gt;
&lt;h2 id=&#34;quick-start&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#quick-start&#34;&gt;#&lt;/a&gt; Quick Start&lt;/h2&gt;
&lt;h3 id=&#34;create-a-new-post&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#create-a-new-post&#34;&gt;#&lt;/a&gt; Create a new post&lt;/h3&gt;
&lt;figure class=&#34;highlight bash&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;$ hexo new &lt;span class=&#34;string&#34;&gt;&amp;quot;My New Post&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;p&gt;More info: &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvd3JpdGluZy5odG1s&#34;&gt;Writing&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&#34;run-server&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#run-server&#34;&gt;#&lt;/a&gt; Run server&lt;/h3&gt;
&lt;figure class=&#34;highlight bash&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;$ hexo server&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;p&gt;More info: &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvc2VydmVyLmh0bWw=&#34;&gt;Server&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&#34;generate-static-files&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#generate-static-files&#34;&gt;#&lt;/a&gt; Generate static files&lt;/h3&gt;
&lt;figure class=&#34;highlight bash&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;$ hexo generate&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;p&gt;More info: &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3MvZ2VuZXJhdGluZy5odG1s&#34;&gt;Generating&lt;/span&gt;&lt;/p&gt;
&lt;h3 id=&#34;deploy-to-remote-sites&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#deploy-to-remote-sites&#34;&gt;#&lt;/a&gt; Deploy to remote sites&lt;/h3&gt;
&lt;figure class=&#34;highlight bash&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;$ hexo deploy&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;p&gt;More info: &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvb25lLWNvbW1hbmQtZGVwbG95bWVudC5odG1s&#34;&gt;Deployment&lt;/span&gt;&lt;/p&gt;
</content>
        <updated>2024-11-06T08:54:04.531Z</updated>
    </entry>
    <entry>
        <id>http://longliveforfreedom.github.io/2024/11/06/Deploy-My-Own-Blog/</id>
        <title>Deploy My Own Blog</title>
        <link rel="alternate" href="http://longliveforfreedom.github.io/2024/11/06/Deploy-My-Own-Blog/"/>
        <content type="html">&lt;h1 id=&#34;deploy-my-own-blog-with-hexotheme-shoka-and-github&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#deploy-my-own-blog-with-hexotheme-shoka-and-github&#34;&gt;#&lt;/a&gt; Deploy my own blog with hexo(theme: Shoka) and github&lt;/h1&gt;
&lt;h2 id=&#34;prepare&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#prepare&#34;&gt;#&lt;/a&gt; Prepare&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;a github account&lt;/li&gt;
&lt;li&gt;install Git(get ssh working) and Nodejs on your PC or Mac&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;hexo&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#hexo&#34;&gt;#&lt;/a&gt; Hexo&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;install&lt;br&gt;
 &lt;code&gt;sudo npm install -g hexo-cli&lt;/code&gt; &lt;br&gt;
without sudo may encounter permission issues result in install fail&lt;/li&gt;
&lt;li&gt;init your blog folder&lt;br&gt;
 &lt;code&gt;hexo init blog&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;cd blog&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2024/11/06/Deploy-My-Own-Blog/image.png&#34; class title=&#34;opration&#34;&gt;
&lt;ul&gt;
&lt;li&gt;install some dependencies&lt;br&gt;
 &lt;code&gt;sudo npm install&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;sudo npm install hexo-deployer-git --save&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;get writing root for blog file&lt;br&gt;
 &lt;code&gt;sudo chmod -R 777 blog&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;preview your blog&lt;br&gt;
 &lt;code&gt;hexo s&lt;/code&gt; &lt;br&gt;
visit &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL2xvY2FsaG9zdDo0MDAwLw==&#34;&gt;http://localhost:4000/&lt;/span&gt; you will see your blog page&lt;/li&gt;
&lt;li&gt;(optional) download a theme from &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9oZXhvLmlvL3RoZW1lcy8=&#34;&gt;https://hexo.io/themes/&lt;/span&gt; and move the file to /blog/themes&lt;/li&gt;
&lt;li&gt;the Shoka theme is here &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL2FtZWhpbWUvaGV4by10aGVtZS1zaG9rYQ==&#34;&gt;https://github.com/amehime/hexo-theme-shoka&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;github-pages&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#github-pages&#34;&gt;#&lt;/a&gt; Github pages&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;create a repository namely &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL3VzZXJuYW1lLmdpdGh1Yi5pbw==&#34;&gt;username.github.io&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;modify the deploy section in /root/_config.yml&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&#34;highlight shell&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;4&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;deploy:&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;  type: git&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;  repo: https://github.com/username/username.github.io.git&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;  branch: main&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;ul&gt;
&lt;li&gt;after coding your blog, you can deploy it&lt;br&gt;
 &lt;code&gt;hexo g&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;hexo d&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;visit &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cDovL3VzZXJuYW1lLmdpdGh1Yi5pbw==&#34;&gt;http://username.github.io&lt;/span&gt; then you will see your blog&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;create-a-new-blog&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#create-a-new-blog&#34;&gt;#&lt;/a&gt; Create a new blog&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;hexo new &amp;quot;new blog name&amp;quot;&lt;/code&gt; &lt;br&gt;
put the picture in file with the same name of the new blog&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;note: the title should not include special symbol such as ‘&amp;amp;’&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;back-up-the-source-code-in-another-branch-of-the-repo&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#back-up-the-source-code-in-another-branch-of-the-repo&#34;&gt;#&lt;/a&gt; Back up the source code in another branch of the repo&lt;/h2&gt;
&lt;p&gt;refer to &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9ibG9nLjUxY3RvLmNvbS91XzE0MjMzMDM3LzU4MjQ1MjQ=&#34;&gt;https://blog.51cto.com/u_14233037/5824524&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;enter the .deploy_git(hidden file) folder&lt;br&gt;
 &lt;code&gt;cd .deploy_git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;create a branch called src&lt;br&gt;
 &lt;code&gt;sudo git branch src&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;then copy the .git(also hidden) file to the blog path(parent directory)&lt;/li&gt;
&lt;li&gt;associate the path to the repo&lt;br&gt;
 &lt;code&gt;sudo git remote add origin https://github.com/username/username.github.io.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;run the command you will see the repo info&lt;br&gt;
 &lt;code&gt;sudo git remote show origin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;添加保存改动&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&#34;highlight shell&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;2&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;sudo git add .&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;sudo git commit -m &amp;quot;source code updata&amp;quot;&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;ul&gt;
&lt;li&gt;change to the src branch&lt;br&gt;
 &lt;code&gt;sudo git checkout src&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pull your local source code to the repo&lt;br&gt;
 &lt;code&gt;sudo git push origin src:src&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;every time update following commands are needed&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&#34;highlight shell&#34;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&#34;gutter&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;1&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;2&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;3&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;4&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td class=&#34;code&#34;&gt;&lt;pre&gt;&lt;span class=&#34;line&#34;&gt;sudo git add .&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;sudo git commit -m &amp;quot;xxx&amp;quot;&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;sudo git checkout src&lt;/span&gt;&lt;br&gt;&lt;span class=&#34;line&#34;&gt;sudo git push origin src:src&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/figure&gt;
</content>
        <updated>2024-11-06T05:39:36.000Z</updated>
    </entry>
    <entry>
        <id>http://longliveforfreedom.github.io/2024/11/05/Remote-Control-with-RustDesk/</id>
        <title>Remote Control with RustDesk</title>
        <link rel="alternate" href="http://longliveforfreedom.github.io/2024/11/05/Remote-Control-with-RustDesk/"/>
        <content type="html">&lt;h1 id=&#34;remote-control-with-rustdesk-and-zerotiermacbook-as-control-end-ubuntu-as-controlled-end-raspberrypi4b-as-relay-server&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#remote-control-with-rustdesk-and-zerotiermacbook-as-control-end-ubuntu-as-controlled-end-raspberrypi4b-as-relay-server&#34;&gt;#&lt;/a&gt; Remote Control with rustdesk and zerotier(Macbook as control end, ubuntu as controlled end, raspberrypi4B as relay server)&lt;/h1&gt;
&lt;h2 id=&#34;preface&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#preface&#34;&gt;#&lt;/a&gt; Preface&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;macbook: m1 pro&lt;/li&gt;
&lt;li&gt;raspberry pi 4B with 4G ram and Ubuntu 20&lt;/li&gt;
&lt;li&gt;linux PC with ubuntu 20.04&lt;/li&gt;
&lt;li&gt;课题组的服务器在 1 楼，工位在 4 楼，因此需要远程。todesk 和向日葵免费版的都很糊而且 todesk 免费时长有限又需要经常登陆微信，不好用。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;prepare&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#prepare&#34;&gt;#&lt;/a&gt; Prepare&lt;/h2&gt;
&lt;h3 id=&#34;control-end&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#control-end&#34;&gt;#&lt;/a&gt; Control end&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;download rustdesk for mac: 官网 https://rustdesk.com/，选择 macos arm64 下载&lt;/li&gt;
&lt;li&gt;download zerotier(make sure that ssh is working)&lt;br&gt;
 &lt;code&gt;curl -s https://install.zerotier.com | sudo bash&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;controlled-end&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#controlled-end&#34;&gt;#&lt;/a&gt; Controlled end&lt;/h3&gt;
&lt;p&gt;与控制端同理&lt;/p&gt;
&lt;h3 id=&#34;relay-server&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#relay-server&#34;&gt;#&lt;/a&gt; Relay server&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;download zerotier as before&lt;/li&gt;
&lt;li&gt;download rustdesk-server(Note that it’s not rustdesk, it’s rustdesk-server, i.e. the rustdesk server) in here &lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL3J1c3RkZXNrL3J1c3RkZXNrLXNlcnZlci9yZWxlYXNlcw==&#34;&gt;https://github.com/rustdesk/rustdesk-server/releases&lt;/span&gt;, download hbbs-arm64 and hbbr-arm64(raspberry pi is arm architecture) then unzip&lt;/li&gt;
&lt;li&gt;pm2 is used to manage process hbbs and hbbr, so nodejs and npm are needed
&lt;ul&gt;
&lt;li&gt;install nodejs&lt;br&gt;
 &lt;code&gt;$ sudo apt install nodejs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;install npm&lt;br&gt;
 &lt;code&gt;$ sudo apt install npm&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;$ npm install -g n&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;install pm2&lt;br&gt;
 &lt;code&gt;$ npm install pm2 -g&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;$ pm2 completion install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;check process list&lt;br&gt;
 &lt;code&gt;$ pm2 ls&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img data-src=&#34;/2024/11/05/Remote-Control-with-RustDesk/image.png&#34; class title=&#34;pm list&#34;&gt;
&lt;ul&gt;
&lt;li&gt;enter the  directory hbbs and hbbr and run them respectively&lt;br&gt;
 &lt;code&gt;$ cd /Rustdesk/rustdesk-server-hbbs_1.1.11-1_arm64/data/usr/bin&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;$ pm2 start hbbs&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;$ cd /Rustdesk/rustdesk-server-hbbr_1.1.11-1_arm64/data/usr/bin&lt;/code&gt; &lt;br&gt;
 &lt;code&gt;$ pm2 start hbbr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;copy the key in the file with pub suffix in the hbbs folder and it will be used later&lt;/li&gt;
&lt;li&gt;Open these ports on the firewall:
&lt;ul&gt;
&lt;li&gt;TCP(21115, 21116, 21117, 21118, 21119)&lt;/li&gt;
&lt;li&gt;UDP(21116)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;zerotier&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#zerotier&#34;&gt;#&lt;/a&gt; Zerotier&lt;/h3&gt;
&lt;p&gt;Register a zerotier account(&lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly93d3cuemVyb3RpZXIuY29tLw==&#34;&gt;https://www.zerotier.com/&lt;/span&gt;) and create a network. Join the network in all three devices. Log in to the zerotier official website, enter the network, tick these devices, and authorize them. Get the IP address of these 3 devices&lt;/p&gt;
&lt;h2 id=&#34;lets-go&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#lets-go&#34;&gt;#&lt;/a&gt; Let’s Go&lt;/h2&gt;
&lt;img data-src=&#34;/2024/11/05/Remote-Control-with-RustDesk/image2.png&#34; class title=&#34;rustdesk&#34;&gt;
&lt;p&gt;In both of control end and controlled end, 点击 ID 旁边的三个点选择 Network，然后解锁，ID server 和 Relay server 均填入 relay server 的内网 IP，api server 不填，key 中填入此前保存的 hbbs key。Control end 中输入 controlled end 的 ID 即可连接。&lt;/p&gt;
&lt;h1 id=&#34;some-problems&#34;&gt;&lt;a class=&#34;anchor&#34; href=&#34;#some-problems&#34;&gt;#&lt;/a&gt; Some Problems&lt;/h1&gt;
&lt;p&gt;these may work&lt;br&gt;
&lt;span class=&#34;exturl&#34; data-url=&#34;aHR0cHM6Ly9naXRodWIuY29tL3J1c3RkZXNrL3J1c3RkZXNrL2lzc3Vlcy80NDAjaXNzdWUtMTE5MTAyMDIyNQ==&#34;&gt;https://github.com/rustdesk/rustdesk/issues/440#issue-1191020225&lt;/span&gt;&lt;/p&gt;
&lt;!-- ---

date: 2024-11-05 22:30:01
tags:
--- --&gt;</content>
        <updated>2024-11-05T14:43:46.000Z</updated>
    </entry>
</feed>
