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 / 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 / bbb-register-merge.php
Last active Jan 25, 2021
WP integration with BBB to start/stop and download a video call recording
View bbb-register-merge.php
Plugin Name: BBB Register
Plugin URI:
Description: Add support to start/stop and download videos from the BBB instance of Merge-IT.
Author: Daniele Mte90 Scasciafratte
Version: 1.0.0
Author URI:
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 = '';
Mte90 /
Created Mar 17, 2020
Clips dataset parser and cleaner
#!/usr/bin/env bash
function extract() {
echo "Estraggo $1.rar"
unrar e "./$1.rar" \*.txt \*.wav './clips-mitads/' -o+
if [ ! -d './clips-mitads' ]; then
mkdir './clips-mitads'
Mte90 / Customfile
Last active Jan 15, 2020
2 new commands for VVV
View Customfile
class VVVScripts < Vagrant.plugin(2, :command)
def self.synopsis
"Execute script from /config/homebin/"
def execute
with_target_vms(nil, single_target: true) do |vm|
@env.ui.output "#{$yellow}Executing #{$red}#{ARGV[1]}#{$creset}\n"
vm.action(:ssh_run, ssh_run_command: "/srv/config/homebin/#{ARGV[1]}" )
Mte90 / alter-login.php
Created Dec 3, 2019
Send email to user if not logged after 3 weeks
View alter-login.php
* Plugin Name: Alert Last Login
* Plugin URI:
* Description:
* Version: 1.0.0
* Author: Codeat
* Author URI:
* License: GPL-2.0+
Mte90 / block-wprestapi-loggedonly-orbykeyword.php
Created Nov 26, 2019
Block WordPRess rest api except logged user or if there is a parameter in the url
View block-wprestapi-loggedonly-orbykeyword.php
add_filter('rest_authentication_errors', function ($result) {
if (!empty($result)) {
return $result;
$access = is_user_logged_in();
if ( !$access ) {
if ( !isset($_GET['iwantthem']) || isset($_GET['iwantthem']) && $_GET['iwantthem'] !== 'yes' ) {