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
| sanitize() { | |
| local s="${1?need a string}" # receive input in first argument | |
| s="${s//[^[:alnum:]]/-}" # replace all non-alnum characters to - | |
| s="${s//+(-)/-}" # convert multiple - to single - | |
| s="${s/#-}" # remove - from start | |
| s="${s/%-}" # remove - from end | |
| echo "${s,,}" # convert to lowercase | |
| } |
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
| #!/usr/bin/env python3 | |
| # https://pip.wtf | |
| def pip_wtf(command): | |
| import os, os.path, sys | |
| t = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".pip_wtf." + os.path.basename(__file__)) | |
| sys.path = [p for p in sys.path if "-packages" not in p] + [t] | |
| os.environ["PATH"] += os.pathsep + t + os.path.sep + "bin" | |
| os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) | |
| if os.path.exists(t): 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
| #!/usr/bin/env python3 | |
| # https://pip.wtf | |
| def pip_wtf(command): | |
| import os, os.path, sys | |
| t = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".pip_wtf." + os.path.basename(__file__)) | |
| sys.path = [p for p in sys.path if "-packages" not in p] + [t] | |
| os.environ["PATH"] += os.pathsep + t + os.path.sep + "bin" | |
| os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) | |
| if os.path.exists(t): 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
| #!/usr/bin/env python3 | |
| """ Update the backup image in the cratedDB namespaces. | |
| The script iterates over all cratedbs in a k8s context and updates tag on the deployment and cronjob | |
| using the backup image. | |
| The script can be run standlone/locally, or on-demand in the cluster via CI/CD. Runtime | |
| behaviour and configuration is controlled via environment variables. |
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
| #!/usr/bin/env python3 | |
| """ | |
| This script is used to update the JMX exporter version in the CrateDB StatefulSet. | |
| JMX exporter is referenced in | |
| - the initContainer, | |
| - the CRATE_JAVA_OPTS environment variable, and | |
| - the volumeMounts and | |
| - sql_exporter image. |
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
| package main | |
| import ( | |
| "bytes" | |
| "context" | |
| "crypto/tls" | |
| "encoding/json" | |
| "flag" | |
| "fmt" | |
| "io/ioutil" |
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
| package main | |
| import ( | |
| "bytes" | |
| "encoding/json" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "os" | |
| "os/exec" |
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 boto3 | |
| from botocore.exceptions import ClientError | |
| import logging | |
| import time | |
| import os | |
| from prometheus_client import start_http_server, Gauge | |
| # Configure logging | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) |
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
| #!/usr/bin/env python3 | |
| import argparse | |
| import time | |
| import sys | |
| from kubernetes import client, config | |
| from kubernetes.config.config_exception import ConfigException | |
| import logging | |
| import logging.handlers | |
| import subprocess | |
| import boto3 |
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
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "argparse", | |
| # "kubernetes<=31.0", | |
| # "loguru", | |
| # ] | |
| # /// | |
| import re |