Journal of my recent activities

Google Sheets: Bulk delete

Tools > Script ediotr Set a breakpoint at console log sheet name and Debug.

function DeleteAllSheets() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  console.log("Doc: " + ss.getName());
  var sheets = ss.getSheets();
  for (i = 0; i < sheets.length; i++) {
    switch(sheets[i].getSheetName()) {
      case "21-01":  
        break;
      default:
        console.log("Delete: " + sheets[i].getSheetName());
        ss.deleteSheet(sheets[i]);
    }
  }
}

https://spreadsheetpoint.com/delete-multiple-sheets-google-sheets/

#soft

Convert ssh2 public key to openssh format

If the pub key is in the format

---- BEGIN SSH2 PUBLIC KEY ----

then you can convert it with

ssh-keygen -i -f klucz.pub >> ~/.ssh/authorized_keys

#soft #linux

Backup SD Card in Fedora

  1. Insert card
  2. Check the /dev label (fdisk -l; lsblk, df)
  3. Unmount: umount /dev/sdb1 (do not use Nautilius eject button)
  4. Backup: dd bs=4M if=/dev/sdb of=nextcloud210313.img

Update pip packages

(venv) $ pip list --outdated
(venv) $ pip list --outdated --format=freeze \
               | grep -v '^\-e' | cut -d = -f 1  \
               | xargs -n1 pip install -U

How to upgrade all Python packages with pip #python #soft

$ systemctl list-timers
$ systemctl enable --now ibm_backend.timer

in user space use --user parameter, and put your timers into ~/.config/systemd/user/

Use systemd timers instead of cronjobs

certbot timer

OnCalendar format

#linux #cron #crontab

Photomultiplier tubes are extremely sensitive detectors of light

1 photon > cathode> 1 electron >> ... > n*electron >> ... > anode

#physics

Repairing LibrreOffice conversion odt to pdf in parallel PHP script, as it sometimes hangs.

<?
$cmd = 'export HOME=/tmp && cd /tmp  && libreoffice --headless --convert-to pdf  ~/16c6801746f3e924b254abb0089f0a0f.odt ';
exec($cmd, $output, $retCode);

The problem is in access to /tmp/.config and /tmp/.cache for the same user (apache) from different processes. The solution was to generate a temporary subdir for every conversion and pass it to HOME parameter.

#soft

$ podman network create nextcloud-net
$ podman network ls
$ podman network inspect nextcloud-net

$ podman volume create nextcloud-app
$ podman volume ls
$ podman volume inspect nextcloud-app

Installing Nextcloud 20 on Fedora Linux with Podman

Add new disk in OVH public cloud server

Storage > Block Storage > Create new instance

Attach it to the instance using context menu [...]

$ lsblk
$ fdisk /dev/vdb
# n -> default answers , w
$ mkfs.ext4 /dev/vdb1
$ mkdir /mnt/disc1

# fstab
$ blkid
$ vim /etc/fstab
$ mount -a

#$ sudo mount /dev/vdb1 /mnt/bazy

https://docs.ovh.com/pl/public-cloud/utworzenie_i_konfiguracja_dodatkowego_dysku_dla_instancji/ #linux #soft