Clipboard

Contents
Note
A handy clipboard of code snippets I use often
Linux
Change DNS servers
echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
echo 'nameserver 119.29.29.29' >> /etc/resolv.conf
Sync system time
sudo timedatectl set-timezone 'Asia/Shanghai'
apt-get install -y ntpdate
ntpdate time.apple.com
Allow password SSH login on GCP
#Ubuntu
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
#debian/centos/rhel
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
Request an E1 certificate with acme.sh
#install
curl https://get.acme.sh | sh
#Cloudflare DNS credentials
export CF_Token="cf api token"
export CF_Account_ID="cf domain account id"
#default to Let's Encrypt
acme.sh --set-default-ca --server letsencrypt
#issue a certificate once
acme.sh --issue -d "flandre.vip" -d "*.flandre.vip" --dns dns_cf --force --server letsencrypt
#generate an acme id
curl https://get.acme.sh | sh
#form for requesting E1
https://docs.google.com/forms/d/e/1FAIpQLScCWnApP2eUk4cA6y5cFOENlm5S2StVedrqYNzeNdTPoArzwA/viewform
#issue again after Thursday and you get an ECC certificate signed by E1
acme.sh --issue -d "flandre.vip" -d "*.flandre.vip" --dns dns_cf --force --server letsencrypt \ --key-file /path/privkey.pem \ --fullchain-file /path/fullchain.pem
Assorted Linux scripts
Trojan panel
#install/update
source <(curl -sL https://git.io/trojan-install)
#uninstall
source <(curl -sL https://git.io/trojan-install) --remove
x-ui
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
warp-go
wget -N https://raw.githubusercontent.com/fscarmen/warp/main/warp-go.sh && bash warp-go.sh
Unblock NetEase Music
#install Node 19.x.x
curl -sL https://deb.nodesource.com/setup_19.x | bash -
apt install -y nodejs git
#one-click script
curl -fsSLO https://raw.githubusercontent.com/UnblockNeteaseMusic/install-scripts/master/server/install.sh && sudo bash install.sh