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
IS_LOCKED=$(sudo lsof /var/lib/dpkg/lock | wc -l) | |
echo "Is Locked? $IS_LOCKED" | |
until [[ $IS_LOCKED -eq 0 ]]; do | |
echo "Is Locked? $IS_LOCKED" | |
echo "sleeping for 5" | |
sleep 5 | |
IS_LOCKED=$(sudo lsof /var/lib/dpkg/lock | wc -l) | |
done |
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
yum repolist | grep -Po "^[\w|-]+(?=\/)" | xargs yumdb search from_repo | grep -Po "=\K .+" | sort - | uniq - | sed -e 's/^[[:space:]]*//' | awk '{system("repoquery --repoid="$1" -a --location")}' | grep -oP "^.+\://\K[^/]+(?=/.+)" | sort - | uniq - | awk '{system( "echo && host "$1)}' |
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
sudo certbot renew --preferred-challenges dns --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/cloudflare.ini --dry-run |
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
NEWEST_BLOB=$(az storage blob list \ | |
--account-key $STORAGE_KEY \ | |
--account-name $STORAGE_ACCOUNT \ | |
-c $CONTAINER \ | |
--prefix $PREFIX \ | |
--query "[*].{name: name, date: properties.lastModified } | sort_by([*], &date) | [-1].name") | |
NEWEST_BLOB=$(echo $NEWEST_BLOB | tr -d \") |
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
MYIP=$(curl -s http://ipinfo.io/json | jq -r '.ip') && \ | |
MATCH="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" && \ | |
if [[ $MYIP =~ $MATCH ]]; then \ | |
echo "Adding $MYIP to $(SERVER_NAME) firewall"; \ | |
az sql server firewall-rule create -g $(RESOURCE_GROUP) -s $(SERVER_NAME) -n ALLOW_ADO --start-ip-address $MYIP --end-ip-address $MYIP; \ | |
else \ | |
echo "$MYIP is not a valid IP address."; \ | |
exit 1; \ | |
fi |
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
set -e | |
echo "set -e" > gitbuilder.sh | |
dirs=() | |
readarray -d '' dirs < <(find . -name .git -type d -prune) | |
for dir in ${dirs[@]}; do | |
cleandir=$(echo $dir | sed 's/\.git//') | |
remote=$(git --git-dir=$dir remote -v | grep fetch | sed -r 's/origin\s+//' | sed -r 's/\s+\(fetch\)//') |
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 | |
set -e | |
#Check Arguments | |
if [ $# -lt 3 ]; then | |
echo "Insuffecient arguments supplied. Shoudl be: ado_copy_relase_vars.sh src dest RELEASE_ID" | |
exit 1 | |
fi | |
SOURCE_ENV=$1 | |
DEST_ENV=$2 |
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 [[ "$#" -ne 6 ]]; then | |
echo -e "Incorrect number of arguments. You need to provide:\nImage Repository\nImage Tag\nRegistry FQDN\nWebhook URL\nWebhook User\nWebhook Password" | |
exit 1 | |
fi | |
IMAGE_REPOSITORY=$1 | |
IMAGE_TAG=$2 | |
REGISTRY_FQDN=$3 | |
HOOK_URL=$4 | |
HOOK_USER=$5 |
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
stages: | |
- build | |
- deploy | |
docker-build: | |
image: docker:latest | |
stage: build | |
services: | |
- docker:dind | |
before_script: |
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
export LC_ALL=C | |
FILE_NAME=$(date +%s).sar | |
for file in /var/log/sysstat/sa[0-9]*; do sar -A -f "$file" >> ~/$FILE_NAME; done |