Skip to content

Instantly share code, notes, and snippets.

View Da-Juan's full-sized avatar
🛠️

Nicolas Rouanet Da-Juan

🛠️
View GitHub Profile
@Da-Juan
Da-Juan / get_certificate_dates.sh
Created June 24, 2021 15:00
Get certificates validity dates for a list of domains
#!/usr/bin/env bash
#
# Get certificates validity dates for a list of domains
#
while read -r domain; do
echo "$domain"
echo | openssl s_client -connect "$domain":443 -status 2>&1 | openssl x509 -dates -noout
done < domains
@Da-Juan
Da-Juan / run_pgtuner.sh
Created March 1, 2022 16:12
Run postgresqltuner.pl on each database and keep 3 copies of each database's report
#!/usr/bin/env bash
# This script requires postgresqltuner.pl:
# apt install libdbd-pg-perl libdbi-perl perl-modules
# wget -O /usr/local/bin/postgresqltuner.pl https://postgresqltuner.pl
# chmod +x /usr/local/bin/postgresqltuner.pl
OUTPUT_DIR="/var/lib/postgresqltuner"
# Max number of files to keep for each database
MAX_COPIES=3
@Da-Juan
Da-Juan / prometheus_flask_exporter.py
Created August 23, 2023 08:43
Prometheus exporter in Python with background metrics gathering
"""Prometheus exporter with background metrics gathering."""
import signal
import threading
import time
from typing import TYPE_CHECKING
import schedule
from flask import Flask
from prometheus_client import Gauge, make_wsgi_app
from werkzeug.middleware.dispatcher import DispatcherMiddleware