Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -euo pipefail
DOMAIN="<domain name>"
LOG=./osp_project_resources.log
list_resources () {
OIFS=$IFS
IFS=$'\n'

Google SDK Cheat Sheet


Find all resources associated with an iam user,

`**gcloud beta asset search-all-iam-policies --scope=organizations/<org id> \
  --query="policy:<user>@<domain>" | egrep "resource:|role:|user:<user>@<domain>"**`

See: https://stackoverflow.com/a/60462095

from https://stackoverflow.com/a/13360181/3447107
#Make an array, here I'm using the output from openstack
OFS=$IFS
IFS=','
PROPERTIES=($(openstack flavor show $FLAVOR -c properties -f json | jq -r '.[]'))
IFS=$OIFS
# Walk the array backwards
for (( i=${#PROPERTIES[@]}-1 ; i>=0 ; i-- )); do
@flannon
flannon / FCoS cosa build
Created July 29, 2019 14:48
Build FCoS with cosa
Posted by Jonathan Lebon <jlebon@redhat.com> to dev@lists.openshift.redhat.com
On Wed, Jul 24, 2019 at 10:42 AM Michael Gugino <mgugino@redhat.com> wrote:
>
> I tried FCoS prior to the release by using the assembler on github.
> Too much secret sauce in how to actually construct an image.
Hmm, that's odd. FCOS is definitely magnitudes easier to build locally
than FAH ever was. The steps are basically just:
pbpaste | base64 --decode | keybase pgp decrypt
or:
terraform state show terraform_remote_state.<state file name> | grep <secret access key output name> | awk '{ print $3 }' | base64 --decode | keybase pgp decrypt

Keybase proof

I hereby claim:

  • I am flannon on github.
  • I am flannon (https://keybase.io/flannon) on keybase.
  • I have a public key ASA7_l8zNvTPMOm7WQSDNLXdHvyrga1eUJqulAWBXrQsNwo

To claim this, I am signing this object:

# Prereqs for running molecule
yum install python2-devel python3-devel # linux olny
virtualenv --no-site-packages venv
source venv/bin/activate
pip install molecule ansible
pip install docker-py
# Initialize a new role
@flannon
flannon / Docker notes
Last active February 24, 2018 17:16
Notes on using Docker
# To start an interactive container and set it to be removed when it's done, allocate a volume to the container,
# map the the current working directory to /tmp on the containter, and install go 1.9
docker container run -it --rm -v $PWD:/tmp -w /tmp golang:1.9 sh -c "go get -d -v -t && go build -v -o go-demo"
@flannon
flannon / osdistro.sh
Created February 15, 2018 14:22
How to tell if you're running RHEL or Centos
#!/bin/bash
DISTROS="rhel centos darwin"
for distro in $DISTROS; do
case $distro in
rhel) [[ ! -L /etc/redhat-release ]] && echo "dist = $distro"
;;
centos) [[ ! -L /etc/centos-release ]] && echo "dist = $distro"
;;
# start ssh-agent and load keys
SSH_AGENT=$(which ssh-agent)
SSH_AGENT_ARGS='-s'
# SSH_KEYS is a space separated list of ssh keys to load
SSH_KEYS='< -- your keys go here -->'
SSH_ADD=$(which ssh-add)
if [[ -z $SSH_AUTH_SOC && $SSH_AGENT ]]; then
eval $($SSH_AGENT $SSH_AGENT_ARGS) 2>&1 1>/dev/null
for i in $SSH_KEYS; do
$(echo $SSH_ADD) -k $HOME/.ssh/$i 2>&1 1&>/dev/null