1. 程式人生 > 實用技巧 >2020牛客多校(三) G Operating on a Graph(並查集+stl)

2020牛客多校(三) G Operating on a Graph(並查集+stl)

注意要 僅限 DNS

獲取咱的Keyhttps://dash.cloudflare.com/profile

先在控制面板找到咱的目前IP,然後到Cloudflare中新建一個A記錄,如:ddns.yourdomain.com,指向咱的當前IP

下載指令碼

1 wget https://raw.githubusercontent.com/yulewang/cloudflare-api-v4-ddns/master/cf-v4-ddns.sh

這裡需要填寫一個能返回咱的當前IP的網頁地址,下面提供一些

1 $ curl ifconfig.me
2 $ curl icanhazip.com
3 $ curl ident.me
4 $ curl ipecho.net/plain 5 $ curl whatismyip.akamai.com 6 $ curl tnx.nl/ip 7 $ curl myip.dnsomatic.com 8 $ curl ip.appspot.com 9 $ curl -s checkip.dyndns.org | sed 's/.*IP Address: \([0-9\.]*\).*/\1/g'

修改指令碼

# API key, see https://www.cloudflare.com/a/account/my-account,
# 上一步獲取的CFKEY
CFKEY=
#輸入你需要解析用來DDNS解析的根域名 eg: example.com
CFZONE=
# 暫時空著
CFID=
# 登陸CF的Username, eg: [email protected]
CFUSER=
# 填寫用來DDNS解析的二級域名,與上面設定的要一致, eg: ddns.yourdomain.com
CFHOST=
# Cloudflare TTL for record, between 120 and 86400 seconds
CFTTL=3600
# Get domain ID from Cloudflare using awk/sed and python json.tool
GETID=true
# Ignore local file, update ip anyway
FORCE=false
# 填寫上一步能正確返回咱的當前IP的網址, other examples are: bot.whatismyipaddress.com, https://api.ipify.org/ ...
WANIPSITE="myip.dnsomatic.com"

執行指令碼

1 chmod +x cf-ddns.sh
2 ./cf-ddns.sh

第一次執行後,會顯示咱用於DDNS解析的二級域名的CFID,記錄下來

將CFID填入到配置檔案中的CFID處

再次執行

1 ./cf-ddns.sh

設定自動執行

1 crontab -e
2 #不知道這樣寫對不對xD
3 0 * * * * /root/cf-ddns.sh >/dev/null 2>&1