Install Homebrew on your laptop
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install some packages you like
brew update
| function stop_ecs_service_tasks () { | |
| local cluster_name=$1 | |
| local service_name=$2 | |
| local wait_time=${3:-10} | |
| local tasks | |
| local task | |
| # Get tasks | |
| tasks=$(aws --output json \ | |
| ecs list-tasks \ |
| function get_ecs_service_instances () { | |
| local cluster_name=$1 | |
| local service_name=$2 | |
| local tasks | |
| local container_arns | |
| local ec2_instance_ids | |
| echo "Cluster: ${cluster_name}" | |
| echo "Service: ${service_name}" | |
| echo "EC2 instances:" |
| #!/bin/bash | |
| function delete_image () { | |
| local repo_name=$1 | |
| local image_digest=$2 | |
| echo "${image_digest}" | |
| aws --out=json \ | |
| ecr \ | |
| batch-delete-image \ | |
| --repository-name="${repo_name}" \ |
| function update_ecs_agent () { | |
| local cluster_name=$1 | |
| local container_arns | |
| local container_arn | |
| # Get container instances | |
| container_arns=$(aws --output json \ | |
| ecs list-container-instances \ | |
| --cluster "${cluster_name}" | \ | |
| jq '.containerInstanceArns[]' | tr -d '"' | tr "\n" " ") | |
| for container_arn in ${container_arns}; do |
| function get_ecs_cluster_instance_ips () { | |
| local cluster_name=$1 | |
| local container_arns | |
| local ec2_instance_ids | |
| # Get container instances | |
| container_arns=$(aws --output json \ | |
| ecs list-container-instances \ | |
| --cluster "${cluster_name}" | \ | |
| jq '.containerInstanceArns[]' | tr -d '"' | tr "\n" " ") |
| function get_ecs_service_instance_ips () { | |
| local cluster_name=$1 | |
| local service_name=$2 | |
| local tasks | |
| local container_arns | |
| local ec2_instance_ids | |
| # Get tasks | |
| tasks=$(aws --output json \ | |
| ecs list-tasks \ |
| { | |
| "id": 3, | |
| "title": "cAdvisor Templated", | |
| "originalTitle": "cAdvisor Templated", | |
| "tags": [], | |
| "style": "dark", | |
| "timezone": "browser", | |
| "editable": true, | |
| "hideControls": false, | |
| "sharedCrosshair": false, |
| { | |
| "title": "Templated Graphs", | |
| "services": { | |
| "filter": { | |
| "list": [ | |
| { | |
| "type": "filter", | |
| "name": "host", | |
| "query": "sensu.*", | |
| "includeAll": true, |
| utime(){ date -d @$1; } | |
| utime(){ date -d "1970-01-01 GMT $1 seconds"; } | |
| utime(){ awk -v d=$1 'BEGIN{print strftime("%a %b %d %H:%M:%S %Y", d)}'; } | |
| utime(){ perl -e "print localtime($1).\"\n\""; } | |
| utime(){ python -c "import time; print(time.strftime('%a %b %d %H:%M:%S %Y', time.localtime($1)))"; } | |
| [root@test test]# utime(){ date -d @$1; } | |
| [root@test test]# utime 1273817956 | |
| Fri May 14 14:19:16 CST 2010 | |