nocin.eu

Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[WordPress] SyntaxHighlighter Ampersand character

Recently I noticed that the character & is displayed in the SyntaxHighlighter like this: &amp

To fix this, simply add this snippet of the user kaggdesign to /var/www/html/wp-content/plugins/syntaxhighlighter/syntaxhighlighter.php

/**
 * Filter to fix issue with & in SyntaxHighlighter Evolved plugin.
 *
 * @param string $code Code to format.
 * @param array $atts Attributes.
 * @param string $tag Tag.
 *
 * @return string
 */
function kagg_syntaxhighlighter_precode( $code, $atts, $tag ) {
	if ( 'code' === $tag ) {
		$code = wp_specialchars_decode( $code );
	}
	return $code;
}
add_filter( 'syntaxhighlighter_precode', 'kagg_syntaxhighlighter_precode', 10, 3 );

This can be done directly from the webinterface. Just go to Plugins -> Plugin Editor -> select the Plugin SyntaxHighlighter Evolved -> add the snippet to the end

[Proxmox] Scrub cronjob

Default scrub cronjob when installing Proxmox on ZFS:

nocin@pve:~$ cat /etc/cron.d/zfsutils-linux 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Scrub the second Sunday of every month.
24 0 8-14 * * root [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/scrub ] && /usr/lib/zfs-linux/scrub

[Hardware] A guide to monitor response times

Find the article here: A guide to monitor response times

“Response time” is basically the amount of time it takes for a pixel to change (“transition”) from one color to another, typically measured in milliseconds (ms). This is different from framerate or refresh rate of a monitor, typically measured in hertz (hz).

Here are some common refresh rates and their corresponding windows:

  • 60 hz = 1/60 = 16.67 ms
  • 75 hz = 13.33 ms
  • 100 hz = 10.00 ms
  • 120 hz = 8.33 ms
  • 144 hz = 6.94 ms
  • 240 hz = 4.167 ms

Any response time you see on a monitor box will most likely be “G2G” or gray to gray. Unsurprisingly, response times change depending on the color that is currently displayed and the color you wish to transition to.

To fully understand what a monitor is capable of, you have to consider both speed (response times) and accuracy (overshoot).

In theory, a 1 ms monitor with no accuracy issues would provide a very clean image. At 144hz, it would be displaying a frame every 6.94 ms. This means it would be transitioning for 1 ms, and providing a static image for the remaining 5.94 ms.

[ZFS] Destroy snapshots

Snapshots in ZFS aren’t cumulative. They just include the difference between the filesystem at the time you took the snapshot and now.
Meaning if you have snapshots A, B and C, deleting A doesn’t impact the status of the remaining B and C. This is a common point of confusion when coming from other systems where you might have to consolidate snapshots to get to a consistent state.

This means, you can delete snapshots out of the middle of a list and not screw up snapshots before or after the one you deleted. So if you have:

pool/dataset@snap1 
pool/dataset@snap2 
pool/dataset@snap3 
pool/dataset@snap4 
pool/dataset@snap5

You can safely sudo zfs destroy pool/dataset@snap3 and 1, 2, 4, and 5 will all be perfectly fine afterwards.

You can estimate the amount of space reclaimed by deleting multiple snapshots by doing a dry run (-n) on zfs destroy like this:

sudo zfs destroy -nv pool/dataset@snap4%snap8
would destroy pool/dataset@snap4
would destroy pool/dataset@snap5
would destroy pool/dataset@snap6
would destroy pool/dataset@snap7
would destroy pool/dataset@snap8
would reclaim 25.2G

List your snapshots (for a specific dataset simply use grep):

sudo zfs list -rt snapshot | grep pool/dataset

If you need to free some space, you can sort zfs snapshots by size:

zfs list -o name,used -s used -t snap

IPad verloren… in Karton


Folgende Mail erreichte mich nach meinem letzten Online Einkauf von B-Ware 😀

Sehr geehrter Herr xxx,

wir nehmen Bezug auf Ihre Bestellung der folgenden Artikel: xxxxxx

Es erreichte uns nun die Mitteilung, dass der Vorbesitzer versehentlich bei der Rücksendung des Widerrufs das IPad eines anderen Shops in der Verpackung eingelegt hatte.
Da wir noch keine Rückmeldung diesbezüglich erhalten haben, möchten wir dies hiermit melden.
Es handelt sich um den Artikel  “XXXXX”.

Wir bitten um kurze Rückmeldung zwecks Retoure.

Mit freundlichen Grüßen


Leider hatte ich kein IPad in meinem Karton. 🙁

[Software] Using pdfunite to merge PDF documents

First install pdfunite:

sudo apt update 
sudo apt install poppler-utils

Syntax:

pdfunite source1.pdf source2.pdf merged_output.pdf

If a pdf file is located in a different folder, you have to add the path like this: $home/Downloads/source1.pdf
If you want to merge all pdf’s of the current folder you cant type:

pdfunite *.pdf merged_output.pdf

An alternative with GUI is PDF Arranger.

[Nextcloud] Run OnlyOffice Document Server in Docker

If you don’t already have it, you first have to install Docker. Then just get the docker-compose.yml for OnlyOffice

wget https://raw.githubusercontent.com/ONLYOFFICE/Docker-DocumentServer/master/docker-compose.yml

and activate the JSON Web Token validation.

nano docker-compose.yml
      - JWT_ENABLED=true
      - JWT_SECRET=your_secret
      - JWT_HEADER=Authorization

Now just run the container.

sudo docker-compose up -d

To use OnlyOffice with Nextcloud, your container needs to reachable via https, so you need to add a subdomain and SSL Certificate in your Nginx reverse proxy. Then just go to your Nextcloud installation and install the OnlyOffice Addon. There just enter the new domain to your OnlyOffice Docker Container and the JSON Web Token. Office files should now be editable in OnlyOffice.

[ABAP] Select-Option for ALV Layout

Create a ALV Layout Variant
Select-Option for Layout Variant on Selectionscreen
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03.
PARAMETERS: p_vari TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK b3.

INITIALIZATION.

  "Load default layout
  DATA: ls_layout TYPE salv_s_layout_info,
        ls_key    TYPE salv_s_layout_key.

  ls_key-report = sy-repid.

  ls_layout = cl_salv_layout_service=>get_default_layout( s_key    = ls_key
                                                          restrict = '1' ).
  p_vari = ls_layout-layout.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

  "Value Help
  DATA: ls_layout TYPE salv_s_layout_info,
        ls_key    TYPE salv_s_layout_key.

  ls_key-report = sy-repid.

  ls_layout = cl_salv_layout_service=>f4_layouts( s_key    = ls_key
                                                  restrict = '1' ).
  p_vari = ls_layout-layout.