树莓派配置

Requirement

  • iTerm2
  • zsh

查看已经安装的 shell

1
2
3
cat /etc/shells
# 修改默认shell
chsh -s /bin/zsh

zsh

  1. 启动命令纠错功能
1
2
vi ~/.zshrc
## uncomment ENABLE_CORRECTION

vi

  1. 开启语法高亮

    1
    2
    3
    cp /usr/share/vim/vimrc .vimrc
    echo 'syntax on' >> ~/.vimrc #开启语法高亮
    echo 'inoremap jj <Esc>' >> .vimrc #ESC键映射成两次j键
  2. 正常模式进入插入模式

    i,I,a,A,o,O,s,S
    i 是在光标所在的字符之前插入录入的文本
    I 是在光标所在行的行首插入需要录入的文本
    a 是在光标所在的字符之后插入需要录入的文本
    A 是在光标所在行的行尾插入需要录入的文本
    o 是光标所在行的下一行行首插入需要录入的文本
    O 是光标所在行的上一行行首插入需要录入的文本
    s 删除光标所在处的字符然后插入需要录入的文本
    S 删除光标所在行,在当前行的行首开始插入需要录入的文本
    cw 是删除从光标开始到单词结束的所有字符,然后插入需要录入的文本

  3. 命令模式

    :set nu 显示行号
    :set nonu 取消行号显示
    :n 定位到n行
    /{目标字符串} 关键字查找
    :n1,n2d 删除n1到n2行的内容

    vim 操作

制作树莓派镜像

1
2
3
4
diskutil list
diskutil eraseDisk FAT32 RASPBERRY /dev/disk2
diskutil unmountDisk /dev/disk2
sudo dd bs=4m if=2019-09-26-raspbian-buster-lite.img of=/dev/disk2

安装 jdk 及服务化

1
2
sudo apt install default-jdk
systemctl enable ddns.service # enable the service
1
2
3
4
5
6
7
8
9
10
11
12
13
# /etc/systemd/system/ddns.service

[Unit]
Description=ddns service
After=syslog.target

[Service]
User=pi
ExecStart=/opt/ddns/ddns.jar
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

系统设置

1
2
3
4
5
timedatectl set-timezone Asia/Shanghai

# install rust
rustup install nightly
cargo +nightly install shadowsocks-rust

rust 及系统 proxy 相关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
rustup self uninstall

export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup

#索引 https://docs.spring.io/spring-boot/docs/1.4.0.RC1/reference/html/deployment-install.html

$ curl https://sh.rustup.rs -sSf | sh -s -- --help
$ curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path
$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none
$ curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain nightly

# https://rust-lang.github.io/rustup/installation/other.html

apt proxy

sudo apt-get -o Acquire::http::proxy="socks5h://127.0.0.1:1080/" install de
fault-jdk

export ALL_PROXY=socks5://127.0.0.1:1080