Skip to content

Instantly share code, notes, and snippets.

@mmaridev
mmaridev / dump_vm.sh
Created May 25, 2019 11:43
Proxmox dump to zstd
#!/bin/bash
vzdump VMID --mode snapshot --storage STORAGE --compress 0 --remove 0 --node NODE --stdout | zstd -o your-backup.vma.ztd
$ zstd -19 -o base_shrinked.img{.zstd,} # Will take a few time
$ du -sh base_shrinked.img*
1,4G base_shrinked.img
281M base_shrinked.img.zstd
@mmaridev
mmaridev / verifica.tex
Created May 5, 2019 10:32
Verifica delle conscenze laboratorio hacking
\documentclass{exam}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{courier}
\usepackage{graphicx}
\newcounter{abc}
\renewcommand{\theabc}{\stepcounter{abc}\Roman{abc}}
\newcommand{\answerbox}{\fbox{\phantom{M}}}
@mmaridev
mmaridev / comune_provincia_regione.csv
Last active May 1, 2019 17:19
A list of italian cities
Agliè Torino Piemonte
Airasca Torino Piemonte
Ala di Stura Torino Piemonte
Albiano d'Ivrea Torino Piemonte
Almese Torino Piemonte
Alpette Torino Piemonte
Alpignano Torino Piemonte
Andezeno Torino Piemonte
Andrate Torino Piemonte
Angrogna Torino Piemonte
@mmaridev
mmaridev / analyze.py
Created March 19, 2019 12:22
Translating django.po files using external tools
#!/usr/bin/python
a = open("django.po")
h = [x.strip() for x in a.readlines()]
a.close()
counter = 0
while counter < len(h):
pre = counter
@mmaridev
mmaridev / compile-borg.sh
Last active March 19, 2019 10:00
Compile borg from sources to standalone
#!/bin/bash
cd /tmp
pip3 install virtualenv
if [ ! -e borgbackup-1.1.9.tar.gz ]; then
wget https://github.com/borgbackup/borg/releases/download/1.1.9/borgbackup-1.1.9.tar.gz
fi
@mmaridev
mmaridev / virus.py
Created March 13, 2019 16:30
Block your UNIX friends script
#!/usr/bin/python3
# Copyright (c) 2018 Marco Marinello <mmarinello@sezf.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 / django_apache.conf
Created February 24, 2019 19:52
Apache 2 configuration to run django apps
<VirtualHost *:80>
ServerName example.org
ServerAdmin you@example.org
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/?(.well-known)/
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}
@mmaridev
mmaridev / ws2.php
Created January 20, 2019 13:15
WeatherWing human variables converter
<?php
$fileaddr = "http://localhost/meteo/clientraw.txt";
$content = implode('', file ($fileaddr));
$vals = explode(" ", $content);
//Gestione della direzione del vento (da tabella5.php)
function direzioneVento ($gradi)
@mmaridev
mmaridev / settings_local.py
Created December 31, 2018 09:47
Local settings for django site with mariadb
ALLOWED_HOSTS = ["you.example.org"]
DEBUG = True
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "",
"USER": "",
"PASSWORD": "",