Skip to content

Instantly share code, notes, and snippets.

sudo apt update && sudo apt upgrade -y
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
sudo apt update
sudo apt install zabbix-agent -y
# kvm
sudo apt install qemu-kvm ovmf cpu-checker libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager qemu-utils dnsmasq
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
cd /var/lib/libvirt/images/
@alexcmd
alexcmd / StreamWebSocketHandler.java
Created July 23, 2020 12:15
Spring Reactive websocket example
public class StreamWebSocketHandler implements WebSocketHandler {
@Override
public Mono<Void> handle(WebSocketSession session) {
session.getHandshakeInfo().getPrincipal().block();
var bridge = new Bridge<WebSocketMessage>();
Mono<Void> sendPings = session.send(
Flux.interval(Duration.ofMillis(1))
.map(aLong -> session.pingMessage(dataBufferFactory -> session.bufferFactory().allocateBuffer())));
@alexcmd
alexcmd / letsencrypt_2019.md
Created February 25, 2020 14:32 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@alexcmd
alexcmd / UnityAssests
Created January 17, 2020 07:49
Unity level design pipeline assets
# Modeling
ProBuilder
UModeler - https://assetstore.unity.com/packages/tools/modeling/umodeler-80868
Gaia https://assetstore.unity.com/packages/tools/terrain/gaia-pro-terrain-scene-generator-155852
Digger - https://assetstore.unity.com/packages/tools/terrain/digger-pro-149753
# Texures
Quixel - https://assetstore.unity.com/packages/tools/terrain/digger-pro-149753?q=quixel&orderBy=0
Quixel - https://quixel.com/pricing
@alexcmd
alexcmd / mem.sh
Created January 13, 2020 13:47
Get process list ordered by memory usage
ps -eo size,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
cut -d "" -f2 | cut -d "-" -f1
@alexcmd
alexcmd / application.yml
Last active January 10, 2020 14:34
Bootstrap config for Spring Boot Consul cloud Configuration and Service Discovery
server:
port: 0
management:
server:
port: 9155
endpoints:
web:
base-path: /
exposure:
include: '*'
if [ "$1" == "" ] || ["$2" == "" ] || ["$3" == "" ]; then
echo "Use ./kube_node_setup.sh <master_ip> <token> <hash>"
else
echo "sudo kubeadm join $1:6443 --token $2 --discovery-token-ca-cert-hash $3"
sudo kubeadm join $1:6443 --token $2 --discovery-token-ca-cert-hash $3
sudo systemctl restart kubelet
fi
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12
kubectl taint nodes --all node-role.kubernetes.io/master-
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get ds/kube-proxy -o go-template='{{.spec.updateStrategy.type}}{{"\n"}}' --namespace=kube-system
wget https://raw.githubusercontent.com/Microsoft/SDN/master/Kubernetes/flannel/l2bridge/manifests/node-selector-patch.yml
kubectl patch ds/kube-proxy --patch "$(cat node-selector-patch.yml)" -n=kube-system
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl apply -f kube-flannel.yml
echo "Remove old version of Docker"
sudo apt -y remove docker docker-engine docker.io containerd runc
echo "Install PPA"
sudo apt install -y apt-transport-https curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
echo "Remove old version of Docker"
sudo apt -y remove docker docker-engine docker.io containerd runc
echo "Install PPA"
sudo apt install -y apt-transport-https curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"