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
#If you are using a monospace font, this will be a waste of time | |
unicode-space-test() { | |
declare -ag SPACE_ARRAY=( | |
'\u0020|SPACE|Typically 1/4 EM; Adjusted depending on font.' | |
'\u00A0|NO-BREAK SPACE|As a space; Often not adjusted.' | |
'\u1680|OGHAM SPACE MARK|Usually not really a space but a dash.' | |
'\u180E|MONGOLIAN VOWEL SEPARATOR|No width space.' | |
'\u2000|EN QUAD|1 EN; Fixed-width.' | |
'\u2001|EM QUAD|1 EM (nominally; the height of the font); Fixed-width.' | |
'\u2002|EN SPACE|1 EN; Fixed-width.' |
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 | |
#Script to configure openstack on Orangebox | |
[[ ${HOSTNAME,,} =~ orangebox ]] && export OB_NUM=$((10#${HOSTNAME:9})) || OB_NUM=20 | |
#Networking Variables - External will be provider, Int will be tenant | |
export NEUTRON_DNS1="172.27.$((${OB_NUM})).1" | |
export NEUTRON_DNS2="172.27.$((${OB_NUM}+2)).1" | |
export NEUTRON_DNS3="172.27.$((${OB_NUM}+3)).254" |
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 | |
#Small function to give text status of OK/FAIL to commands | |
tstatus() { | |
RETCODE=$(echo $?) | |
[[ $RETCODE -eq 0 ]] && printf '\e['$(($(tput cols)-10))'G [ \e[32mOK\e[0m ]\n' | |
[[ $RETCODE -eq 1 ]] && printf '\e['$(($(tput cols)-10))'G [\e[31mFAIL\e[0m]\n' | |
return $RETCODE | |
} |
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
random-ipv6-range() { | |
local DESC="\e[1m${FUNCNAME}: Create a sequential range of IP addresses\e[0m\n" | |
[[ $1 = '--desc' ]] && { printf "${DESC}";return; } | |
random-ipv6-range_usage() { | |
printf "\n${DESC}\n" | |
printf "\e[2GUsage: ${FUNCNAME%%_*} [OPTIONS]\n\n" | |
printf "\e[2GOptions:\n" | |
printf "\e[4G -c, --count \e[24GNumber of IPv6 addresses to include in the range\n" |
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
increment-mac() { | |
local DESC="\e[1m${FUNCNAME}: Prints incrementing MAC address numbers\e[0m\n" | |
[[ $1 = '--desc' ]] && { printf "${DESC}";return; } | |
increment-mac_usage() { | |
printf "\n${DESC}\n" | |
printf "\e[2GUsage: ${FUNCNAME%%_*} [OPTIONS]\n\n" | |
printf "\e[2GOptions:\n" | |
printf "\e[4G -c, --count \e[20GNumber of MAC address to print\n" |
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
#!/usr/bin/env bash | |
# vim: set et ts=2 sw=2 filetype=bash : | |
# | |
# Copyright (C) 2020 Craig Bender | |
# | |
# Author(s): Craig Bender <[email protected]> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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
juju-upgrade-openstack() { | |
export SERIES=xenial | |
export RELEASE=pike | |
export CURRENT_MODEL=$(juju models|awk '/*/{gsub(/*/,"");print $1}') | |
printf "\e[2GGetting list of applications from juju model \"${CURRENT_MODEL}\" \n" | |
declare -ag JUJU_APPS=($(juju 2>/dev/null status --format=json|jq 2>/dev/null -r '.applications | to_entries[].key')) | |
printf "%s\n" ${JUJU_APPS[@]} | |
printf "\e[2GGetting list of openstack applications from juju model \"${CURRENT_MODEL}\" \n" | |
declare -ag UPGRADE_APPS=($(for APP in ${JUJU_APPS[@]};do [[ -n $(juju 2>/dev/null config ${APP} action-managed-upgrade) ]] && echo ${APP};done)) | |
printf "%s\n" ${UPGRADE_APPS[@]} |
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
#If populating MAAS DNS with domains, all domains get added to the search order. | |
#Resolv.conf only supports 6, so if you have more 6 domains entered, nothing after the 6th gets resolved | |
#Also, juju for some reason is doing an alpha sort on domain, which in most cases (and in the case of http://launchpad.net/opm) puts | |
#the MAAS domain near the end, which is past the 6th domain. | |
#This function will go through all machines and containers in a model and set a given search order, or | |
#if used without arguments will set the maas domain as the only entry in dns-search | |
fix-deployed-dns-search() { |
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
openssl x509 -in ${CERT} -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV | |
# Or as a function | |
show-cert-sans() { | |
[[ -z ${1} || ${1} =~ ^- ]] && { printf "Usage: ${FUNCNAME} </path/to/ssl/cert>\n";return 2; } || true | |
[[ -e ${1} ]] || { printf "Can't find SSL Certificate ${1}\n";return 1; } | |
openssl x509 -in ${1} -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV | |
} |
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
check-cert() { | |
local DESC="${RO}${FUNCNAME}${RT}: Show which hostnames/ip addresses are listed in Subject Alternate Names (SAN) in a given x509 certifcate\n" | |
[[ $1 = '--desc' ]] && { printf "${DESC}";return; } | |
check-cert_usage() { | |
printf "\n\e[2GUsage: ${RO}${FUNCNAME%%_*} ${RT} -c,--cert </path/to/x509/certificate> [OPTIONS] ${RT}\n" | |
printf "\e[4G${RO} -c${RT},${RO}--c\e[20G${RT}Path to x509 certificate (Required)\n" | |
printf "\e[4G${RO} -a${RT},${RO}--all\e[20G${RT}Show all hostnames and ip addresses covered by the provided certificate\n" | |
printf "\e[4G${RO} -h${RT},${RO}--host\e[20G${RT}Provide a specific hostname to check (or \"all\" to show all hostnames)\n" | |
printf "\e[4G${RO} -i${RT},${RO}--IP\e[20G${RT}Provide a specific IP address to check (or \"all\" to show all IP addresses)\n" | |
echo |