• [^] # Re: tarsnap

    Posté par . En réponse au journal Sauvegarde pour ordinateur personnel légèrement avancé. Évalué à 3.

    Et au cas où ça intéresse quelqu'un j'ai créé un p'tit user script pour changer les unités de volume de données des tableaux.

    // ==UserScript==
    // @name TarsnapHumanReadable
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description Tarsnap Human Readable
    // @author barmic
    // @match https://www.tarsnap.com/*
    // @grant none
    // ==/UserScript==
    (function() {
     'use strict';
     function convert(value) {
     const units = ['o', 'Kio', 'Mio', 'Gio', 'Tio'];
     const values = value.split(" ");
     if (!values || values.length !== 2 || values[1] !== 'bytes') {
     return value;
     }
     var bValue = values[0];
     var unitIdx = 0;
     while (bValue >= 1000) { // I prefer read "0.97 Gio" instead of "1000 Mio"
     bValue = bValue / 1024;
     unitIdx += 1;
     }
     return bValue.toFixed(2) + ' ' + units[unitIdx];
     }
     for(let num of document.querySelectorAll("td")) {
     num.textContent = convert(num.textContent);
     }
    })();

    C'est un peu fait à la truelle mais ça fonctionne bien.

    https://linuxfr.org/users/barmic/journaux/y-en-a-marre-de-ce-gros-troll