Skip to content

Instantly share code, notes, and snippets.

Creating new open source stuff that you will like

Daniele Scasciafratte Mte90

Creating new open source stuff that you will like
View GitHub Profile
Mte90 / reported.tsv
Created May 7, 2021
Italian CV-6.1-2020-12-11 reported sentences
View reported.tsv
sentence reason
All'udire dei passi l'uomo cercò nasconder la donna. grammar-or-spelling
Ma visto che il bambino dormiva. grammar-or-spelling
Specializzato nei 10m piattaforma e 3m trampolino. 3m va letto "tre metri" oppure "tre emme"?
Dopo aver pratico numerosi anni la disciplina sportiva nuoto. grammar-or-spelling
La signorina Caporale aveva ricevuto un pugno su la bocca, formidabile. grammar-or-spelling
Dopo aver pratico numerosi anni la disciplina sportiva nuoto. grammar-or-spelling
E un'applicazione Web integrata nel catalogo per l'acquisizione e l'aggiornamento guidato dei metadati. grammar-or-spelling
Dopo aver pratico numerosi anni la disciplina sportiva nuoto. grammar-or-spelling
Nel 1984 Stallman diede inizio al progetto GNU. difficult-pronounce
Mte90 / webhook-getter.php
Created Apr 16, 2021
Webhook deployer for static websites from GitHub/GitLab
View webhook-getter.php
// This script require to be added in the Webhook section of you repo
// It will download the repository defined in the url in the path defined in the url
// For safety reasons is required a token in the url and will check the repo owner
// Note GitHub/GitLab generate zip files with a folder on it so it isn't enough to decomrpess them
// You need to get that content and a temporary folder is required to mvoe those files
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
Mte90 /
Last active Apr 16, 2021
#!/usr/bin/env python
# Requirements: API key from discourse with Global permission and webhook configured
# Dependencies: pip install flask pydiscourse yaml
# If the webhook is called and the author's post is a staged user send an email with the link of the thread with an invite to register
from flask import Flask, request, Response
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import json
Mte90 / woo-iva.php
Last active Mar 24, 2021
Esempio plugin per WooCommerce che aggiunge una colonna
View woo-iva.php
* Plugin Name: WooCommerce Colonna IVA
* Description: Aggiunge una colonna nei prodotti WooCommerce
* Version: 1.0.0
* Author: LUGRieti
* Author URI:
* Requires at least: 4.9
* Tested up to: 4.9
#!/usr/bin/env bash
# This script injects a file into the current Apache2 environment temporarily
# in order to check its syntax.
# sed -i "2i ServerName" /etc/apache2/sites-available/000-default.conf
# Require adding this line to the example conf
Mte90 / rss.opml
Created Dec 15, 2020
My RSS feed
View rss.opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<dateCreated>Tue, 15 Dec 2020 12:05:01</dateCreated>
<outline text="Altro">
<outline text="MGMT Magazine" type="rss" xmlUrl="" htmlUrl="" description=""/>
<outline text="Synthesia Updates" type="rss" xmlUrl="" htmlUrl="" description=""/>
Mte90 / gitlab-ci.yml
Last active Aug 12, 2020
GitLab CI version for WPBP
View gitlab-ci.yml
image: jakzal/phpqa:alpine
- vendor/
- Code Quality
Mte90 /
Created Jul 7, 2020
Backup to webdav files and WordPress DB
today=$(date +"%Y-%m-%d")
path=$(date +"%Y/%m/%d")
rm -rf ./backups
mkdir ./backups
tar --exclude='./public_html/cgi-bin' --exclude='*.zip' --exclude='./public_html/wp-content/cache' -zcvf ./backups/$today.tar.gz ./public_html > /dev/null
./wp db export --add-drop-table --path=./public_html/ - | gzip > "./backups/$today.sql.gz"
curl --user "user:pass" -T "./backups/$today.tar.gz" "$path/domain-$today.tar.gz"
Mte90 / remove_gutenberg_block.php
Created Jun 11, 2020
Remove WordPress Gutenberg block in content
View remove_gutenberg_block.php
function remove_block_gutenberg( $content, $blockname ) {
$blockname = str_replace('/', '\/',preg_quote($blockname));
return preg_replace('/\<\!\-\- ' . $blockname . '[^)]+\/' . $blockname . ' \-\-\>/', '', $content);
// Based on this ticket
// There is a block that we don't want on excerpt automatically generated,
// Automatic excerpt cut the content and this can generate a broken content
Mte90 / snippet.php
Created Apr 30, 2020
W3TC generate minified filename by checksum
View snippet.php
// Based on
// Get all the files, read them, concat them, get a md5 hash, cut at 10 and generate a new filename
// Why?
// W3TC generate the hashname based on the filenames so not invalidate the cache if there are changes
add_filter('w3tc_minify_urls_for_minification_to_minify_filename', 'w3tc_filename_filter', 20, 3);
function w3tc_filename_filter($minify_filename, $files, $type ){
$path_parts = pathinfo( $minify_filename );
$content = '';