Reload web page and beep

Sometimes you need, without any plugins, to periodically reload a web page and get notified by something like an acoustic signal.

You can use this simple script (copy and paste in the inspector console or use Sources – > Snippets to save and reuse it)

const reloadMinutes = 15

function beep() {
    var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi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VGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");  
    snd.play();
}

document.getElementsByTagName("body")[0].innerHTML = 
`<iframe id="testFrame" 
        src="${window.location.toString()}" 
      style="position: absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%;">
</iframe>`;
reloadTimer = setInterval(
    function(){ 
        document.getElementById("testFrame").src=document.getElementById("testFrame").src
        beep()
    },
    reloadMinutes * 60000 || 900000
)

Use reloadMinutes to set the reload time.

P.S. Some web sites have protections to avoid to be embedded in IFRAMEs, watch out.

#COVID-19: Davide e Golia, S1-1

nCoV - Corona Virus - COVID-19

Piccolo un centesimo di globulo rosso, invisibile, sospeso tra vita e morte secondo qualche definizione. Eppure così cazzuto.

Semplicemente un virus, il COVID-19

Un coso così minuto in poco tempo è riuscito a:

  • bloccare persone: dal muoversi liberamente, dal incontrarsi, dal abbracciarsi.
  • bloccare mezzi quali aerei, navi, camion, auto (si ok, condotti da persone)
  • sistemare in pochi giorni problemi di smog
  • cambiare il nostro modo di lavorare
  • renderci evidente laddove sta la stupidità di certe persone, pompata di parecchie atmosfere grazie all’ego e all’arroganza di fronte a qualcosa che non si conosce.
  • a volte ucciderci
  • spesso più che altro farci tornare con i piedi per terra ricordandoci che, a caso o meno, quando alla natura girano le serve ben poco per farci mettere in ginocchio con le orecchie basse.

Ed è piccolo, fottutamente piccolo.

CF7: send submitted data to another URL as JSON

Contact Form 7

If you need to send data from a Contact Form 7 (CF7) form to another URL you can use this simple PHP script. Just add it in your WordPress functions.php file inside your theme.

// define the URL where data should be submitted, this constant can be stored in your `wp-config.php` file
define('CF7_TO_API_URL', 'https://...........');
function action_wpcf7_mail_sent( $contact_form ) { 
    // you can limit this script to certains forms, just change the IDs (111,222,333) and uncomment line 10 and 47
    // if (in_array($WPCF7_ContactForm->id(), [111,222,333])) {
        $wpcf7      = WPCF7_ContactForm::get_current();
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $data = $submission->get_posted_data();
            $url = $submission->get_meta( 'url' ); // url where the submit come from
            $postId = url_to_postid($url); // from the url we get the post ID
            $postType = get_post_type($postId); // from post ID we get the post type
            $title = get_the_title($postId); // and the title
            $output = [
                "firstname" => $data['firstname'],
                "lastname" => $data['lastname'],
                "email" => $data['email'],
                "phone" => $data['phone'], // add all needed fields
                "source" => $url,
                "is_product" => $postType === 'product', // ex: we want to know if the page was a product (custom post)
                "product_name" => $postType === 'product' ? $title : '', // if it is a product tell me the product name (title)
                "want_newsletter" => $data['newsletter'] === 1  ||   $data['newsletter'] === "1" // ex. for checkbox    
            ];
            $options = array(
                'http' => array(
                    'method'  => 'POST', // you can change the method (GET, POST)
                    'content' => json_encode( $output ), // php array as json
                    'header'=>  "Content-Type: application/json\r\n" .
                        "Accept: application/json\r\n"
                )
            );
              
            $context  = stream_context_create( $options );
            $result = file_get_contents( CF7_TO_API_URL, false, $context );
            $response = json_decode( $result ); // you can use/output the response from 
        }
    // }
}; 
         
// add the action 
add_action( 'wpcf7_mail_sent', 'action_wpcf7_mail_sent', 10, 1 ); 

Crypto Miner (Coinhive) in YouTube Ads

During normal browsing on YouTube, at some point, the antivirus Avast reported something that was not good.

From the Chrome Inspector it appears that one of the ads is infected and tries to load a crypto miner from Coinhive

Everything has been reported to Google, now I await the answer.