jq is useful to slice, filter, map and transform structured json data.
brew install jq
| # list all regions | |
| aws ec2 describe-regions --output text | cut -f3- | |
| # the use resourcegrouptaggingapi to list resources in each region | |
| aws resourcegroupstaggingapi get-resources --region ${REG_NAME} | jq -r '.[][] | .ResourceARN' | |
| aws resourcegroupstaggingapi get-resources --tag-filters "Key=XYZ" | jq -r '.[][] | .ResourceARN as $res | .Tags[] | select(.Key == "XYZ") | [$res, .Value ] | @csv ' | |
| # display all non-us regions | |
| aws ec2 describe-regions | jq -r '.Regions[] | select(.RegionName | test("^(?!(us-).*)")) | .RegionName' |
| #!/bin/bash | |
| # Bash shell script for generating self-signed certs. Run this in a folder, as it | |
| # generates a few files. Large portions of this script were taken from the | |
| # following artcile: | |
| # | |
| # http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html | |
| # | |
| # Additional alterations by: Brad Landers | |
| # Date: 2012-01-27 |
| --- | |
| # This has been tested with ansible 1.3 with these commands: | |
| # ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false" | |
| # ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true" | |
| # ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts" | |
| # NB: The type of the variable is crucial! | |
| - name: Ansible Conditionals Examples | |
| hosts: $hosts | |
| vars_files: |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| #!/bin/bash | |
| #set -vx | |
| # This script will call a jenkins job with params and with for its completition | |
| # at the end it will return the status | |
| function log_message { | |
| log_type=$1 | |
| message=$2 |
| # Retrieving parameters | |
| for i in "$@" | |
| do | |
| case $i in | |
| -p=*|--project=*) | |
| PROJECT="${i#*=}" | |
| shift | |
| ;; | |
| -e=*|--environment=*) | |
| ENVIRONMENT="${i#*=}" |
| # | |
| # Usage: | |
| # log_message WARN "Please backup and remove it before running the script" | |
| # | |
| function log_message { | |
| log_type=$1 | |
| message=$2 | |
| full_message="" |
| set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) | |
| setw -q -g utf8 on | |
| set -g status-bg "colour235" | |
| set -g message-command-fg "colour222" | |
| set -g status-justify "left" | |
| set -g status-left-length "100" | |
| set -g status "on" | |
| set -g pane-active-border-fg "colour250" | |
| set -g message-bg "colour238" |
| set nocompatible | |
| filetype off | |
| call plug#begin() | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'godlygeek/tabular' | |
| "Plug 'mattn/emmet-vim' | |
| "Plug 'diepm/vim-rest-console' | |
| Plug 'scrooloose/nerdtree' |