Skip to content

Instantly share code, notes, and snippets.

@mmaridev
mmaridev / pve_live_migrate_test.sh
Last active February 26, 2023 10:44
Backup & restore for VM migration on the fly, without cluster
#!/bin/bash
# run command on new node
ssh root@oldnode vzdump VMID --mode snapshot --compress 0 --remove 0 --node NODE --stdout | (
sleep 5;
/usr/sbin/qmrestore - NEWVMID --storage local-zfs
)
# also works (vice-versa) for containers
vzdump PCTID --mode snapshot --compress 0 --remove 0 --node NODE --stdout | (
@mmaridev
mmaridev / TriangleTest.java
Last active April 10, 2021 08:40
add test for perimeter
@Test
void trianglePerimeterTest() {
// Copyright (C) Marco Marinello <mmarinello@unibz.it>
assertTrue(new Triangle(new Point(6,4), new Point(14,4), new Point(6,10)).perimeter() == 24);
assertTrue(new Triangle(new Point(6,10), new Point(6,4), new Point(14,4)).perimeter() == 24);
assertTrue(new Triangle(new Point(14,4), new Point(6,10), new Point(6,4)).perimeter() == 24);
assertTrue(new Triangle(new Point(30,15), new Point(45,35), new Point(60,15)).perimeter() == 80);
}
@mmaridev
mmaridev / install.sh
Created June 18, 2020 20:33
Install amdgpu
# https://www.youtube.com/watch?v=_GdusxYu_YA
sudo add-apt-repository http://repo.radeon.com/rocm/apt/debian/
@mmaridev
mmaridev / ldap_users_uuid.sh
Created April 18, 2020 08:54
Associate ldap DNs with therir UUID
#!/bin/bash
ldapsearch -x -LLL uid=* entryUUID
@mmaridev
mmaridev / bbb_zbx.py
Created April 6, 2020 13:46
BigBlueButton monitoring via Python 3 script
#!/usr/bin/python3
# Copyright (c) 2020 Marco Marinello <mmarinello@fuss.bz.it>
import sys, requests
from xml.etree.ElementTree import fromstring, ElementTree
SERVER = sys.argv[1]
SUM = sys.argv[2]
QUERY = sys.argv[3]
@mmaridev
mmaridev / 1-upgrade.yml
Last active November 23, 2019 20:01
Ansible playbook to upgrade a Windows client
# Copyright (c) 2019 Marco Marinello <me@marcomarinello.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@mmaridev
mmaridev / compile-lool-core-from-repo.sh
Last active April 22, 2020 09:27
-WIP- Compile LibreOffice core+online from source on Debian 10
#!/bin/bash
# Copyright (c) 2019 Marco Marinello <me@marcomarinello.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/bin/bash
# Enable unattended upgrades
echo "Disable unattended upgrades"
sed -i "s/1/0/g" /etc/apt/apt.conf.d/20auto-upgrades
@mmaridev
mmaridev / upgrade.sh
Created August 6, 2019 21:52
How Antonio upgrades pc's
#!/bin/bash
## Debian 9 full upgrade
echo debian 9 full upgrade
apt-get -y update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" full-upgrade
@mmaridev
mmaridev / docker-compose.yml
Created June 9, 2019 19:15
Nextcloud+Postgres+pgAdmin docker compose
version: '3.5'
services:
postgres:
container_name: pg
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
PGDATA: /data/postgres