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
| # get current ec2 AutoScaling group name | |
| # note: change region option as yours | |
| aws autoscaling describe-auto-scaling-instances --region us-east-1 --output text --query=AutoScalingInstances[].AutoScalingGroupName --instance-ids=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) |
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
| #!/usr/bin/env bash | |
| # 免翻墙安装Go tools | |
| branch="release-branch.go1.4" | |
| mkdir -p $GOPATH/src/golang.org/x | |
| git clone -b $branch git@github.com:golang/tools.git $GOPATH/src/golang.org/x/tools | |
| git clone git@github.com:golang/net.git $GOPATH/src/golang.org/x/net | |
| cd $GOPATH | |
| go install golang.org/x/tools/cmd/goimports |
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
| #!/usr/bin/env bash | |
| #################################################################### | |
| # Usage: | |
| # Save all docker images to tar files for copy to another machine | |
| #################################################################### | |
| images=$(docker images | awk 'NR>1 && $1 != "<none>" {printf("%s:%s\n", $1, $2)}') | |
| for image in $images | |
| do |
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 | |
| # | |
| # chkconfig: 2345 55 25 | |
| # Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx | |
| # For Debian, run: update-rc.d -f nginx defaults | |
| # For CentOS, run: chkconfig --add nginx | |
| # | |
| ### BEGIN INIT INFO | |
| # Provides: nginx | |
| # Required-Start: $all |
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
| // javascrpt布尔值的类型转换 | |
| console.log(Boolean(NaN)); // flase | |
| console.log(Boolean(null)); // false | |
| console.log(Boolean(undefined)); // false | |
| console.log(Boolean(0)); // false | |
| console.log(Boolean([])); // true 注意这里与python不同 | |
| console.log(Boolean({})); // true 注意这里与python不同 |
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
| nocache = "&nocache=" + Math.random() * 1000000 | |
| request = new ajaxRequest() | |
| request.open("GET", "urlget.php?url=oreilly.com" + nocache, true) | |
| // 与post相比, get 请求不需要设置header | |
| request.onreadystatechange = function() | |
| { | |
| if (this.readyState == 4) | |
| { | |
| if (this.status == 200) |
NewerOlder