newOr a b = if a then a else bexample may causing infinite loop:
newOr True (length [1..] > 0)| echo "\ | |
| Usage: $(basename $0) option1 | |
| more info | |
| even more" >&2 |
| #!/bin/bash | |
| # this script removes old amis | |
| # and related EBS snapshots | |
| set -e | |
| WORKING_DIRECTORY='/tmp/aws-amicleaner' | |
| VIRTUAL_ENV_DIR='/tmp/virtualenvs/py2.7' | |
| SCRIPT_URL='https://github.com/bonclay7/aws-amicleaner.git' |
| time_namelookup: %{time_namelookup}\n | |
| time_connect: %{time_connect}\n | |
| time_appconnect: %{time_appconnect}\n | |
| time_pretransfer: %{time_pretransfer}\n | |
| time_redirect: %{time_redirect}\n | |
| time_starttransfer: %{time_starttransfer}\n | |
| ----------\n | |
| time_total: %{time_total}\n |
| #!/bin/bash -e | |
| workdir=/tmp/packer | |
| pversion=0.10.1 | |
| which packer || { | |
| mkdir -p $workdir | |
| cd $workdir | |
| apt-get -qqy install unzip wget | |
| wget https://releases.hashicorp.com/packer/$pversion/packer_${pversion}_linux_amd64.zip && \ |
| docker run --rm -it -v ${PWD}/viadeo-aws-env:/tmp/viadeo-env aws-amicleaner /bin/bash | |
| amicleaner --mapping-key name --mapping-values jenkins_test --keep-previous 1 |
| docker run --rm -it -v ${PWD}/viadeo-aws-env:/tmp/viadeo-env aws-amicleaner /bin/bash | |
| amicleaner --mapping-key name --mapping-values jenkins_test --keep-previous 1 |
| docker run --rm -it -v ${PWD}/viadeo-aws-env:/tmp/viadeo-env aws-amicleaner /bin/bash | |
| amicleaner --mapping-key name --mapping-values jenkins_test --keep-previous 1 |
| version: '3.3' | |
| services: | |
| db: | |
| image: mysql:5.7 | |
| volumes: | |
| - db_data:/var/lib/mysql | |
| restart: always | |
| environment: | |
| MYSQL_ROOT_PASSWORD: somewordpress |
| # Get a formatted list of instances from an instance name (or a part of it) | |
| function instances_ips(){ | |
| local instance_name=$1 | |
| [ -z ${instance_name} ] && { echo "Missing instance name"; return 1; } | |
| aws ec2 describe-instances \ | |
| --filters Name=tag:Name,Values=${instance_name} \ | |
| --query 'Reservations[*].Instances[*].{ID:InstanceId, Name:Tags[?Key==`Name`].Value, PrivateIP:PrivateIpAddress, PublicIp:PublicIpAddress, State:State.Name}' \ | |
| --output json \ | |
| --region us-west-1 | jq -r ".[] | .[] | {Id: .ID, Name: .Name[0], PrivateIP: .PrivateIP, PublicIp: .PublicIp, State: .State}" |