使用
1 | cat /proc/mounts |
获取挂载选项并填入/etc/fstab中.
1 | cat /proc/mounts |
获取挂载选项并填入/etc/fstab中.
torch1.6版本中,对torch.save进行了更改.The 1.6 release of PyTorch switched torch.save to use a new zipfile-based file format. torch.load still retains the ability to load files in the old format. If for any reason you want torch.save to use the old format, pass the kwarg _use_new_zipfile_serialization=False.
升级pytorch到1.6版
使用pytorch读入,再保存 1
2
3
4
5
6device = 'cuda'
net = model()
saved_net = torch.load("nozip.pth", map_location=device)
net.load_state_dict(saved_net)
net.to(device=device)
torch.save(net.state_dict(), 'nozip.pth', _use_new_zipfile_serialization=False)
1 | sudo apt install gcc-5 g++-5 |
1 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 7 |
此处假设原版本为7
1 | sudo update-alternatives --config gcc |
输入 1
ls
1
ls (hd0,gpt1)/
1
set
1
2
3
4
5set prefix=(hd0,gpt1)/grub
set root=(hd0,gpt1)
insmod linux
insmod normal
normal1
sudo update-grub
首先按这里使用docker部署seafile 注意将映射到宿主机的端口换成80以外的端口(如81),避免与后面的caddy冲突 启动后在浏览器登录,在"头像"->"系统管理"->"设置"中,将"FILE_SERVER_ROOT"中的域名换成ip地址,就可以上传下载文件了. 还有两步验证什么的.
docker-compose的一些常用命令: 1
2
3
4
5docker-compose up -d
docker-compose down #销毁
docker-compose start
docker-compose stop
docker-compose ps #查看docker镜像
然后安装caddy,生成证书 1
2
3echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt install caddy
openssl req -x509 -newkey rsa:2048 -sha256 -nodes -keyout key.pem -out cert.pem -days 3650 -subj "/CN=****"1
2
3
4
5
6
7
8
9:443 {
tls cert.pem key.pem
reverse_proxy 127.0.0.1:81
}
:444 {
tls cert.pem key.pem
reverse_proxy 127.0.0.1:82
} #假如有其他端口也要使用https
然后, 1
2caddy run #测试是否正常
caddy start #后台运行
根据这里设置seafile的nginx和seahub_settings.py,其中nginx的ip地址改为网卡docker0的ip,端口为onlyoffice在宿主机的端口,在本文中为780.
然后在seafile的docker-compose.yml中加入: 1
2
3
4
5
6
7
8
9onlyofficeds:
image: onlyoffice/documentserver:latest
container_name: oods
ports:
- "780:80"
volumes:
- /root/seafile/oods/default.json:/etc/onlyoffice/documentserver/default.json
networks:
- oods-net1
2
3networks:
seafile-net:
oods-net:
其中default.json文件那行可以先不写,运行容器的时候从容器中复制一份出来之后找到rejectUnauthorized并改为false.(使用了自签名证书时需要此步) 也可以在容器内执行: 1
/var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/default.json -I -e 'this.services.CoAuthoring.requestDefaults.rejectUnauthorized=false'
或者,使用snap部署onlyoffice: 首先根据这里安装snap. 然后依次执行: 1
2
3snap install onlyoffice-ds
snap set onlyoffice-ds onlyoffice.ds-port=780
vi /var/snap/onlyoffice-ds/current/etc/onlyoffice/documentserver/default.json
最后,在caddy配置文件中加入 1
2
3basicauth /onlyofficeds/* {
用户名 hash码
}
ISO文件放在某个分区的根目录,在本文中是sda7,ushendu在sda8
修改文件/etc/grub.d/40_custom(不要直接改文件/boot/grub/grub.cfg),加上以下几行 1
2
3
4
5
6
7
8
9
10
11
12menuentry "Debian live" {
set isofile="/debian-live-10.2.0-amd64-xfce.iso"
loopback loop (hd0,7)$isofile
linux (loop)/live/vmlinuz-4.19.0-6-amd64 boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img-4.19.0-6-amd64
}
menuentry "UShenDu" --class windows --class os {
insmod part_gpt
insmod fat
set root='hd0,gpt8'
chainloader /EFI/boot/bootx64.efi
}1
sudo update-grub
1 | cd /etc/NetworkManager/system-connections |
使用 cat 命令查看 Linux 中已保存的 WiFi 配置文件,在 WiFi-Security 段的 psk 位置可以查看到无线密码。
1 | sudo ufw enable |
1 | sudo ufw status verbose |
1 | sudo ufw allow 53 |
Add 'delete' after 'ufw' in the above command. 1
2sudo ufw delete deny 80/tcp
sudo ufw delete allow ssh
1 | sudo ufw reset |
编写一个脚本mount-sda6.service,放在/etc/systemd/system/下 1
2
3
4
5
6
7
8[Unit]
Description=mount sda6 for backup
[Service]
ExecStart=/bin/bash -c "mount -o compress=zstd /dev/sda6 /media/backup"
[Install]
WantedBy=multi-user.target
使用systemctl list-unit-files --type=service命令。 1
sudo systemctl list-unit-files --type=service|grep mount-sda6
1
mount-sda6.service disabled
1 | sudo systemctl enable mount-sda6 |
1 | sudo systemctl start mount-sda6 |
1 | sudo systemctl status mount-sda6 |
显示如下: 1
2
3
4
5 Loaded: loaded (/etc/systemd/system/mount-sda6.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2019-12-13 22:11:32 CST; 12h ago
Main PID: 939 (code=exited, status=0/SUCCESS)
12月 13 22:11:32 ki-PC systemd[1]: Started mount sda6 for backup.
1 | sudo reboot |