This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s" \ $(aws_prompt_info) | |
| $(aws sts assume-role \ | |
| --role-arn arn:aws-cn:iam::xxxx:role/xxxx \ | |
| --role-session-name MySessionName \ | |
| --query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \ | |
| --output text)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func worker(jobChan <-chan Job) { | |
| for job := range jobChan { | |
| process(job) | |
| } | |
| } | |
| // make a channel with a capacity of 100. | |
| jobChan := make(chan Job, 100) | |
| // start the worker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while true ; do ./check_domain.sh & sleep 5; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| IP=${1:-"221.125.113.13"} | |
| echo $IP | |
| echo 1 > /proc/sys/net/ipv4/ip_forward | |
| iptables -F | |
| iptables -t nat -F | |
| iptables -X |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| DOMAIN="us0.0bad.com" | |
| IP=`dig +short $DOMAIN` | |
| OLD_IP=`cat ip.txt` | |
| if [ "$OLD_IP" = "$IP" ]; then | |
| echo "query $DOMAIN address: $IP" >> query_ip.log | |
| else | |
| echo "query $DOMAIN address changed, old: $OLD_IP, new: $IP" >> query_ip.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt-get update | |
| apt-get install -y \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| software-properties-common | |
| curl -fsSL https://download.daocloud.io/docker/linux/ubuntu/gpg | sudo apt-key add - | |
| add-apt-repository \ | |
| "deb [arch=$(dpkg --print-architecture)] https://download.daocloud.io/docker/linux/ubuntu \ | |
| $(lsb_release -cs) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| apt-get upgrade | |
| apt-get update | |
| apt-get install \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| software-properties-common -y | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| user=$1 | |
| group=${2:-wheel} # wheel/sudo | |
| if [ -z "$user" ]; then | |
| exit 1 | |
| fi | |
| home=/home/$user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use the adduser command to add a new user to your system. | |
| adduser #{username} | |
| # Use the usermod command to add the user to the sudo group. | |
| usermod -aG sudo #{username} | |
| # Test sudo access on new user account | |
| su - #{username} | |
| sudo ls -la /root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 检测浏览器的 User Agent 应该是非常简单的事情 | |
| // 微信在 Android 下的 User Agent | |
| mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352 | |
| // 微信在 iPhone 下的 User Agent | |
| mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0 | |
| // 通过javascript判断 | |
| // 很容易看出来,微信的 User Agent 都有‘micromessenger’字符串标示,我们判断是否含有这些字符串就OK了 | |
| function isWeixinBrowser(){ |
NewerOlder