Skip to content

Instantly share code, notes, and snippets.

View darvein's full-sized avatar
💀
Breaking the system!

Dennis Ruiz darvein

💀
Breaking the system!
View GitHub Profile
# 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'
@darvein
darvein / gen_cert.sh
Created August 20, 2020 12:51 — forked from adamrunner/gen_cert.sh
bash script to generate a self signed certificate for development use
#!/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
@darvein
darvein / ansible_conditionals_examples.yaml
Created August 10, 2018 23:16 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# 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:
@darvein
darvein / jq-cheetsheet.md
Created July 30, 2018 19:37 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@darvein
darvein / ansible-summary.md
Created March 8, 2018 17:22 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@darvein
darvein / jenkins-invoker.sh
Created November 10, 2017 22:56
Bash script which controls jenkins job invocation until its competition
#!/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
@darvein
darvein / params.sh
Last active September 18, 2017 22:02
Bash params parser
# Retrieving parameters
for i in "$@"
do
case $i in
-p=*|--project=*)
PROJECT="${i#*=}"
shift
;;
-e=*|--environment=*)
ENVIRONMENT="${i#*=}"
@darvein
darvein / message.sh
Last active September 18, 2017 21:58
Bash messaging
#
# Usage:
# log_message WARN "Please backup and remove it before running the script"
#
function log_message {
log_type=$1
message=$2
full_message=""
@darvein
darvein / tmux.conf
Created August 29, 2017 01:27
Tmux configuration file
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"
@darvein
darvein / vimrc
Created August 29, 2017 01:26
Vim configuration file
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'