Access Log:
172.16.4.86 - - [04/Jun/2022:07:58:38 +0000] "GET / HTTP/2.0" 301 280 "-" "curl"
Query in Grafana / Loki:
{job="prod/nginx"} |= "GET / "
| ######################################################## | |
| # How To Auto-Scale Kubernetes Clusters With Karpenter # | |
| # https://youtu.be/C-2v7HT-uSA # | |
| ######################################################## | |
| # Referenced videos: | |
| # - GKE Autopilot - Fully Managed Kubernetes Service From Google: https://youtu.be/Zztufl4mFQ4 | |
| ######### | |
| # Setup # |
Access Log:
172.16.4.86 - - [04/Jun/2022:07:58:38 +0000] "GET / HTTP/2.0" 301 280 "-" "curl"
Query in Grafana / Loki:
{job="prod/nginx"} |= "GET / "
| #!/usr/bin/env python3 | |
| # docs: https://grafana.com/docs/loki/latest/api/#post-lokiapiv1push | |
| import requests | |
| import time | |
| # variables | |
| LOKI_USERNAME="x" | |
| LOKI_PASSWORD="x" | |
| LOKI_ENDPOINT="https://loki-api.example.com/loki/api/v1/push" |
This is a basic example with a dirty bash script on how to create a copy of a production database and update the column values of the new (test / staged) database, which might be sensitive or which is not suitable for test environments.
This test is intentional for small datasets.
The flow:
| #!/usr/bin/env bash | |
| export GOVERSION="1.17.2" | |
| export GETHVERSION="1.10.9" | |
| apt update | |
| apt install wget tar locales-all -y | |
| touch /var/lib/cloud/instance/locale-check.skip | |
| mkdir -p /blockchain/ethereum/data | |
| mkdir -p /usr/local/geth/${GETHVERSION}/bin |
Sending SMS's with AWS SNS:
import boto3
sms_number='+27000000000'
sns = boto3.Session(profile_name='default', region_name='eu-west-1').client('sns')
response = sns.publish(
PhoneNumber=sms_number, Install pytz:
pip install pytz
Python example to get time in GMT+2 or Africa/Johannesburg:
>>> import pytz
| FROM maven:3.6.1-amazoncorretto-11 as builder | |
| ARG DB_USER | |
| ARG DB_PASSWORD | |
| ARG DB_URL | |
| ENV DB_USER=${DB_USER} | |
| ENV DB_PASSWORD=${DB_PASSWORD} | |
| ENV DB_URL=${DB_URL} | |
| RUN curl -LJO https://github.com/liquibase/liquibase/releases/download/v4.2.0/liquibase-4.2.0.tar.gz && \ |
| #!/usr/bin/env bash | |
| # Note: | |
| # I use this script to bootstrap testnet nodes, if you are using the mainnet, | |
| # I STRONGLY recommend to set rpcallowip to localhost | |
| # environment variables | |
| export ARCH=x86_64 | |
| export BITCOIN_VERSION=0.21.1 | |
| export BITCOIN_URL=https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${ARCH}-linux-gnu.tar.gz |