Random snippets of code that make my life easier.

Find cf admin password

bosh int --path=/cf_admin_password

bosh .envrc

echo -n "Creating jumpbox key.. "
rm -rf ${PWD}/bosh/jumpbox.key
bosh int ${PWD}/bosh/creds.yml --path /jumpbox_ssh/private_key > ${PWD}/bosh/jumpbox.key
chmod 0400 ${PWD}/bosh/jumpbox.key
echo "Done"
export BOSH_HOST=$(bosh int ./bosh/bosh_creds.yml --path /internal_ip)
bosh alias-env vsphere -e $BOSH_HOST --ca-cert <(bosh int ./bosh/creds.yml --path /director_ssl/ca)
export BOSH_CLIENT=admin
export BOSH_CLIENT_SECRET=`bosh int ./bosh/creds.yml --path /admin_password`

setblocksize script

This is used to set the blocksize of disks in a more efficient way.

#!/usr/bin/env bash

disk_list=$(sg_scan -i |grep sg|sed -e s/\:.*//g) #finds all the disks and puts them into a var.

sbl ()
  echo "y"|setblocksize -b512 -t 1200 $1

export -f sbl

echo "${disk_list}"|xargs -n 1 -P 0 bash -c 'sbl "$@"' _