Skip to content

Instantly share code, notes, and snippets.

View ferdinandosimonetti's full-sized avatar

Ferdinando Simonetti ferdinandosimonetti

View GitHub Profile
@ferdinandosimonetti
ferdinandosimonetti / README.md
Created January 30, 2024 22:39
AKS-related scripts

AKS-related scripts

  • aksdebug *nodename* to be able to exec into an AKS node (unlocking Metricbeat, for example)
  • aksnode *cluster* *resourcegroup* to see nodepools' Kubernetes version
  • aksnodeupg *cluster* *resourcegroup* *newkubeversion* *nodepoolname* upgrade a nodepool to new Kubernetes version
  • getevents *nodepoolname* continuous flow of Kubernetes events related to a specific nodepool
  • watch getnodepool *nodepoolname* displays nodepool's hosts' state every 2 seconds
  • watch podsnotrunning *nodepoolname* displays not ready Pods on nodepool every 2 seconds
@ferdinandosimonetti
ferdinandosimonetti / get-ovfenv.py
Created November 3, 2023 06:35 — forked from lrivallain/get-ovfenv.py
This script retrieves informations from guestInfo.ovfEnv and print the OVF properties. In second time, it use OVF properties to reset the root password.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script retrieves information from guestInfo.ovfEnv and
print the OVF properties.
In second time, it use OVF properties to reset the root password.
"""
import subprocess
@ferdinandosimonetti
ferdinandosimonetti / d11-setup.sh
Last active October 8, 2023 08:23
Setup of Chromebook's Debian 11 environment
### /etc/apt/sources.list modifications (add contrib, non-free)
# Generated by distrobuilder
deb https://deb.debian.org/debian bullseye main contrib non-free
deb https://deb.debian.org/debian bullseye-updates main contrib non-free
deb https://deb.debian.org/debian-security/ bullseye-security main contrib non-free
#### First step
sudo apt update -y && sudo apt upgrade -y
#### Chromium ed altri
@ferdinandosimonetti
ferdinandosimonetti / aks-filter-old-pv.sh
Created September 19, 2023 09:03
How to filter AKS PVs that have been provisioned by old, unsupported, "in-tree" provisioner
kubectl get pv -o json | \
jq -r '.items[] | \
select(.metadata.annotations."pv.kubernetes.io/provisioned-by" == "kubernetes.io/azure-disk") | \
[ .spec.claimRef.name, .spec.claimRef.namespace, .spec.capacity.storage] | \
@csv'
VMware vSphere 6 Enterprise Plus
1C20K-4Z214-H84U1-T92EP-92838
1A2JU-DEH12-48460-CT956-AC84D
MC28R-4L006-484D1-VV8NK-C7R58
5C6TK-4C39J-48E00-PH0XH-828Q4
4A4X0-69HE3-M8548-6L1QK-1Y240
VMware vSphere with Operations Management 6 Enterprise
4Y2NU-4Z301-085C8-M18EP-2K8M8
1Y48R-0EJEK-084R0-GK9XM-23R52
@ferdinandosimonetti
ferdinandosimonetti / webm-mp4-srt.txt
Created June 6, 2022 10:57
webm to mp4 and srt insertion from a chromebook
# high quality conversion
ffmpeg -i "prova.webm" -crf 23 "prova.mp4"
# adding srt extracted via AWS Transcribe
ffmpeg -i prova.mp4 -i prova.srt prova-out.mp4
@ferdinandosimonetti
ferdinandosimonetti / select-deployments-with-images-with-pattern.sh
Last active July 7, 2022 22:18
Select only the deployments whose image 'fqdn' contains a specific word
[prova|default] ferdi@ferdi-U820:~$ kubectl get deploy -o json -A | jq -r '.items[] | {NAME:.metadata.name,NAMESPACE:.metadata.namespace,IMAGE:.spec.template.spec.containers[].image} | select(.IMAGE | contains("myword"))'
@ferdinandosimonetti
ferdinandosimonetti / convert-putty-pubkey.txt
Created March 14, 2022 08:41
How to convert Putty-generated public keys to standard OpenSSH format, suitable for insertion in authorized_keys file
ferdi@ferdi-U820:~$ cat public_test.ppk
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20220214"
AAAAB3NzaC1yc2EAAAADAQABAAACAQCE8JCObbX4s84AYZVHceFaK0F1O2a0Shpt
HVJh/jjAScNGfw2ViQ5rXXVT2AcJeDjSdhEqiFlSfLgquOv8p7nv2IlQRI03YD9T
/FlitPMWQYX72ox1C2B8AG+FpdexqDyduc5y8hNakE5xZy5IQo7VK+LRMwA/5sTD
Ym20WSw4WCDDUnJdvHoICGab1pPnDf0qsCNL4uSeD7SurAZDeywUKlK0iYlRRnZv
UuznY7HWyE6POf56ppyZRCXPkNx8jF2S/8KJz6K/2niS8Q1VqrHSKqxxh/SGyBDe
rFJC0pHhK3oyHghS8aNTniU4ya+PXqlzY209xcgS7SO7qOYa4goKPuPvllPALzc0
YfbzLWZ0ki47FsH2QEJiQ1HkEMg2fjhJQ2zr54YJh/2lUrn9CzO2sfTLxa9Y649Q
@ferdinandosimonetti
ferdinandosimonetti / gitlab-search-user.sh
Last active January 25, 2022 11:26
Lookup Gitlab users by email / username (works with blocked users too)
ferdi@DESKTOP-7DEMIAH:/mnt/c/Users/ferdi$ curl http://gitlab.domain.it/api/v4/users?private_token=vhJEVFPdqGl59C42\&search=one.two@three.it | jq '.'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 835 100 835 0 0 8434 0 --:--:-- --:--:-- --:--:-- 8434
[
{
"id": 132,
"name": "Uno Due",
"username": "unodue",
"state": "active",
@ferdinandosimonetti
ferdinandosimonetti / disable-ssl-redirect-nginx.txt
Created September 24, 2021 09:46
disable redirect to HTTPS in Nginx Ingress Controller
https://stackoverflow.com/questions/50087544/disable-ssl-redirect-for-kubernetes-nginx-ingress/50087545
...
kind: Ingress
metadata:
name: project_name-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
...