Skip to content

Instantly share code, notes, and snippets.

🇮🇹
Coding on something

Daniele Scasciafratte Mte90

🇮🇹
Coding on something
Block or report user

Report or block Mte90

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Mte90
Mte90 / alter-login.php
Created Dec 3, 2019
Send email to user if not logged after 3 weeks
View alter-login.php
<?php
/**
* Plugin Name: Alert Last Login
* Plugin URI:
* Description:
* Version: 1.0.0
* Author: Codeat
* Author URI: http://codeat.it
* License: GPL-2.0+
@Mte90
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
<?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' ) {
@Mte90
Mte90 / open_with_GitQClient.desktop
Created Oct 28, 2019
open_with_GitQClient.desktop
View open_with_GitQClient.desktop
[Desktop Entry]
Type=Service
Encoding=UTF-8
Actions=OpenWithQGitClient
ServiceTypes=KonqPopupMenu/Plugin,inode/directory
ExcludeServiceTypes=kdedevice/*
X-KDE-Priority=TopLevel
[Desktop Action OpenWithQGitClient]
Name=Open with QGitCLient
@Mte90
Mte90 / devtools.js
Last active Apr 19, 2019
Auto submit CV sentence for review
View devtools.js
setInterval(function() {
var divs = document.querySelectorAll('button.secondary[aria-pressed=true]');
if(divs.length === 5) {
document.querySelector('#confirm-buttons button').click()
}
}, 100);
@Mte90
Mte90 / opensupport-cron.sh
Last active Mar 20, 2019
OpenSupports Cron to activate users
View opensupport-cron.sh
#!/bin/bash
mysql --user='[users]' --password='[psw]' --database='[db]' --execute="UPDATE user SET verification_token = NULL WHERE user.verification_token IS NOT NULL;"
@Mte90
Mte90 / update-bot.sh
Last active Jan 31, 2019
Auto update Mozilla Italia bot and restart them on unix system
View update-bot.sh
#!/usr/bin/env bash
cd /opt/mozita/
pkill -f antispam_mozita.py
cd ./mozitaantispam_bot/
git pull
nohup python3 ./antispam_mozita.py &
cd ../
@Mte90
Mte90 / replace-po-wp-to-cp.sh
Last active Dec 17, 2018
ClassicPress i18n
View replace-po-wp-to-cp.sh
#!/bin/bash
locale=$1
function replace() {
sed -i.bak s#https://"$1".wordpress.org/forums/#https://forums.classicpress.net/c/support#g /tmp/"$1"-"$2".po
sed -i.bak s/WordPress.org/ClassicPress.net/g /tmp/"$1"-"$2".po
sed -i.bak s/WordPress/ClassicPress/g /tmp/"$1"-"$2".po
}
@Mte90
Mte90 / freemius-to-slack.php
Last active May 31, 2019
Freemius to slack notification
View freemius-to-slack.php
<?php
// Get Freemius data
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if( isset( $data['objects'] ) ) {
slack($data);
}
function slack($data) {
@Mte90
Mte90 / Readme.md
Last active Jun 26, 2018
Common Voice scripts for italian
View Readme.md

This set of script is used to manipulate the stuff to upload on common voice.

Usually the procedure is to check the sentences, later with prepare_for_pipe.sh is added the pipe for newlines, create_pipe.sh add the pipes and made a counter of the actual status of this strings.

With only_italian.py instead we extract only the sentences for italian to manipulate later after a manual check of every line as example for links.

@Mte90
Mte90 / scripts.js
Created Jun 6, 2018
Sumo sprint Android 2018
View scripts.js
// This automatically click on yes on all of the three buttons to speed the procedure
jQuery('.form-item-field-moderation-personalized:nth-child(2) label, .form-item-field-moderation-issue-addressed:nth-child(2) label, .form-item-field-moderation-positive-tone:nth-child(2) label ').trigger('click')
You can’t perform that action at this time.