共有 274 篇文章
Kidding
2022-07-29 - 2024-09-18

编写

编写kidding.html放在layouts/shortcodes/文件夹中

1<!-- layouts/shortcodes/kidding.html -->
2<s style="text-decoration: line-through;" title="{{ .Get "title" }}">{{ .Get "text" }}</s>

使用

1{{< kidding title="完全没理解" text="太棒了,我逐渐理解一切" >}}
太棒了,我逐渐理解一切
Heimu
2022-07-29 - 2024-09-18

编写

heimu.css文件放在themes/archie/assets/css/文件夹中

 1/* heimu.css */
 2
 3.heimu, .heimu a, a .heimu, .heimu a.new {
 4    background-color: #252525;
 5    color: #252525;
 6    text-shadow: none;
 7}
 8
 9.heimu:hover, .heimu:active,
10.heimu:hover .heimu, .heimu:active .heimu {
11    color: white !important;
12}
13
14.heimu:hover a, a:hover .heimu,
15.heimu:active a, a:active .heimu {
16    color: lightblue !important;
17}
18
19.heimu:hover .new, .heimu .new:hover, .new:hover .heimu,
20.heimu:active .new, .heimu .new:active, .new:active .heimu {
21    color: #BA0000 !important;
22}

编写heimu.html放在layouts/shortcodes/文件夹中

UEFI启动管理器rEFInd
2022-07-28 - 2024-09-18

安装rEFInd

https://github.com/techysy/rEFInd

1sudo apt-get install refind
  • 输入y继续执行,首次安装时,系统会询问你是否将rEFInd安装到ESP
  • 关闭安全启动

安装主题

1cd /boot/efi/EFI/refind
2mkdir themes
3cd themes
4git clone https://github.com/kgoettler/ursamajor-rEFInd.git

屏蔽多余启动项

先注释include themes/ursamajor-rEFInd/theme.conf,在选择界面使用delete删除不需要的启动项

生成cert.pem和key.pem
2022-07-27 - 2025-03-26
SSL
 1#1、生成RSA密钥的方法 
 2openssl genrsa -des3 -out key.pem 2048
 3#这个命令会生成一个2048位的密钥,同时有一个des3方法加密的密码,如果你不想要每次都输入密码,可以改成:
 4openssl genrsa -out key.pem 2048
 5#建议用2048位密钥,少于此可能会不安全或很快将不安全。
 6
 7#2、生成一个证书请求
 8openssl req -new -key key.pem -out cert.csr
 9#这个命令将会生成一个证书请求,当然,用到了前面生成的密钥key.pem文件
10#这里将生成一个新的文件cert.csr,即一个证书请求文件,你可以拿着这个文件去数字证书颁发机构(即CA)申请一个数字证书。CA会给你一个新的文件cert.pem,那才是你的数字证书。
11
12#如果是自己做测试,那么证书的申请机构和颁发机构都是自己。就可以用下面这个命令来生成证书:
13openssl req -new -x509 -key key.pem -out cert.pem -days 1095
14#这个命令将用上面生成的密钥key.pem生成一个数字证书cert.pem
15
16#3、使用数字证书和密钥 
17#有了key.pem和cert.pem文件后就可以在自己的程序中使用了,比如做一个加密通讯的服务器

go语言中调用

Hugo Install
2022-07-17 - 2024-09-18

GitHub

https://github.com/gohugoio/hugo.git

Build

  1. 使用官方编译版本
  2. 使用源码编译

http://pi.akvicor.com:7021/?p=199

1wget http://pi.akvicor.com:7021/file?f=1233 -O hugo_build.tgz
2tar -zxvf hugo_build.tgz
3cd hugo
4./build.sh

Install

1mv gopath/bin/hugo /usr/bin/hugo
2hugo version

Usage

 1# 版本和环境详细信息
 2hugo env
 3
 4# 创建新站点
 5hugo new site siteName
 6
 7# 创建文章
 8hugo new index.md
 9
10# 编译生成静态文件并输出到public目录
11hugo
12
13# 编译生成静态文件并启动web服务
14hugo server

主题

https://github.com/athul/archie

搜索功能
2022-07-14 - 2024-09-18

为hugo添加搜索功能,在content下创建search.html页面,添加以下内容

  1+++
  2title = "Search"
  3description = "Akvico's Blog"
  4date = "2022-07-14"
  5author = "Akvicor"
  6+++
  7
  8<style>
  9  /* 手机适配 */
 10  @media screen and (max-width: 500px) {
 11     .search{
 12       padding-right: 25px;
 13     }
 14
 15     .search input{
 16       width: 100%;
 17     }
 18
 19     .search button{
 20       display: none;
 21     }
 22  }
 23  /* 电脑适配 */
 24  @media screen and (min-width: 500px) {
 25      .search{
 26        width: 500px;
 27      }
 28
 29      .search input{
 30        width: 444px;
 31      }
 32  }
 33
 34  /* 通用样式 */
 35  .search{
 36    margin: auto;
 37  }
 38
 39  .search input{
 40    outline: none;
 41    border: 2px solid #c05b4d;
 42    height: 32px;
 43    padding: 10px;
 44  }
 45  .search button{
 46    outline: none;
 47    border: 0px;
 48    height: 56px;
 49    width:56px;
 50    position:absolute;
 51    background-color:#c05b4d ;
 52  }
 53  .search .icon{
 54    width: 28px;
 55    height: 28px;
 56  }
 57</style>
 58<div class="search">
 59  <input type="text" placeholder="" id="search-key" />
 60  <button onclick="search()">
 61    <svg t="1583982313567" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1271"
 62      width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink">
 63      <defs>
 64        <style type="text/css"></style>
 65      </defs>
 66      <path d="M694.857143 475.428571q0-105.714286-75.142857-180.857142T438.857143 219.428571 258 294.571429 182.857143 475.428571t75.142857 180.857143T438.857143 731.428571t180.857143-75.142857T694.857143 475.428571z m292.571428 475.428572q0 29.714286-21.714285 51.428571t-51.428572 21.714286q-30.857143 0-51.428571-21.714286l-196-195.428571q-102.285714 70.857143-228 70.857143-81.714286 0-156.285714-31.714286t-128.571429-85.714286-85.714286-128.571428T36.571429 475.428571t31.714285-156.285714 85.714286-128.571428 128.571429-85.714286T438.857143 73.142857t156.285714 31.714286 128.571429 85.714286 85.714285 128.571428T841.142857 475.428571q0 125.714286-70.857143 228l196 196q21.142857 21.142857 21.142857 51.428572z"
 67        p-id="1272" fill="#ffffff"></path>
 68    </svg>
 69  </button>
 70</div>
 71<h1 id="search-tip" style="color: #c05b4d;text-align: center;display: none;">Searching ...</h1>
 72<br />
 73<div id="result"></div>
 74
 75<script type="text/javascript">
 76  // enter
 77  window.onload = function() {
 78    document.onkeydown = function(ev) {
 79      var event = ev || event
 80      if (event.keyCode == 13) {
 81        search()
 82      }
 83    }
 84  }
 85
 86  // search
 87  function search() {
 88    key = document.getElementById("search-key").value;
 89    if (key === "") {
 90      return;
 91    }
 92    document.getElementById("search-key").value = "";
 93
 94    // tip
 95    document.getElementById("search-tip").innerText = "Searching ...";
 96    document.getElementById("search-tip").style.display = "block";
 97
 98    // clear
 99    var el = document.getElementById('result');
100    var childs = el.childNodes;
101    for (var i = childs.length - 1; i >= 0; i--) {
102      el.removeChild(childs[i]);
103    }
104
105    // xml
106    xmltext = new XMLHttpRequest;
107    xmltext.open("GET", "/index.xml", false);
108    xmltext.send();
109    resp = xmltext.responseXML;
110    items = resp.getElementsByTagName("item");
111    // search
112    var i = 0;
113    haveResult = false;
114    while (i < items.length) {
115      txt = items[i].getElementsByTagName("title")[0].innerHTML + items[i].getElementsByTagName("description")[0].innerHTML
116      if (txt.indexOf(key) > -1) {
117        haveResult = true;
118        title = items[i].getElementsByTagName("title")[0].innerHTML;
119        link = items[i].getElementsByTagName("link")[0].innerHTML;
120        time = items[i].getElementsByTagName("pubDate")[0].innerHTML;
121        mark = items[i].getElementsByTagName("description")[0].innerHTML;
122        addItem(title, link, time, mark)
123      }
124      i++;
125    }
126    if (!haveResult) {
127      document.getElementById("search-tip").innerText = "NULL";
128      document.getElementById("search-tip").style.display = "block";
129    }
130  }
131
132  // add
133  function addItem(title, link, time, mark) {
134    document.getElementById("search-tip").style.display = "none";
135    tmpl = "<article class=\"post\" style=\"border-bottom: 1px solid #e6e6e6;\" >" +
136      "<header class=\"post-header\">" +
137      "<h1 class=\"post-title\"><a class=\"post-link\" href=\"" + link + "\" target=\"_blank\">" + title + "</a></h1>" +
138      "<div class=\"post-meta\">" +
139      " <span class=\"post-time\">" + time + "</span>" +
140      "</div>" +
141      " </header>" +
142      "<div class=\"post-content\">" +
143      "<div class=\"post-summary\">" + mark + "</div>" +
144      "<div class=\"read-more\">" +
145      "<a href=\"" + link + "\" class=\"read-more-link\" target=\"_blank\">Read more</a>" +
146      "</div>" +
147      " </div>" +
148      "</article>"
149    div = document.createElement("div")
150    div.innerHTML = tmpl;
151    document.getElementById('result').appendChild(div)
152  }
153</script>
Abbr
2022-07-14 - 2024-09-18

编写

编写abbr.html放在layouts/shortcodes/文件夹中

1<!-- layouts/shortcodes/abbr.html -->
2<abbr title="{{ .Get "title" }}">{{ .Get "text" }}</abbr>

使用

1{{< abbr title="Ocean University of China" text="OUC" >}}
OUC
Shortcodes
2022-07-14 - 2024-09-18
为防止 shortcodes 语法被博客生产 短代码, 加 * 使用 {{</* myshortcode */>}}
Golang Install
2022-07-14 - 2024-09-18

选择要下载的版本

https://go.dev/dl/

下载安装

1# 下载
2wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz
3# 解压
4mv go1.18.4.linux-amd64.tar.gz go.tar.gz
5tar -C /usr/local -xzf go.tar.gz

配置环境变量

 1# 编辑.bashrc
 2vim /root/.bashrc
 3# 添加如下内容
 4export GOPATH=/root/go
 5export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
 6# 设置代理
 7# Set the GOPROXY environment variable
 8export GOPROXY=https://goproxy.io,direct
 9# Set environment variable allow bypassing the proxy for specified repos (optional)
10export GOPRIVATE=git.mycompany.com,github.com/my/private

使环境变量生效

1source /root/.bashrc

安装完成

查看安装的go版本

Debian APT源
2022-07-14 - 2024-09-18

编辑

1apt install apt-transport-https ca-certificates
2vim /etc/apt/sources.list

Debian 11

 1# Official & Contrib & Non-free
 2deb https://deb.debian.org/debian bullseye main contrib non-free
 3deb-src https://deb.debian.org/debian bullseye main contrib non-free
 4
 5deb https://deb.debian.org/debian-security bullseye-security main contrib non-free
 6deb-src https://deb.debian.org/debian-security bullseye-security main contrib non-free
 7
 8deb https://deb.debian.org/debian bullseye-updates main contrib non-free
 9deb-src https://deb.debian.org/debian bullseye-updates main contrib non-free
10
11# Backports
12deb https://deb.debian.org/debian bullseye-backports main contrib non-free
13deb-src https://deb.debian.org/debian bullseye-backports main contrib non-free

Debian 12

 1# apt install apt-transport-https ca-certificates
 2
 3deb https://deb.debian.org/debian/ bookworm contrib main non-free non-free-firmware
 4deb-src https://deb.debian.org/debian/ bookworm contrib main non-free non-free-firmware
 5
 6deb https://deb.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
 7deb-src https://deb.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
 8
 9deb https://deb.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
10deb-src https://deb.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
11
12deb https://deb.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
13deb-src https://deb.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
开启SSH服务
2022-07-14 - 2024-09-18

安装SSH服务

1apt-get install openssh-server

修改SSH配置文件

1vim /etc/ssh/sshd_config

配置项

 1# 监听端口
 2Port 22
 3
 4# 监听地址
 5ListenAddress 0.0.0.0
 6
 7# 是否允许root用户登录
 8PermitRootLogin yes
 9
10# 允许密码认证
11PasswordAuthentication yes
12
13# 允许密钥认证
14PubkeyAuthentication yes
15
16# 客户端保活
17ClientAliveInterval 60
18ClientAliveCountMax 3

Message of the Day

内容放在vim /etc/motd,可以用 UpdateMotd 动态生成的内容,也可以直接使用landscape-common