Skip to content

Instantly share code, notes, and snippets.

View EdoardoVignati's full-sized avatar

Edoardo Vignati EdoardoVignati

View GitHub Profile
@EdoardoVignati
EdoardoVignati / asymmetric_encryption.php
Created June 23, 2026 13:35
Asymmetric encryption PHP
<?php
// http://codereaper.com/blog/2014/asymmetric-encryption-in-php/
// create the private key private.key
// $ openssl genrsa -out private.key 2048
// create the public key public.pem
// $openssl rsa -in private.key -outform PEM -pubout -out public.pem
/*
$private_key = openssl_get_privatekey("--- BEGIN RSA ---
xxxxxxx
@EdoardoVignati
EdoardoVignati / enable_disable_ping_firewall.ps1
Last active June 23, 2026 13:34
Enable/Disable ping/firewall
New-NetFirewallRule -DisplayName "Allow ICMPv4-In" -Protocol ICMPv4 -IcmpType 8 -Direction Inbound -Action Allow
Remove-NetFirewallRule -DisplayName "Allow ICMPv4-In"
@EdoardoVignati
EdoardoVignati / download-video.sh
Created April 1, 2026 18:19
Download mp4 from ts segments in Bash
if [ -z "$1" ]; then
echo "Uso: $0 <url_segmento_ts>"
exit 1
fi
URL="$1"
# Directory temporanea
TMP_DIR="segments"
LIST_FILE="list.txt"
@EdoardoVignati
EdoardoVignati / upgrade-nextcloud.sh
Created August 22, 2024 15:02
Upgrade Nextcloud
sudo -u www-data php /var/www/html/cloud.mysite.it/updater/updater.phar --no-interaction
@EdoardoVignati
EdoardoVignati / qt_modbus_read_example.cpp
Created June 4, 2024 15:04
Example of how to read a holding register in C++ using QT Modbus Serial Client 6.x
#include <QCoreApplication>
#include <QVariant>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QModbusRtuSerialClient>
#include <QModbusDevice>
#include <QModbusClient>
#include <QVariant>
#include <QSerialPort>
#include <thread>
@EdoardoVignati
EdoardoVignati / track.sh
Created May 7, 2024 22:22
Track all the Git branches of all repositories
for folder in $(ls -d */); do
cd $folder
echo
echo ===========================
echo $folder
echo ===========================
for branch in $(git branch -r | grep -v HEAD | cut -d / -f 2,3,4,5); do
echo
echo "=>" $branch
@EdoardoVignati
EdoardoVignati / set-super-user.sql
Created November 8, 2023 22:05
Update SQL to enable Super User
UPDATE mysql.user SET Super_Priv='Y' WHERE user='<myuser>' AND host='localhost';
@EdoardoVignati
EdoardoVignati / git_wizard.bat
Last active July 6, 2023 08:18
Git Wizard 🧙‍♂️ - Git bulk operations manager (Windows only)
:: Prerequisite: git
:: Usage: Download the wizard
:: Create a file named "repos.txt" in the same folder of the wizard
:: Insert in the file the absolute path of the repositories to track, one per line
:: Double click on the wizard and follow the instructions
:: Contribution: Feel free to contribute to this script!
:: Credits: Edoardo Vignati <edoardo.vignati@akkodis.com>
:: Emanuele De Filippis <emanuele.defilippis@akkodis.com>
@EdoardoVignati
EdoardoVignati / material_button_with_border.dart
Last active June 17, 2022 13:23
Flutter MaterialButton with borders and optional rounded angles
MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
side: const BorderSide(color: Colors.black),
),
elevation: 0,
onPressed: () {
//Do something
},
child: Text("Button text"),
@EdoardoVignati
EdoardoVignati / js-openlayers-intercept-click.js
Last active April 26, 2022 21:55
JS OpenLayers intercept click on marker and get coordinates with button cursor.
map.on("singleclick", function(e) {
feature = map.forEachFeatureAtPixel(e.pixel, function(feature) {
return feature;
});
var coord = feature.getGeometry().getCoordinates();
coord = ol.proj.transform(coord,"EPSG:3857","EPSG:4326");
console.log(coord);
});
map.on("pointermove", function (evt) {