Notion - 建立目錄
14 Mar 2023在有大小標題的情況下,notion 有內建的方法幫助使用者快速建立目錄:
- 在想建立目錄的地方使用命令 /toc
- 在想建立目錄的地方點擊「+」,在 Advanced blocks 欄位下找到 Table of Content,點下去
在有大小標題的情況下,notion 有內建的方法幫助使用者快速建立目錄:
之前在已經有 Windows 系統的電腦安裝了 Ubuntu 雙系統,這邊做的筆記記錄一下!
共有五個分區,以下僅供參考,實際分區要自己的硬碟大小等而定:
設置安裝啟動設備,選擇 EFI 分區的設備號,彈出視窗確認後按確認。
我在安裝 Ubuntu 的時候有遇到這個錯誤,照著以下步驟操作解決問題:
shutdown /t /fw /t 0
會進入 BIOS頁面ipconfig
sudo apt install net-tools
sudo apt install tree
Vim
sudo apt-get install vim
Visual studio code
sudo apt update
sudo apt install software-properties-common apt-transport-https curl
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
sudo apt update
sudo apt install code
# 測試成功了沒
code .
Git
sudo apt update
sudo apt install git
Docker
sudo apt-get install docker.io
service docker status
出現 Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
錯誤的解決方式:
建立 docker 群組
sudo groupadd docker
把當前使用者加到群組
sudo gpasswd -a $USER docker
激活更改/重啟docker
newgrp docker
sudo systemctl restart docker
設置 ssh
cd ~/.ssh
pwd
# /home/wei/.ssh
sudo ssh-keygen -o -t rsa -C "your_github_mail_address"
pwd
的路徑加上 /.ssh)cat /home/wei/.ssh/id_rsa.pub
,將公鑰複製起來sudo chmod 755 /home/wei/.ssh/id_rsa
,後面的路徑改成自己的 id_rsa 位置,來設置權限測試是否成功:ssh -T git@github.com
成功的話會顯示:Hi 用戶名! You’ve successfully authenticated 等字
Go
sudo apt update
sudo apt upgrade
sudo apt search golang-go
sudo apt search gccgo-go
sudo apt install golang-go
# check
go version
資料來源:
https://www.bilibili.com/read/cv16108268?from=search
https://zhuanlan.zhihu.com/p/268620595
https://www.myfreax.com/how-to-install-visual-studio-code-on-ubuntu-20-04/
查看目前的 hostname
hostname
修改 etc/hostname
sudo vim etc/hostname
修改 etc/hosts
sudo vim etc/hosts
運行以下指令
sudo hostname -F /etc/hostname
重新開啟 terminal ,應該就可以看到新的 hostname 了!
照著 Deep into Container — Build your own container with Golang 這篇教學操作的時候,發現每次結束都需要執行:
sudo mount -t proc proc /proc
上網查之後,發現將 must(syscall.Mount("proc", "proc", "proc", 0, ""))
改為以下程式碼,聲明這個新的 mount namespace 獨立:
must(syscall.Mount("", "/", "", syscall.MS_PRIVATE|syscall.MS_REC, ""))
defualtMountFlags := syscall.MS_NOEXEC | syscall.MS_NOSUID | syscall.MS_NODEV
must(syscall.Mount("proc", "/proc", "proc", uintptr(defualtMountFlags), ""))
wg.Wait()
後可以被重複使用package main
import (
"fmt"
"sync"
"time"
)
func main() {
wg := &sync.WaitGroup{} // 宣告一個 Waitgroup
for i := 0; i < 10; i++ {
wg.Add(1) // 需要等待的 Goroutine 數量加一
id := i
go func() { // 啟動 Goroutine
defer func() { // 每次結束 Goroutine,使用 wg.Done() 通知 waitgroup 需要等待的 goroutine 減少一個
fmt.Printf("Task %d done\n", id)
wg.Done()
}()
worker(id)
}()
}
wg.Wait() // 將 main() block 住,直到所有 Goroutine 被執行完(counter == 0),避免 main() 在 goroutine 們還沒執行完就結束了
}
func worker(id int) {
fmt.Printf("Worker %d starting\n", id)
time.Sleep(time.Second)
}