This file contains hidden or 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 | |
| # Create .ssh directory and set permissions | |
| mkdir -p ~/.ssh && chmod 700 ~/.ssh | |
| # Install necessary packages | |
| apt update && apt install -y nano vim build-essential tmux curl | |
| # Add SSH key to authorized_keys and set permissions | |
| echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys |
This file contains hidden or 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 | |
| sleep 3 | |
| IP=$(curl -s https://icanhazip.com) | |
| PORT="$RUNPOD_TCP_PORT_70000" | |
| TOKEN="$UPDATE_MODEL_SERVER_TOKEN" | |
| HOST="$UPDATE_MODEL_SERVER_HOST" | |
| MODEL_TYPE="${MODEL_TYPE:-model1}" |
This file contains hidden or 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
| source 'https://rubygems.org' | |
| gem 'fluentd' | |
| gem 'fluent-plugin-td' | |
| gem 'fluent-plugin-elasticsearch' |
This file contains hidden or 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/sh | |
| # Backup your data | |
| # Use at your own risk | |
| # Usage ./extended-cleanup-rancher2.sh | |
| # Include clearing all iptables: ./extended-cleanup-rancher2.sh flush | |
| docker rm -f $(docker ps -qa) | |
| docker rmi -f $(docker images -q) | |
| docker volume rm $(docker volume ls -q) | |
| for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done | |
| cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico" |
This file contains hidden or 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 | |
| ######## | |
| # Purpose :- To take a backup of MongoDB Collections and upload to AWS s3 | |
| # Requirement :- Make Sure Collection.config file is present in /data/Backup/mongodb | |
| # format for Collection.config is db|collection | |
| # For example | |
| # db1|collections1 |
This file contains hidden or 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
| # Manually remove finalizers | |
| kubectl edit -n cattle-system secret tls-rancher | |
| kubectl patch secret tls-rancher -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system | |
| kubectl patch namespace cattle-system -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system | |
| kubectl delete namespace cattle-system --grace-period=0 --force | |
| kubectl patch namespace cattle-global-data -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system | |
| kubectl delete namespace cattle-global-data --grace-period=0 --force |
This file contains hidden or 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 | |
| ######## | |
| # Purpose :- To Restore backup of MongoDB Collections from AWS s3 | |
| # Requirement :- Make Sure you took backup via backupMongo_bucket.sh | |
| # Bug Report to :- [email protected] | |
| ######## | |
| PROGNAME=$(basename $0) |
This file contains hidden or 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/sh | |
| # Make sure to: | |
| # 1) Name this file `backup.sh` and place it in /home/ubuntu | |
| # 2) Run sudo apt-get install awscli to install the AWSCLI | |
| # 3) Run aws configure (enter s3-authorized IAM user and specify region) | |
| # 4) Fill in DB host + name | |
| # 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket) | |
| # 6) Run chmod +x backup.sh | |
| # 7) Test it out via ./backup.sh |
This file contains hidden or 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 | |
| function parse_yaml { | |
| local prefix=$2 | |
| local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
| sed -ne "s|^\($s\):|\1|" \ | |
| -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ | |
| -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
| awk -F$fs '{ | |
| indent = length($1)/2; |
This file contains hidden or 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
| import socket | |
| def find_open_port(): | |
| """ | |
| Use socket's built in ability to find an open port. | |
| """ | |
| sock = socket.socket() | |
| sock.bind(('', 0)) |
NewerOlder