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 | |
| cd ${HOME} | |
| # kubernetes fn aliases | |
| ## krmpvc | |
| ## kavpv | |
| curl -LO https://gist.githubusercontent.com/inceabdullah/64e4fe55e4b9abbe507970f8eebd04cf/raw/dd39721e555ac00b1d7d203778845aa326cf692a/.kubernetes_fn_aliases | |
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 | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Please run this script with sudo." | |
| exit 1 | |
| fi | |
| HOST_TO_REMOVE=example.domain | |
| IP="127.0.0.1" |
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
| # krmpvc: Kubernetes Remove PVCs | |
| # This function removes Persistent Volume Claims (PVCs) associated with a specific name. It takes a name as an argument and deletes all PVCs with a label matching the release name. | |
| krmpvc() { | |
| local PVC=$1 | |
| kubectl get pvc | grep $PVC | awk '{print $1}' | xargs kubectl delete pvc | |
| } | |
| # kavpv: Kubernetes Available PVs | |
| # This function makes Persistent Volumes (PVs) available in a Kubernetes cluster by clearing the `claimRef` field. It filters PVs based on a specified pattern and release name and then patches each PV to set the `claimRef` to `null`, making the PV available for reuse. | |
| kavpv() { |
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 | |
| # Source directory containing .html files | |
| SOURCE_DIR="./stable" | |
| # Destination directory where .html files will be copied | |
| DEST_DIR="./destination_folder" | |
| # Create the destination directory if it doesn't exist | |
| mkdir -p "$DEST_DIR" |
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 | |
| # ./find_unused_subnet.sh "127.0.0.1 172.17.0.2 10.0.0.1 10.0.1.1 10.156.0.2 127.0.0.1 10.0.0.2 10.0.1.2" | |
| # Declare an associative array to store used subnets | |
| declare -A usedSubnets | |
| # Get IPs from the first argument and split them into an array | |
| IFS=' ' read -ra ADDR <<< "$1" |
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 | |
| # Generate random base64 string using openssl | |
| # Usage: generate_base64 [length] | |
| # length: Optional, the length of the base64 string (default is 32) | |
| generate_base64() { | |
| if [[ "$1" == "--help" ]]; then | |
| echo "Usage: generate_base64 [length]" | |
| echo " length: Optional, the length of the base64 string (default is 32)" | |
| return |
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
| extern crate rusoto_core; | |
| extern crate rusoto_ecs; | |
| use rusoto_core::Region; | |
| use rusoto_ecs::{Ecs, EcsClient, ListClustersRequest}; | |
| #[tokio::main] | |
| async fn main() { | |
| let client = EcsClient::new(Region::UsEast1); |
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
| extern crate rusoto_core; | |
| extern crate rusoto_ecs; | |
| use rusoto_core::Region; | |
| use rusoto_ecs::{Ecs, EcsClient, ListTaskDefinitionsRequest}; | |
| #[tokio::main] | |
| async fn main() { | |
| let client = EcsClient::new(Region::UsEast1); |
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
| extern crate rusoto_core; | |
| extern crate rusoto_s3; | |
| use rusoto_core::{Region, RusotoError}; | |
| use rusoto_s3::{S3Client, S3}; | |
| #[tokio::main] | |
| async fn main() { | |
| let client = S3Client::new(Region::UsEast1); |
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
| use std::ffi::{CStr, CString}; | |
| use libc::{getifaddrs, ifaddrs, sockaddr}; | |
| struct Result { | |
| ipV4: Vec<String>, | |
| ipV6: Vec<String>, | |
| } | |
| fn get_interface_addresses(iface_name: &str) -> Result { | |
| let mut result = Result { |