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
EmbeddedDatabase db = new EmbeddedDatabaseBuilder() | |
.generateUniqueName(true) | |
.setType(H2) | |
.setScriptEncoding("UTF-8") | |
.ignoreFailedDrops(true) | |
.addScript("schema.sql") | |
.addScripts("user_data.sql", "country_data.sql") | |
.build(); | |
// perform actions against the db (EmbeddedDatabase extends javax.sql.DataSource) |
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
# Documentation: https://kubernetes.io/docs | |
# | |
# get kubernetes version and info | |
kubectl version | |
# get infor on pods | |
kubectl get pods | |
# get info on deployments | |
kubectl get deployments | |
kubectl describe deployments |
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
# scale to 10 replicas | |
kubectl scale deployment <nginx-deployment> --replicas=10 | |
# auto-Scaling | |
kubectl autoscale deployment <nginx-deployment> --min=2 --max=8 --cpu-percent=80 |
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
# Secrets handling | |
# create secret | |
kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt | |
# get Secrets | |
kubectl get secrets | |
# get secret details | |
kubectl get secret mysecret -o yaml | |
# encode secret values | |
echo "asdfghjkl==" | base64 --decode |
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
# How to do updates to your environment | |
# more details to deployments and scaling: | |
# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ | |
# 1. update the deployment.yml file and run | |
kubectl apply -f <deployment.yml> | |
# 2. update an image: | |
kubectl set image <deployment/nginx-deployment> <nginx>=<nginx:1.9.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
# first, format USB as ExtFAT (using Disk Utility) | |
# convert .iso to .img | |
hdiutil convert -format UDRW -o ./ubuntu-18.04.2-server-amd64.img ubuntu-18.04.2-server-amd64.iso | |
# mac adds .dmg at the end, we need to remove that | |
mv ubuntu-18.04.2-server-amd64.img.dmg ubuntu-18.04.2-server-amd64.img | |
# find out the disk-name: | |
diskutil list |
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
# check active connections | |
netstat -ant | grep 4444 | wc -l | |
# only established connections | |
netstat -ant | grep 4444 | grep -i established | wc -l | |
# idle connections | |
netstat -an -f inet | grep -v EST | grep IDLE | wc -l | |
# in loop |
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 | |
# more shortcuts at https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html | |
# list certificates included in a keystore | |
keytool -list -v -keystore keystore.jks | |
# with specific storetype: | |
keytool -list -v -storetype jceks keystore.jks | |
# check a specific certificate | |
keytool -printcert -v -file mydomain.crt |