Skip to content

Instantly share code, notes, and snippets.

View crazygit's full-sized avatar
🏠
Working from home

Crazygit crazygit

🏠
Working from home
  • ChengDu, SiCuan, China
  • 09:14 (UTC +08:00)
View GitHub Profile
@crazygit
crazygit / get_autosaling_name.sh
Created April 14, 2017 06:54
get aws ec2 autoscaling group name
# 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)
@crazygit
crazygit / install_go_tools.sh
Last active May 11, 2025 23:10
免翻墙安装Go tools
#!/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
@crazygit
crazygit / save_docker_images
Last active April 6, 2016 13:14
Save all docker images to tar files for copy to another machine
#!/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
@crazygit
crazygit / nginx
Last active August 29, 2015 14:14 — forked from vdel26/nginx
#!/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
@crazygit
crazygit / js_boolean.js
Last active August 29, 2015 13:57
javascript学习笔记
// 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不同
@crazygit
crazygit / ajax_get.js
Last active December 26, 2015 20:39
an example of send an ajax request
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)