31 March 2023

Google Analytics 4

 Toevoegen GA4 code in template


zie https://www.dtheblerd.com/2022/06/add-google-analytics-4-to-blogspot-website-with-global-site-tag.html


Editeer dus de template die je gebruikt en zet net voor </head> de GA4 code


<!-- Google tag (gtag.js) -->

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());


  gtag('config', 'G-BW5P069ZQ0');

</script>


De id MEASUREMENT ID vind je in https://analytics.google.com/ > Webstream details

26 March 2021

Troubleshooting slow PC

 see

Things to do first:
  • reboot
  • disk cleanup
  • windows updates
If the computer does not boot , maybe you need to recreate the boot manager :
bcdboot command
EFI partition MUST BE FAT32 formatted and is between 100MB and 500MB

If needed use diskpart 

  • diskpart commands
    • list disk
    • select disk x (replace x by a number from the output of the previous command)
    • list partition
    • list volume (here you can see the filesystem type e.g;. FAT32 or NTFS ...)
    • select volume x  (replace x by a number from the output of the previous command)
    • assign letter=V:
    • help format
    • format V: FS=FAT32 LABEL=EFIBOOT OVERRIDE
    • if you want to recreate the boot manager :
      exit
      bcdboot C:\windows /s V: /f UEFI
  • bcdedit : managing Boot Configuration Data (BCD)
    Info from Microsoft:
    BCD files provide a store that is used to describe boot applications and boot application settings. BCDEdit can be used for a variety of purposes, including creating new stores, modifying existing stores, adding boot menu options, and so on
  • bcdedit /enum active

Open a command prompt with admin privileges (approve UAC if demanded)

start diskpart -> diskpart

select your disk with efi partions -> sel disk 1 (if disk 1 is the correct disk)

list your available partitions -> list part

if partition 2 that is the efi partition -> sel part 2

detail part

Partition 2
Type    : c12a7328-f81f-11d2-ba4b-00a0c93ec93b  <<<<<< this means it is an EFI BOOT partition
Hidden  : Yes
Required: No
Attrib  : 0X8000000000000000
Offset in Bytes: 524288000
Now when the Required: property is set to No, you know that is the EFI partition you can delete. The other EFI partition will have the Required: property set to Yes. Do not delete that partition.

more info about the Required property, scroll to: gpt attributes on this page.

Edit:
to change the windows boot device (efi partition) use the following command:

bcdedit /set {bootmgr} device partition=a:
*where a: is the assigned drive letter for your new efi partition

Thanks to @mbrownnyc for looking up this information bcdedit Device Setting
The above useful info is copied from another website, hope the author doesn't mind ;-)

  • Create boot manager
This useful info below is copied from another website, hope the author doesn't mind ;-)

bcdboot :Tool to use is bcdboot.

First you create bootable partition, format it and then use bcdboot command to create bootloader files.

Windows 10 Installation Media:

Insert the Media (DVD/USB) in your PC and restart.
Boot from the media.
Select Repair Your Computer.
Select Troubleshoot.

Choose Command Prompt from the menu:
Type in the command:

Diskpart

Type in the command:

List disk            (Note which disk is your Boot drive number mine is 0)

Type in the command:

Sel disk 0

Type in the command:

List vol               (Note which volume is the EFI partition mine is 4)

Type in the command:

Sel vol 4

Type in the command:

assign letter=V:

Type in the command:

Exit

Type in the command:

V:

After you have assigned a drive letter Using Diskpart You can format the EFI partition:

Example: if you assigned a letter V to the partition the command would be:
format V: /FS:FAT32
bcdboot C:\windows /s V: /f UEFI



Other useful commands: (use them at your own risk)

  • Remove hiberfil.sys
    Start command prompt as administrator
    powercfg -h off
  • Remove pagefile.sys on Windows 10
    sysdm.cpl
    advanced > performance > settings
  • Disk scan:
    sfc /scannow
    DISM /Online /Cleanup-Image /RestoreHealth

24 March 2021

 Joomla - mp3 and mp4 support



Content > Media > Options

  • Media
    • Legal Extensions (File Types) : bmp,csv,doc,gif,ico,jpg,jpeg,mp3,mp4,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,MP4,MP3,ODG,ODP,ODS,ODT,PDF,PNG,PPT,SWF,TXT,XCF,XLS
    • Maximum size in MB : 20
    • Legal Image Extensions (File Types) : bmp,gif,jpg,mp4,png,mp3
    • Legal MIME Types : image/jpeg,image/gif,image/png,image/bmp,application/x-shockwave-flash,application/msword,application/excel,application/mp4,video/pdf,application/powerpoint,text/plain,application/x-zip,audio/mpeg,video/mp4

sudo nano /etc/php/7.4/apache2/php.ini

upload_max_filesize = 20M
post_max_size = 21M

 


Uninstall software in Windows 10


e.g. to uninstall Avast Anti-virus:


  • Press "Control+Alt+Del" to start the task manager > [Task manager]
  • File > Run new task
  • cmd
  • [x] Run as administrator
  • [OK]
  • Type control appwiz.cpl + [Enter]
  • Search the program you want to delete, select it and click on [Uninstall]


20 March 2021

Backup and sync Google Drive

Using "Backup and sync Google Drive" on a computer with multiple users

  • Backup and sync Google Drive is a client program for Windows 10 that enables you to see your Google Drive in Windows Explorer.
  • I encountered a problem when I wanted to install this program when I was logged in as a second user on that PC: It did not work.
  • The solution was NOT to install backup and sync a second time, but to configure backup and sync as the second user
    • So to enable backup and sync logged in as the extra user:
      • Login as the extra user
      • Start "Backup and sync Google Drive"
      • Enter the credentials for Google Drive  for this extra user
      • Follow the instructions on screen
      • Be patient while the client downloads / uploads your files
    • In Windows Explorer you can see Google Drive in your Favorites

Link to download Backup and sync Google Drive on Windows 10:
Choose Individuals
Scroll down to "For Individuals" > Backup and Sync > Download




Lesson learned:

Only install  Backup and sync Google Drive once on a computer
but configure the program logged in as a second, third, fourth ... user on a Windows 10 PC

Remove system folders from external disk

Delete system folders on external disk using Windows 10

 Problem

  • I got a hard disk from a broken portable and wanted to use that disk as an external disk to put my backups on
  • Lot's of space was used by system folders on that disk e.g. Windows, Progam Files, Users ...
  • I wanted to free up space on that external disk, but it was not so easy to delete these system folders

Solution


To delete the system folders on the external disk, I used the following procedure:

  • Take ownership of these system folders

    • In Windows Explorer > Select the folder you want to delete on the external disk e.g. D:\Windows
    • Press Alt+Enter to view the Properties of the folder
    • [Security] > [Advanced]
    • Owner: specify the user with administrative permissions on your computer e.d. Administratror
      [x] Replace owner on sub containers and objects
      [OK]
      [OK]

  • Add the Administrator to the "Name of Groups of Users"
      • In Windows Explorer > Select the folder you want to delete on the external disk e.g. D:\Windows
      • Press Alt+Enter to view the Properties of the folder
      • [Security]
      • [Edit]
      • [Add] > Administrator
      • [x] Full Control
      • [OK[
      • [OK]

    • Inheritance -> Convert to explicit privileges

      • In Windows Explorer > Select the folder you want to delete on the external disk e.g. D:\Windows
      • Press Alt+Enter to view the Properties of the folder
      • [Security] > [Advanced]
      • [Change privileges]
      • [x] Replace privliges on sub objects ...
      • [Enable inheritance]
      • [Convert inhertited priviliges for this object into explicit privileges]
      • [OK]
      • Continue? [Yes]
      • [OK]
    Now you can delete the folder from the external disk

    24 January 2021

    Download all your photos from Google photos with a raspberry pi

    How to download all your photos from Google Photos on your raspberry pi using the command line

    • Export your photos via Google TakeOut
      • Surf to Google Takeout
      • Create an export (Seach for photos on this webpage and select only this row)
      • Export to tgz format size 50GB so you will have one large file with all your photos
      • It will take a while before Google sends you a mail with the download link
      • Start the download ..

    To use a raspberry pi to download the tgz file containing all your Google photos:

    • Get the download URL:
      • Start the download in a browser on a (windows) PC
      • Via right mouse click on the file being downloaded, you can copy the download URL
      • You can now cancel the download in the browser on your PC and
        launch the download on your raspberry pi using wget
    • Download the tgz file
      • On the raspberry pi, use wget to download the URL
        e.g.  
        nohup wget -b -o GoogleTakeout.log -O GoogleTakeout.tgz "https://00f74ba.....-apidata.googleusercontent.com/download/storage/v1/b/takeout-eu/o/.......XivE&isca=1"
      • Depending on how large the tgz file is, it can take a  long time to download ....
        The download speed is (at home with a 50Mbps download linkspeed) : around 3.3MB/s = 12GB/hour
      • Check if download is working:
        ls -l GoogleTakout.tgz
        la -lh GoogleTakeout.tgz
        tail -f GoogleTakeout.log
        jobs
        ps -ef|grep wget
    Tips (Copied from shell - Difference between nohup, disown and & - Unix & Linux Stack Exchange (thanks for the clear explication))

    • & puts the job in the background, that is, makes it block on attempting to read input, and makes the shell not wait for its completion.
    • disown removes the process from the shell's job control, but it still leaves it connected to the terminal. One of the results is that the shell won't send it a SIGHUP. Obviously, it can only be applied to background jobs, because you cannot enter it when a foreground job is running.
    • nohup disconnects the process from the terminal, redirects its output to nohup.out and shields it from SIGHUP. One of the effects (the naming one) is that the process won't receive any sent SIGHUP. It is completely independent from job control and could in principle be used also for foreground jobs (although that's not very useful).


    21 October 2020

    AWS Lightsail ssh web trouble - ubuntu

    After upgrading Ubuntu 18.04 LTS to 20.04 LTS ssh via web is broken.

    ssh via putty still worked.

    I have found the solution here:

    https://help.okta.com/en/prod/Content/Topics/Adv_Server_Access/docs/sftd-ubuntu.htm

    For servers running Ubuntu 20.04, you have to allow certificate authorities (CAs) to use the ssh-rsa algorithm to sign certificates. To do this, add the following line to your OpenSSH daemon file (which is either /etc/ssh/sshd_config or a drop-in file under /etc/ssh/sshd_config.d/)

    To fix it, add following 2 lines to /etc/ssh/sshd_config

    TrustedUserCAKeys /etc/ssh/xxxxxxx 
    CASignatureAlgorithms +ssh-rsa

    Replace xxxxxxx by the public key you can find in /etc/ssh

    The public key file is probably called lightsail_instance_ca.pub

    Restart sshd service after changing the sshd_config file:

    sudo service sshd stop
    sudo service sshd start

    OR

    sudo service sshd restart

    Tip: To find the non-comment lines in sshd_config:

    grep '^[[:blank:]]*[^[:blank:]#;]' /etc/ssh/sshd_config

    Include /etc/ssh/sshd_config.d/*.conf
    PasswordAuthentication no
    ChallengeResponseAuthentication no
    UsePAM yes
    X11Forwarding yes
    PrintMotd no
    TCPKeepAlive yes
    ClientAliveInterval 30
    AcceptEnv LANG LC_*
    Subsystemsftp/usr/lib/openssh/sftp-server
    TrustedUserCAKeys /etc/ssh/xxxxxxx
    CASignatureAlgorithms +ssh-rsa

    02 October 2020

    WSL Debian

     Install Windows subsystem linux on Windows 10


    step 1: 

      install Debian Linux subsystem:

        - PowerShell as administrator: "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux" | go to "turn windows future on or off"

        - Microsoft Store: install "Debian"


    step 2: 

      install mate tesktop on Debian:

        - open Debian

        - sudo apt-get update

        - sudo apt install task-mate-desktop


    OR

      install mate desktop on Ubuntu:

        - open ubuntu console

        - sudo apt install tasksel

        - sudo apt update

        - sudo tasksel install ubuntu-mate-desktop

        

    step 3: 

      install VcXsrv in windows 10:

        - download from: https://sourceforge.net/projects/vcxsrv/

          - about X server: https://en.wikipedia.org/wiki/X_Windo...

        - open XLauch

          - select: "One large window"

          - Display number: 0

          - next

          - Start no client

          - next 

          - finish


    step 4: 

      setup display: 

        - export DISPLAY=:0

        - export LIBGL_ALWAYS_INDIRECT=1


    step 5: 

      start Mate-desktop environment: 

        - mate-session