Skip to content

Instantly share code, notes, and snippets.

Scripts for manage ZFS snapshots for Proxmox Shell

List snapshots zfs-list-snapshots.sh:

#!/bin/bash

help() {
  echo "Usage: $0 dataset"
 echo "Example: $0 tank-zfs/nas"
#!/bin/bash
# Verifica que se haya pasado el nombre de la interfaz
if [[ -z "$1" ]]; then
echo "❌ Error: Debes pasar el nombre de la interfaz como argumento."
echo "👉 Uso: $0 <nombre_interfaz>"
exit 1
fi
iface="$1"
#!/bin/bash
# Lista de interfaces separadas por comas
interfaces="enp0s20u1,enp0s20u2,enp0s20u4,enp0s20u3u1,enp0s20u3u2,enp0s20u3u4"
# Valor del ancho de banda en kbit, pasado como argumento o definido por defecto
bw=${1:-10000} # Si no se pasa argumento, usa 10000 kbit por defecto
# Convertir la lista de interfaces en un array
IFS=',' read -ra iface_array <<< "$interfaces"
@sjtosco
sjtosco / gist:34d3210209bc8c844a5adf1aedc223a4
Last active April 27, 2025 08:45
Virt-manager with osinfo updated Debian 12
# Need install: `sudo apt install osinfo-db-tools`
```
sudo osinfo-db-import --local --latest
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager -y
```
@sjtosco
sjtosco / get_gw_by_iface.sh
Last active March 20, 2024 13:40
Check router (gateway) of specific interface
get_gw_by_iface(){
# Return router ip of interface
# Usage: get_gw_by_iface IFACE
sudo traceroute -n -i $1 -m1 $(get-extip) 2>/dev/null | tail -1 | awk '{print $2}'
}
get_gw_by_iface2(){
# Return router ip of interface (multitable)
# Usage: get_gw_by_iface IFACE
ip route list table all | awk '/default via/' | grep enp1s0 | awk '{print $3}'
@sjtosco
sjtosco / ss-parse.sh
Created February 14, 2024 15:26 — forked from ffund/ss-parse.sh
Parses SS output for BBR flow live, and outputs in CSV format. Adjust the sleep interval if you want. Use as: `./live-ss-parse.sh 10.0.0.1 5201 | tee outfile.csv` where the argument is the peer IP address and port of the flow you are interested in.
#!/bin/bash
dst=$1
dstport=$2
while [ 1 ]; do
ts=$(date +%s.%N)
line=$(ss -eipn dst "$dst:$dstport" | grep "bbr")
rto=$(echo $line | grep -oP '\brto:.*?(\s|$)' | awk -F '[:,]' '{print $2}' | tr -d ' ')
rttvals=$(echo $line | grep -oP '\brtt:.*?(\s|$)' | awk -F '[:/]' '{print $2","$3}' | tr -d ' ')
@sjtosco
sjtosco / load_two_hello_docker.sh
Created June 28, 2023 15:01
Docker hello container demos
# NGINX Hello app
docker run --rm --name nginx-hello -p 8081:80 -d nginxdemos/hello
# GOOGLE Hello app ver 1.0
docker run --rm --name hello-app -p 8080:8080 -d gcr.io/google-samples/hello-app:1.0
# Test in browser with http://localhost:8080 or http://localhost:8081
@sjtosco
sjtosco / python.json
Created June 13, 2023 04:21 — forked from prandelicious/python.json
[VS Code snippet] Create default python header content
"Default Header": {
"prefix": "header",
"body": [
"#!/usr/bin/env python",
"# -*- coding: utf-8 -*-",
"\"\"\"${1:Custom module name or brief description}.\n",
"${2:Enter description of this module}",
"",
"__author__ = ${3:[authors]}",
"__copyright__ = Copyright 2018",
@sjtosco
sjtosco / config.sh
Created February 24, 2023 21:58 — forked from vietdien2005/config.sh
Fix force gdm login screen to the primary monitor
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/
@sjtosco
sjtosco / Docker mariadb+phpmyadmin
Created August 8, 2019 23:09 — forked from alexishida/Docker mariadb+phpmyadmin
Docker mariadb+phpmyadmin
docker run -d \
--name=mariadb \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-e MYSQL_ROOT_PASSWORD=root \
-v /storage/mariadb:/var/lib/mysql \
-p 3306:3306 \
mariadb:latest
docker run -d \