Install Hugo #
brew install hugo
brew install hugo
WIP
购买了Google Suite帐号以后,我的备份需求大部分迁移到了Google Drive上,以下是一些与GCP Virtual Instance有关的性能测试
Rclone Mount Config
rclone mount gd: /mnt/gdrive --buffer-size 1G --vfs-read-chunk-size 256M --vfs-read-chunk-size-limit 2G --allow-non-empty --allow-other --dir-cache-time 12h >/dev/null 2>&1 &
后来发现这套mount config是针对mount plex share这种只读文件使用的,对于只写不读的情况应该更改另外两个flag
rclone mount --config ~/.config/mountconfig.conf [Mountname] [LOCATION] --drive-chunk-size 32M --buffer-size 256M --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G --vfs-cache-mode writes --vfs-cache-max-age 0h0m10s --allow-non-empty --allow-other --dir-cache-time 12h > /dev/null 2>&1 &
根据这个github issue, –drive-chunk-size 会影响传输速度,default 8M其实已经够用了,这里调到32M,其他几个flag对读取有帮助,对写入帮助不大
...Work in progress…
Update 2020/05/11 Caddy V2 has been released! I will upgrade the Caddyfile to v2 format(JSON).
Go to https://cdn.moeelf.com/ Login using cloudflare credentials
Set up a CNAME or A entry to origin server, then add the cloudflare *.cdn.cloudflare.net CNAME to your DNS service provider
You can enable CDN as well
touch /etc/caddy/Caddyfile
v.lightsailjp.zb8.stream {
gzip
tls {
dns cloudflare
}
log /var/log/caddy/caddy.v2ray.log
proxy /leet 127.0.0.1:13337 {
websocket
header_upstream -Origin
}
}
t.lightsailjp.zb8.stream {
gzip
tls {
dns cloudflare
}
log /var/log/caddy/caddy.trojan.log
proxy / https://baidu.com
proxy /leet 127.0.0.1:13338 {
websocket
header_upstream -Origin
}
}
embyjp.zb8.stream {
gzip
tls {
dns cloudflare
}
log /var/log/caddy/caddy.emby.log
proxy / 127.0.0.1:8096 {
header_upstream -Origin
websocket
}
}
mkdir /var/log/caddy
Download https://raw.githubusercontent.com/caddyserver/caddy/master/dist/init/linux-systemd/caddy.service to /etc/systemd/systemd
...The use of const is very tricky in C.
char *p; // P points to any char, you can modify the char
const char *p; // P can point to any char, you can't modify the char via *p
char * const p = &a; // P only points to address &a and connot be changed. However the char content can be modified via *p.
const char * const p; = &b; //P only points to address &b and cannot be changed. You can't modify the char content via *p.
The code snipet above illustrated three way to use const with pointer. This still looks very confusing. There is a rule to check where const applies to.
...One thing bothers me the most is that last time I installed Arch on a VMware Workstation guest VM. I was not able to get open-vm-tools functions working. This includes drag/drop between host and guest, shared folder, and clipboard share. This time I tried I managed to get it working on a KDE based Arch. I’m not sure if the issue is DE-specific as last time when I tried it I was using Xfce4 as my DE. Anyways here is how I got it to work.
...#1. Clean Pacman Cache
sudo -i
pacman -Scc
#2. Create a exclude list
cat /root/backup/exclude.txt
/tmp/*
/root/backup/*
/proc
/dev
/sys
/home #If home is mount to another partition you need to exclude home here
/boot/EFI
#3. Create tarball
tar --exclude-form=/root/backup/exclude.txt -czpvf /root/backup/arch-back.tar.gz /
You may ignore this setp if you have a live cd to recover the OS. If you don’t, it would be great to have a second minimal OS installed in your disk. In my case I have a debian intalled in my disk’s /dev/sda5 partition (Arch uses /dev/sda1-4). In this case, if I format /dev/sda2(where arch’s root fs is located). I should be able to boot into debian to recover the tarball I backed up.
...Gdisk is more like a interactive tool. Below is the setup for a BIOS/GPT configuration
o #create new table
n [default] [+1M] [ef02] # create a 1MiB space for grub
n [default] [+20G] [8300] # create rootfs
n [default] [+4G] [8200] # create swap
n [default] [+20G] [8300] # create home
n [default] [default] [8300] # remaining is used by other os
w
And here is a partition scheme for UEFI/GPT configuration:
/dev/sda1 100M UEFI ef00
/dev/sda2 1000M Boot 8000
/dev/sda3 20G Root 8304
/dev/sda4 20G Home 8300
/dev/sda5 4G Swap 8200
A mebibyte partition needs to be located in first 2TB of the disk. For details, check arch wiki arch wiki
...This post was written by me a few years ago. I decide to post it here cuase I might need it later.
如果有使用wifi的话,使用如下命令连接到Wifi
iwconfig #List all wireless network interface #
wifi-menu [Interface] #Connect to network #
OR Use Android USB Tethering
ls /sys/class/net
dhcpcd interface
ls /sys/firmware/efi/efivars #
timedatectl set-ntp true #
一般而言,如果uefi启动,需要分一个100m的fat32分区作为uefi使用
...I’m used to the bindings provided by Oh-my-zsh git plugin in my archlinx. However when working on my main Windows 10 workstations the git windows client comes with mingw bash. Thus I was looking for a way to get zsh installed on windows. There are actually two way to do this. You can use WSL(Windows Subsystem for Linux) or MSYS2. I tried WSL for a few month. It was pretty good. However the cavet is although you can install zsh via package manager. You cannot set it as default shell. So I have to put zsh in my .bashrc and have bash run zsh. This is not a elegant solution. Then I found another way to do this, which is a tool called MSYS2.
...Photon by Vmware is an container enabled os. It comes with docker preinstalled as a minimal ova file. (https://github.com/vmware/photon/wiki/Downloading-Photon-OS)
Remember the number indicates the priority of the if. The lower the number, the higher the priority.
Photon’s default iptables drop all incoming traffice. Edit iptables to change the firewall rule. To presist the changes:
/etc/systemd/scripts/iptables is a script thats executed on iptables service start. so you can add your rules at the end of that script and the restore will be automatic.
...