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
# Install blackbox-exporter | |
apt update | |
apt install -y prometheus-blackbox-exporter | |
# Chnage the garfana agent config file /etc/grafana-agent.yaml | |
cat > /etc/grafana-agent.yaml << EOF | |
integrations: | |
agent: | |
enabled: true |
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
ZONE_NAME="test.example.com" | |
ZONE_ID=$(aws route53 list-hosted-zones --query "HostedZones[?Name==\`${ZONE_NAME}.\`].Id" --output text) | |
aws route53 list-resource-record-sets --hosted-zone-id "${ZONE_ID}" | jq -c '.ResourceRecordSets[] | select (.Type != "SOA" and .Type != "NS")' | | |
while read -r RESOURCERECORDSET; do | |
aws route53 change-resource-record-sets \ | |
--hosted-zone-id "${CLUSTER_FQDN_ZONE_ID}" \ | |
--change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet": '"${RESOURCERECORDSET}"' }]}' \ | |
--output text --query 'ChangeInfo.Id' | |
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
GET_NODES=$(kubectl get node -o=custom-columns='NAME:metadata.name' | grep -v ^NAME) | |
for NODE in ${GET_NODES}; do | |
echo -en "${NODE}:\t" | |
kubectl get po --field-selector=status.phase=Running --all-namespaces -o json | jq -r ".items[] | select(.spec.nodeName==\"${NODE}\") | .metadata.name" | 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
#!/bin/bash -eu | |
HEADSET=$(pacmd list-sinks | sed -n 's/.*name: <\(.*output.*Headset.*\)>/\1/p') | |
HEADSET_MIC=$(pacmd list-sources | sed -n 's/.*name: <\(.*input.*Headset.*\)>/\1/p') | |
pacmd "set-default-sink ${HEADSET}" | |
pacmd "set-default-source ${HEADSET_MIC}" | |
pactl set-sink-mute "${HEADSET}" 0 | |
pactl set-sink-volume "${HEADSET}" 80% |
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 -eux | |
DEVICE="sdc" | |
lsblk --output NAME,MODEL,MODEL | grep ${DEVICE} | |
read -r -p "Press enter to remove everything from ${DEVICE}" | |
curl -L https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64-lite.img.xz | xzcat | sudo dd of=/dev/${DEVICE} bs=4M | |
sudo partprobe /dev/${DEVICE} |
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
# You have defined the "cna.example.cloud" zone in Route53 | |
# You want to create subdomain "${USER}-k8s.cna.example.cloud" and configure proper delegation form parrent zone | |
echo "* Create DNS zone ${USER}-k8s.cna.example.cloud" | |
aws route53 create-hosted-zone --output json \ | |
--name ${USER}-k8s.cna.example.cloud \ | |
--caller-reference "$(date)" \ | |
--hosted-zone-config="{\"Comment\": \"Created by ${USER}@example.com\", \"PrivateZone\": false}" | jq |
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
GITHUB_USERNAME="${GITHUB_USERNAME:-ruzickap}" | |
DESTINATION_DIRECTORY="${DESTINATION_DIRECTORY:-/root/.ssh}" | |
[[ ! -d "${DESTINATION_DIRECTORY}" ]] && mkdir -v --mode=0700 "${DESTINATION_DIRECTORY}" | |
wget "https://github.com/${GITHUB_USERNAME}.keys" -O "${DESTINATION_DIRECTORY}/authorized_keys" | |
chmod 0600 "${DESTINATION_DIRECTORY}/authorized_keys" |
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
kubectl get events --sort-by=.metadata.creationTimestamp | |
kubectl logs -n monitoring prometheus-prometheus-operator-prometheus-0 --all-containers | |
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
git clone git@github.com:ruzickap/check_urls.git | |
cd check_urls | |
mkdir -p .github/workflows | |
cat > .github/workflows/periodic-broken-link-checks.yml << \EOF | |
name: periodic-broken-link-checks | |
on: | |
schedule: | |
- cron: '0 0 * * *' |
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
# Make sure you are using gpg2 | |
git config --global gpg.program gpg2 | |
# Clone empty repository | |
git clone git@github.com:ruzickap/terraform-gitops.git | |
# Configure a repository to use git-crypt | |
cd terraform-gitops | |
git-crypt init |