Linux quick format usb drive

Metodo 2: Da Terminale (Linea di comando)

  1. Chek your USB device name (es. /dev/sdb o /dev/sdc):
    lsblk
  2. Umount that partition (replace /dev/sdX1 withe the real name of your device):
    sudo umount /dev/sdX1
  3. Format our device partition
    • FAT32: sudo mkfs.vfat /dev/sdX1
    • exFAT: sudo mkfs.exfat /dev/sdX1
    • NTFS:sudo mkfs.ntfs /dev/sdX1
    • ext4: sudo mkfs.ext4 /dev/sdX1

Mariadb problem after upgrading to a linux lts release

If after a major upgrade (typically to a new LTS release) your maridb local server doesn’t work any more, it could be a problem of AppArmor settings.

To solve it you can try with

sudo nano /etc/apparmor.d/tunables/alias

and then, add the end of that file

alias /var/lib/mysql/ -> /your/mysql-data/path/,

and then

sudo systemctl reload apparmor

and

sudo systemctl start mariadb

Footnote number padding in LibreWriter

LibreWriter doesn’t provide (so far) a smart way to set a “styled” space between the number of a footnote and the text (of that footnote).

Therefore you should add a (or more than) space in each footnote. But it would be a bad way to solve the problem.

A workaround can be to set the footnote characters (in styles) with a) a border (with an invisible color, such a s white over a white background) and b) a right padding. You can see in the following image:

add an external md file to a php page

… and, of course see it as html, with the same graphical appearance of any other web text.

A way can be use a very light javascript, md-block.js, di Lea Verou.

Then you can add a function to your php website, like the following:

<?php
/* to call a file Markdown from a given folder */

function scheda_md($file)
{
    global $yourwebsite;

    $file = basename($file);

    return '<md-block src="' .
           $yourwebsite .
           '/the-path/where-are-md-files/from-yourwebsite-root' .
           htmlspecialchars($file, ENT_QUOTES, 'UTF-8') .
           '"></md-block>';
}
?>

And in the page where you want to show that md file you can use this code:

<?= scheda_md('the-md-name.md') ?>

add footnotes to embedded md file

I mean notes that should be correctly shown both in a webpage and in the standalone md file.
You have to modify the js (md-bloc.js), as you can see in the linked file.

In this way you can use the md syntax, such as:

[^1] (for the anchor) and
[^1]: for the footnote.

“enter” key in phpmyadmin

If, in show view (not editing a single item) of PhpMyAdmin (i.g. with Firefox), you have a strange behavior of enter key, that is if enter add a new row inside a column, instead of confirm modifications you made, you can try to modify absolute right click settings.
In this way: Run on sites with restrictions -> Don’t Allow

Now your PhpMyAdmin should work as expected.

drop-down menu not working

If in some websites their drop-down menu doesn’t work, you can check if you have enabled (in that websites) the “Absolute enable right click” extension, that can interfere heavily with javascript. Try to disable it, and you can see if that was the problem.

Thunderbird – Whatsapp problem

There are (several) extensions of Thunderbird that allow you to use Whatsapp on your PC, as you can see in the image below.

If you have a problem of “space on disk”, causing the disconnection from Whatsapp, you could try to find and destroy the cache of TB Whatsapp (a folder called web.whatsapp.com or something like).

I was able to solve this problem in this way.

Automatically list wp posts

You can list automatically wordpress posts in your php webpage, based on its tags.

The following php code allow you to list all wp posts with a given tag:

<?php

// --- 1️⃣ Caricamento WordPress (solo se non già caricato) ---
if (!function_exists('get_posts')) {
    $possible_paths = [
        __DIR__."/../[your-wp-path]/wp-load.php",  // standard
        __DIR__."/../../[your-wp-path]/wp-load.php", // if you inclyde subfolders
    ];
    foreach ($possible_paths as $path) {
        if (file_exists($path)) {
            require_once($path);
            break;
        }
    }
}

// --- 2️⃣ Preparazione query ---
global $post;
$args = [
    'posts_per_page' => 200,
];

if (!empty($whatcategory)) {
    $args['category_name'] = $whatcategory; // category slug 
}
if (!empty($whattag)) {
    // $args['tag'] = $whattag; 
    $args['tag_slug__in'] = array_map('trim', explode(',', $whattag)); // tag slug (not shown names)
}

// --- 3️⃣ Cache opzionale (transient WordPress) ---
$cache_key = 'lista_blog_' . ($whatcategory ?? 'none') . '_' . ($whattag ?? 'none');
$myposts = get_transient($cache_key);

if ($myposts === false) {
    $myposts = get_posts($args);
    set_transient($cache_key, $myposts, 3600); // cache 1 ora
}

// --- 4️⃣ Output ---
if (!empty($myposts)) {
    echo '<h2>
        <span lang="en">Our blog posts about this topic</span>
        <span lang="it">Posts del nostro blog su questo tema</span>
    </h2>
    <ul id="blog-posts">';

    foreach ($myposts as $post) {
        // Non dipendiamo dal loop globale
        echo '<li><a href="'.get_permalink($post).'" rel="bookmark">'.get_the_title($post).'</a></li>';
    }

    echo '</ul>';
    wp_reset_postdata();
}
?>

You can put this code in a separate file, and include it in your php webpage, i.g. in the footer, with a code like the following:

<?php
$listablog = "[the-path-of-your-separate-file/the-name-of-your-separate-file";
  if (file_exists($listablog)) {
    if (
        (isset($whatcategory) && !empty($whatcategory)) ||
        (isset($whattag) && !empty($whattag))
    ) {
        include $listablog;
    }
  }
?>

In the header of a webpage where you want add this list, you have to set the value of the tag you want list:
$whattag="your tag,another tag";

Be careful: you has to set, as value, not the visualized tag name, but the “slug”. You can see it also with mouse hover and status bar.

MTP problems (android – PC cable connection)

If you cannot connect your PC with an android device via usb cable, check first if your mobile device has mtp (media transfert protocol) set, and not charging or other USB possibilities.

In Likebook, for example, you have to set as in the following image:

Of course, you should have also installed all the needed MTP libraries.