Skip to content

Instantly share code, notes, and snippets.

View Leen15's full-sized avatar

Luca Mattivi Leen15

View GitHub Profile
@Leen15
Leen15 / cucina-card.yaml
Last active March 21, 2024 11:46
Cucina card template
type: custom:mod-card
style:
.: |
ha-card {
background: var(--ha-card-background, var(--card-background-color, #fff));
}
hui-vertical-stack-card:
$:
.: |
#root {
INGRESS:
HELM v3: https://kubernetes.github.io/ingress-nginx
Values.yaml:
---
controller:
config:
http-snippet: |-
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
@Leen15
Leen15 / kubectl_remove_checksum_cattle-node-agent-ds.sh
Created April 17, 2020 15:52 — forked from superseb/kubectl_remove_checksum_cattle-node-agent-ds.sh
Remove CATTLE_CA_CHECKSUM from cattle-node-agent DaemonSet
#!/bin/bash
# Check current CATTLE_CA_CHECKSUM value
kubectl -n cattle-system get ds -o go-template='{{range .items}}{{range .spec.template.spec.containers}}{{range .env}}{{if eq .name "CATTLE_CA_CHECKSUM"}}{{.name}}{{"="}}{{.value}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'
# Remove CATTLE_CA_CHECKSUM value
kubectl -n cattle-system patch daemonset/cattle-node-agent -p '{"spec": {"template": {"spec": {"containers": [{"name": "agent", "env": [{"name": "CATTLE_CA_CHECKSUM", "value": ""}]}]}}}}'
# Check changed CATTLE_CA_CHECKSUM value
kubectl -n cattle-system get ds -o go-template='{{range .items}}{{range .spec.template.spec.containers}}{{range .env}}{{if eq .name "CATTLE_CA_CHECKSUM"}}{{.name}}{{"="}}{{.value}}{{"\n"}}{{end}}{{end}}{{end}}{{end}}'
@Leen15
Leen15 / check-k8s-ssl.sh
Created February 20, 2020 16:01
script for check expiration date of all kubernetes certificates
#!/bin/sh
if [ -d /opt/rke/etc/kubernetes ]; then
K8S_DIR="/opt/rke/etc/kubernetes"
else
K8S_DIR="/etc/kubernetes"
fi
for cert in `find "${K8S_DIR}/ssl" -type f -name *.pem | grep -v "\-key\.pem$" | grep -v kube-admin | sort`; do
md5sum $cert
done
if [ -d "${K8S_DIR}/.tmp" ]; then
@Leen15
Leen15 / dockergrep.sh
Created February 20, 2020 15:54 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@Leen15
Leen15 / MOVE_FILES_BETWEEN_HOSTS.md
Last active January 23, 2018 09:44
Commands for easily copy a file between hosts

LISTEN ON PORT 5555 OF TARGET SERVER FOR RECEIVE THE file.dat

nc -l 5555 > file.dat

SEND THE file.dat FROM THE SOURCE SERVER to TARGET SERVER

apt install pv
pv file.dat | nc server_target_ip 5555

Mac users

Docker for Mac is extremely slow on OSX. Mounting the volume with NFS will incredibly speed up everything.

Clone the IFSight/d4m-nfs repo in your sites folder:

cd ~/Sites/
git clone https://github.com/IFSight/d4m-nfs
@Leen15
Leen15 / patterns.yml
Last active January 28, 2019 18:04
Patterns for sematext agent
patterns:
- sourceName: !!js/regexp /docker-nginx-loadbalancer/
match:
- type: nginxbalancer
regex: !!js/regexp /^(\[(.+?)\]\s-\sclient_ip=(.+?)\slb=(.+?)\scontainer=(.+?)\sresponse_status=(.+?)\spath="(.+?)"\sresponse=(.+?)\scontainer_status=(.+?)\stotal_time=(.+?)\sbytes=(.+?)\suser_agent="(.+?)"\shost=(.+?)\sbody=(.+))/i
fields:
- message
- ts
- client_ip:string
- lb:string
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test Cam</title>
</head>
<script type="application/javascript">
var countRefreshOtherVideo = 0;
var count = Math.floor(Math.random() * 1000);
@Leen15
Leen15 / install_bucardo.sh
Last active April 8, 2024 11:39
step by step for install a bucardo instance
# NB: you need to have ubuntu 16.04 for install last version of bucardo, with 14.04 apt installs version 4.xx
apt-get update
apt-get install bucardo nano -y
mkdir /srv/bucardo
mkdir /var/run/bucardo
service postgresql start