This file contains 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 | |
if [[ $# -eq 1 ]] | |
then | |
aws codepipeline get-pipeline \ | |
--name "${1}" \ | |
--query pipeline.roleArn \ | |
--output text | |
else | |
for pipeline in $( aws codepipeline list-pipelines --query 'pipelines[].name' --output text ) |
This file contains 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
$ # Arrays... | |
$ | |
$ foo=( word 'this has spaces' ) | |
$ | |
$ # Unless you treat it like an array, | |
$ # it just behaves like a scalar with | |
$ # the first element of the array. | |
$ echo $foo | |
word | |
$ echo ${#foo} |
This file contains 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
$ foo=1 | |
$ | |
$ # subshell | |
$ ( | |
> foo=2 | |
> ) | |
$ echo $foo | |
1 | |
$ # not a subshell | |
$ { |
This file contains 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 | |
set -o errexit | |
# DO_KEY_CONFIG_FILE should contain one line similar to the following with a Digital Ocean read key | |
# header = "Authorization: Bearer 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" | |
DO_KEY_CONFIG_FILE=${DO_KEY_CONFIG_FILE:?Must specify DO_KEY_CONFIG_FILE} | |
BASE="https://api.digitalocean.com" |
This file contains 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 | |
MAC=$( curl -fs http://169.254.169.254/2016-09-02/meta-data/network/interfaces/macs/ ) | |
VPC_CIDR=$( curl -fs http://169.254.169.254/2016-09-02/meta-data/network/interfaces/macs/${MAC%/}/vpc-ipv4-cidr-block/ ) | |
BASE_IP=${VPC_CIDR%/*} | |
ABC_IP=${BASE_IP%.*} | |
D_IP=${BASE_IP##*.} | |
D_IP=$(( D_IP + 2 )) | |
RESOLVER_IP=${ABC_IP}.${D_IP} |
This file contains 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 | |
[[ $# -eq 0 ]] || { | |
cat <<EOF >&2 | |
Usage: ${0##*/} | |
Prompts for Role and Password and outputs the hash in the correct format for a | |
"CREATE ROLE ... PASSWORD 'xxx';" in PostgreSQL. | |
EOF |
This file contains 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 -e | |
[[ $# -eq 1 ]] || { | |
cat <<EOF >&2 | |
Usage. ${0##*/} OAI-Id | |
EOF | |
exit 1 | |
} | |
This file contains 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 -e | |
[[ $# -le 2 ]] || { | |
cat <<EOF >&2 | |
Usage: ${0##*/} environment application | |
Parameters: | |
environment - dev, staging, production, etc | |
application - name of application |
This file contains 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 | |
SSH_AGENT_FIX_ENV_FILE="${SSH_AGENT_FIX_ENV_FILE:=$HOME/tmp/ssh-agent-env}" | |
SSH_AGENT_FIX_ENV_DIR=$( dirname ${SSH_AGENT_FIX_ENV_FILE} ) | |
[[ -d ${SSH_AGENT_FIX_ENV_DIR} ]] || { | |
mkdir -p $SSH_AGENT_FIX_ENV_DIR | |
} | |
env \ |
This file contains 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 | |
NUMBER_OF_RETRIES={NUMBER_OF_RETRIES:-5} | |
WAIT_IN_SECONDS=${WAIT_IN_SECONDS:-30} | |
URL="${1:-127.0.0.1/index.php}" | |
URL_HASH="$( echo -n "${URL}" | cksum | sed 's/\s//g' )" | |
LOCK_FILE="/tmp/.page_ok.${URL_HASH}" | |
( | |
flock --nonblock 9 || exit 0 |
NewerOlder