Skip to content

Instantly share code, notes, and snippets.

View koss822's full-sized avatar

Martin Konicek koss822

View GitHub Profile
template:
metadata:
labels:
app.kubernetes.io/name: speedtest
spec:
containers:
- influxdb: null
name: influxdb
image: influxdb:1.8
volumeMounts:
# SOPS Encryption with Git Hooks
This README outlines a method for integrating Mozilla SOPS with Git hooks to automatically encrypt sensitive Kubernetes YAML files before committing changes. Ensure you have stored your private AGE key securely, as outlined in the setup instructions.
# Generate an AGE keypair
age-keygen -o keys.txt
# keys.txt contains both your public and private key.
# Separate them for use with SOPS:
grep 'public key' keys.txt > age.pub
grep -v 'public key' keys.txt > age.key
# Then, storing the age.key securely, for instance in KeePass, ensures it's safely kept away from prying eyes.
# Assume 'secrets.yaml' is the file containing sensitive content
PRE_CHANGE_HASH=$(sha256sum secrets.yaml | awk '{print $1}')
# Performing operations that might change secrets.yaml
POST_CHANGE_HASH=$(sha256sum secrets.yaml | awk '{print $1}')
if [ "$PRE_CHANGE_HASH" != "$POST_CHANGE_HASH" ]; then
sops --encrypt --age $(cat age.pub) secrets.yaml > secrets.enc.yaml
echo "Encrypted secrets as contents have changed."
# calculate and test continuous rent when taking money, also calculate interest rate on financial market
# with help of chatgpt
# Modifying the code to account for a 4% annual increase in the annuity,
# distributed as a monthly increase, and testing the outcome
def find_monthly_annuity_with_monthly_increase(starting_amount, monthly_interest_rate, total_months, annual_increase_rate):
lower_bound = 0
upper_bound = starting_amount # Increased upper bound to include all possibilities
tolerance = 0.01 # Tolerance limit for calculation accuracy
monthly_increase_rate = (1 + annual_increase_rate) ** (1/12) - 1 # Calculating the equivalent monthly increase rate
# Add to task scheduler
# Start a program; Powershell.exe -ExecutionPolicy Bypass -File "backupvm.ps1"
# Define variables
$VMName = "VM Name"
$ExportPath = "C:\backups"
$RarFileName = "vm-name"
$RarFileNameWithDate = "$RarFileName-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
$S3Bucket = "hyperv-backup-s3"
$SNSArn = "arn:aws:sns:eu-west-1:xxxx:Backup"
$daysToKeep = 90
{
"datasource": {
"type": "prometheus",
"uid": "yTVXipTVz"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "light-orange",
"mode": "palette-classic"
scrape_configs:
- job_name: 'cnb'
scrape_interval: 1h
static_configs:
- targets: ['cnb-exporter-service:9100']
class ExtendedException(Exception):
"""This exception extends functionality"""
error_message = None
error_code = None
def __init__(self, error_message = None, error_code = None):
self.error_message = error_message
self.error_code = error_code
try:
@media (min-width: 40rem) {
.plan__list {
width: 100%;
text-align: center;
display: flex;
margin:auto;
justify-content: center;
align-items: center;
}