Skip to content

Instantly share code, notes, and snippets.

View red-avtovo's full-sized avatar
⛩️
Zen

Aleksandr red-avtovo

⛩️
Zen
View GitHub Profile
@red-avtovo
red-avtovo / k8s_services.md
Last active August 24, 2021 07:40
K8s setup
Service Implementation
K8s K3s (lightweight, no need to use docker -> containerd by default)
Ingress Controller (Reverse proxy) Traefik Ingress Controller (preinstalled with k3s by default, could be disabled)
Distributed File storage Longhorn
Canary deployment stackset-controller
Config editor / Web IDE Code server
Lets Encrypt Certificates cert manager
DNS propagation external-dns
K8s cli k9s
@red-avtovo
red-avtovo / vault_certs.sh
Created November 22, 2020 21:21
Get main info about Vault certs
#!/bin/bash
VAULT_URL="http://localhost:8200/v1"
TOKEN="s.BfRUIKOyrWtVIJX0rBN1AiSW"
res=$(curl -s \
--header "X-Vault-Token: $TOKEN" \
--request LIST \
$VAULT_URL/pki/certs)
keys=$(echo $res | jq -r '.data.keys[]')
@red-avtovo
red-avtovo / repeat_to_succed.sh
Created October 24, 2020 22:15
The only working so far way to downgrade debian packages
#FIND
apt-show-versions | grep newer | awk '{ print $1 }' | xargs -I {} apt-show-versions -a {} | grep $(lsb_release -sc) > repo_versions.log
#DOWNGRADE
cat repo_versions.log | awk '{ print $1 "=" $2 }' | xargs -I {} sudo DEBIAN_FRONTEND=noninteractive apt install --reinstall {} -y --allow-downgrades
#CHECK
apt-show-versions | grep newer
@red-avtovo
red-avtovo / gen.sh
Created October 19, 2020 16:23
Virtual EXT4FS drive
dd if=/dev/zero of=test.img bs=4k count=60000
#240 Mb
mkfs.ext4 test.img
tune2fs -c0 -i0 test.img
mount -o loop test.img /mnt/
@red-avtovo
red-avtovo / .p10k.zsh
Created September 27, 2020 09:59
p10k_minimal
# Generated by Powerlevel10k configuration wizard on 2020-09-04 at 19:59 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 42402.
# Wizard options: compatible, classic, unicode, dark, flat heads, flat tails, 1 line,
# sparse, fluent, transient_prompt, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@red-avtovo
red-avtovo / unifi_update.sh
Created September 4, 2020 18:28
Install UniFi controller on Linux
echo "Input version number to install [e.g. 5.4.23]:"
read version
wget http://dl.ui.com/unifi/$version/unifi_sysvinit_all.deb -O unifi_$version\_sysvinit_all.deb
sudo apt install -f ./unifi_$version\_sysvinit_all.deb
@red-avtovo
red-avtovo / board.rs
Created August 15, 2020 09:54
Find word on board
#[cfg(test)]
mod test {
#[test]
fn word() {
let board = vec![
vec!['A','B','C','E'],
vec!['S','F','C','S'],
vec!['A','D','E','E']
];
let board2 = vec![
@red-avtovo
red-avtovo / K8S CRD exporter.sh
Created August 14, 2020 13:17
Export all CRS from the cluster in order to import it to IDE supporting crds autocompletion
kubectl get crd | sed -n '1!p' | awk '{print $1}' | xargs -I {} sh -c 'echo "Saving {}"; kubectl get crd {} -o yaml > {}.yaml'
@red-avtovo
red-avtovo / fast-pritunl-ovpn.sh
Last active December 17, 2021 19:04
Script to connect docker machine to pritunl VPN server fast
#!/bin/bash
# download a file https://pritunl-host/key/kUcPewwukHSXxONlf9NJq7KdcUsMuRwR.tar
echo "Enter url to tar with profile:"
read tar_url
mkdir vpn
wget -O- ${tar_url} | tar x -C vpn
docker run -d \
--net=host \

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096