A Pixel 6 pro screen protector worth a review !

I used to think screen protectors were applied in three steps, peel, stick, peel the other side, Not this one though !

NOTE: As an Amazon Associate I earn from qualifying purchases.

This is one different screen protector that comes with it’s own UV lamp ! it is the MOWEI (evatmaster) ! but is it worth all the hassle ? (See it on Amazon)

The claim is that it is a 9/10 on the hardness scale (Mohs scale), which is obviously hard to believe ! actually, I am very darn sure it is not, that is literally 1 step below diamond, so we all know the claim is not true, but it probably is scratch proof to a good extent. (Some guy tested the hardness, turned out to start scratching at 6, and get heavily scratched at 7, which is not bad, but again, nowhere near 9, (example: sapphire, the material the iPhone glass is made of is only theoretically a 9, but the impurities put it at around 8)

Okay, So let me start with installing it ! it comes with 3 Videos on how to install, how to remove bubbles, and how to remove the protector.

Let me give you the lowdown first, Up to now the experience is perfect, no lift with any of the covers I have, fingerprint sensor works perfectly, and cameras are very clear, also before curing with the UV lamp, you can drive the bubbles out easily, spills from the glue are easy to remove by hand, and up to now, the phone cover does not cause any lift, but i cured it far longer than the 2 minutes in the instructions.

If the excess glue is not going into dangouris places (your USB port or speakers, cure first, and then the glue comes out easly)

redis for Laravel on Debian

If you are like me, running only your own projects on a server, you might want to skip authentication

the changes I generally make to the file /etc/redis/redis.conf are

1- At the very beginning, limit the RAM redis can use with the line

maxmemory 2gb

2- Change the supervisor to systemd by modifying the line

supervised no

to

supervised systemd

Now, to test the new config, from the command line, run the following commands

systemctl restart redis-server
redis-cli
ping
config get maxmemory
quit

You have just configured redis and tested your new settings.

Nested virtualization in KVM

The reason I am enabling this in my virtual machine is to develop with android studio under windows or Linux in a dedicated development machine (Let us call it an android development virtual machine), you will need to enable nested virtualization for the virtual android phone that comes with Android studio, there are many occasions where you need nested virtualization, so let us see what we need to do.

1- Check if our system allows nested virtualization with the following line

cat /sys/module/kvm_intel/parameters/nested 

If this returns a Y or a 1, then we are good to go to the next step, if not, then execute the following to enable the feature on the host system

echo 'options kvm_intel nested=1' >> /etc/modprobe.d/qemu-system-x86.conf 

Now, with that out of the way, we can move to the next step

2- Enable nested virtualization in the config of the virtual machine, either with virsh edit or edit the file manually and reload it, whatever you are used to doing should work

virsh edit androiddev

Now, specify either host-model OR host-passthrough, host model is more compatible when moving the virtual machine to a new CPU, while host-passthrough will deliver absolutly all CPU features to the guest os, but is very unfriendly to moving the machine to a different KVM host

<cpu mode='host-model'> 

miniDLNA on my WD mybook live NAS box

The original firmware based on debian did come with a DLNA server, in this post, I am only dealing with openWRT (You need to change the firmware due to a serious security issue on the NAS drive as shown here)

In openWRT, i recommend you install libffmpeg-full before miniDLNA, since miniDLNA will install libffmpeg-mini which will conflict

opkg update
opkg install libffmpeg-full
opkg install minidlna luci-app-minidlna

Once the above are done, you can setup your DLNA server from the web interface of openWRT

I would recommend that the database and log files be on the data partition to save space, something you can manually set from within the web interface

to rebuild that database (re-index the files), you will need to stop miniDLNA, run the update and then start the server again

service minidlna stop
minidlnad -R
service minidlna start

Blank page running PhpMyAdmin on nginx with PHP 8.1 pfm

After an apt-get upgrade, phpmyadmin stopped working, I would see a blank page that sets a session cookie but does not show a login screen , just a blank page and the source of the page is also blank

So, i added the following line to my config.inc.php

$cfg['environment'] = 'development';

An right after, the following appeared

Array ( [type] => 1 [message] => Uncaught TypeError: PhpMyAdmin\ConfigStorage\Relation::__construct(): Argument #1 ($dbi) must be of type PhpMyAdmin\DatabaseInterface, null given, called in /var/www/html/pma2/libraries/classes/Twig/RelationExtension.php on line 22 and defined in /var/www/html/pma2/libraries/classes/ConfigStorage/Relation.php:62 Stack trace: #0 /var/www/html/pma2/libraries/classes/Twig/RelationExtension.php(22): PhpMyAdmin\ConfigStorage\Relation->__construct() #1 /var/www/html/pma2/vendor/twig/twig/src/ExtensionSet.php(426): PhpMyAdmin\Twig\RelationExtension->getFunctions() #2 /var/www/html/pma2/vendor/twig/twig/src/ExtensionSet.php(411): Twig\ExtensionSet->initExtension() #3 /var/www/html/pma2/vendor/twig/twig/src/ExtensionSet.php(385): Twig\ExtensionSet->initExtensions() #4 /var/www/html/pma2/vendor/twig/twig/src/Environment.php(810): Twig\ExtensionSet->getUnaryOperators() #5 /var/www/html/pma2/vendor/twig/twig/src/Lexer.php(457): Twig\Environment->getUnaryOperators() #6 /var/www/html/pma2/vendor/twig/twig/src/Lexer.php(108): Twig\Lexer->getOperatorRegex() #7 /var/www/html/pma2/vendor/twig/twig/src/Environment.php(466): Twig\Lexer->__construct() #8 /var/www/html/pma2/vendor/twig/twig/src/Environment.php(516): Twig\Environment->tokenize() #9 /var/www/html/pma2/vendor/twig/twig/src/Environment.php(348): Twig\Environment->compileSource() #10 /var/www/html/pma2/vendor/twig/twig/src/Environment.php(309): Twig\Environment->loadTemplate() #11 /var/www/html/pma2/libraries/classes/Template.php(123): Twig\Environment->load() #12 /var/www/html/pma2/libraries/classes/Template.php(156): PhpMyAdmin\Template->load() #13 /var/www/html/pma2/libraries/classes/Core.php(145): PhpMyAdmin\Template->render() #14 /var/www/html/pma2/libraries/classes/Config.php(684): PhpMyAdmin\Core::fatalError() #15 /var/www/html/pma2/libraries/classes/Common.php(169): PhpMyAdmin\Config->checkPermissions() #16 /var/www/html/pma2/index.php(48): PhpMyAdmin\Common::run() #17 {main} thrown [file] => /var/www/html/pma2/libraries/classes/ConfigStorage/Relation.php [line] => 62 ) 

Turns out, this is an incompatibility (related to session storage) that has only been fixed in the 5.2 snapshot, download that version of phpmyadmin and everything should be fine

Microsoft VS code plugins for the Laravel Developer

The following is a list of plugins I have installed to help with Laravel Development, I will add to them as I go, I will also remove the ones i don’t think were worth it from the list as well

PluginWhat forHow to usePublisher
PrettierVery popular plugin to format your code so that it looks tidyDo take a look at the plugin’s config to tweak it to your likingPrettier
PHP IntelliSenseAdvanced Autocomplete and Refactoring support for PHPFelix Becker
PHP IntelephenseCooler than PHP IntelliSenseBen Mewburn
Laravel Extra IntellisenseSelf explanatory name !
PHP Namespace ResolverImport and expand PHP namespacesMehedi Hassan
laravel-bladeLaravel blade syntax highlightingChristian Howe
Laravel SnippetsWinnie Lin
Laravel Blade SnippetsLaravel blade snippets and syntax highlight supportWinnie Lin
Laravel goto viewQuick jump to view !codingyu
Better AlignAlign code without selecting them firstwwm
Laravel Blade WrapperSpeed up wrapping code with Blade directivesCTRL + SHIFT + TlHunte
Laravel-goto-componentsTakes you to Blade components <x-… with a clickCTRL + CLICKnaoray
DotENVSyntax highlighting for .env files !mikestead
Tailwind CSS IntellisenseIf you use Tailwind (A css library), this plugin will do all the tailwind magickTailwind Labs

Fixing my android SD card (exFat) on linux

This is probably very easy to use on windows, but i could not find a windows machine,

A quick solution that was not very clear at first was as follows, before you do this, make sure you have unmounted the SD card !

apt-get install exfat-utils

And then run the command

sudo exfatfsck /dev/mmcblk0p1

Got a few of the following error, and answered yes to all

ERROR: unknown entry type 0xc1.
Fix (Y/N)? y

And that was that

Varnish would not listen on port 80 on debian 11 and 12 (Bookworm)

So, before we start, I assume you have already installed Varnish the casual way, and that you have made sure you do not have something else occupying port 80, if nginx for example is listening on port 80, try this post to switch it to a different port (Changing the default port 80 on nginx), if it is a different app, just follow that app’s instructions to change it’s port before asking varnish to listen on it.

To check that port 80 is not occupied and free to use, try the following command

netstat -anpe | grep "80" | grep "LISTEN"

If for example you want to know what ports nginx is listening to, try one of the following commands

netstat -tlpn| grep nginx
or
ss -tlpn| grep nginx

Within the results, check if any are using port 80, mind you, a service using port 8083 for example will show up, you need to see if anything is using port 80 , Now, install varnish with the following command.

apt-get install varnish

As you may have noticed, and probably the reason why you are here, varnish will not work !

this is somewhat of an old problem, since Debian moved to systemD back with the Debian 8 release (Jessie), instead of editing the file in /etc/default/varnish, you will need to create a file in /etc/systemd/system/ and name it varnish.service, the contents of such a file should look like the following, note that xxx.xxx.xxx.xxx is the IP varnish should be listening on, one of the IPs assigned to the machine running varnish.

So to run the following command

systemctl edit varnish.service
[Unit]
Description=Varnish HTTP accelerator
Documentation=https://www.varnish-cache.org/docs/6.1/ man:varnishd

[Service]
Type=simple
LimitNOFILE=131072
LimitMEMLOCK=82000
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a xxx.xxx.xxx.xxx:80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
ExecReload=/usr/share/varnish/varnishreload
ProtectSystem=full
ProtectHome=true
PrivateTmp=true
PrivateDevices=true

[Install]
WantedBy=multi-user.target

Once you have added the file execute the following

systemctl daemon-reload
systemctl restart varnish

Should i let varnish cache in RAM or switch to disk ?

Note that the configuration file above uses RAM to cache the content, My recommendation is to use DISK (Disk is cached in ram in a more dynamic and more useful way utilizing all the ram you are not using, while keeping it available to any app that needs it), but that is just me…

To switch from RAM to File system, replace the following in the above as follows

"-s malloc,512m" becomes "-s file,/path/to/cahce/file.bin,100G"

Now, if you want to flush the varnish cache, you don’t have to remove everything ! you can use the varnishadm command to control the cache

Don’t let the keyword “Ban” fool you, it bans the existing copy of the cache, but does not prevent it from getting re-cached



- A domain's cache: varnishadm "ban req.http.host ~ www.example.com"

- File type: varnishadm "ban req.url ~ .css"

- Both the above: varnishadm "ban req.http.host ~ www.example.com" && req.url ~ .css"

- a URL varnishadm "ban req.url ~ /directory/andmaybefile"

- whole cache: varnishadm "ban req.url ~ ."

- Every png on domain: varnishadm ban req.http.host == example.com '&&' req.url '~' '\\.png$'

ffmpeg cheat sheet

Combine video and audio (yt-dlp)

First of all, after using yt-dlp to download 2 webm files for a video, you can combine them without reencoding using the following command (See here), Just make sure both files are VP8 or VP9

ffmpeg -i ao.webm -i vo.webm -c:v copy -c:a copy output.webm

Extract segment from video

To extract the section from the file resulting from the first command above

1- From second x, and duration in seconds

ffmpeg -ss 285 -i g_in.mkv -t 5475 -map 0 -c copy g_out.mkv

2- From second x to second y

ffmpeg -copyts -ss 4633 -i g_in.mkv -to 5470 -map 0 -c copy g_p2.mkv

Convert file

Converting a file you have downloaded using 1 or any other file into MP4 (H264), since some windows computers will not play a webm file !

ffmpeg -i source264.mp4 -c:v libx265 -crf 28 -preset fast -c:a aac -b:a 128k  -filter:v fps=25 out265.mp4

If you want to cut a part of the video, without re-encoding it

ffmpeg -i input.mp4 -vcodec copy -acodec copy -ss 00:01:00.000 -t 00:00:02.000 output.mp4

nVidia (GPU) : Convert H264/H265

Nvidia graphics card to convert H265 (MKV) to H264 MP4, Using nvidia hardware encoder to encode video into H264 or H265 !

To checks whether hardware encoders are available or not, run the command

ffmpeg -encoders | findstr /ic:"NVIDIA"

If the following two lines are in the command, you can use the nVidia encoder, the first codec is H264, and the second is for H265 (HEVC)

V....D h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
V....D hevc_nvenc           NVIDIA NVENC hevc encoder (codec hevc)

ffmpeg.exe -vsync 0 -hwaccel cuda -i <input_file> -map 0  -c:a copy -c:v h264_nvenc -pix_fmt yuv420p -preset hq <output_file>

-vsync : Synchronize video audio and metadata using the video timestamp
-hwaccel cuda : Use nVidia’s cuda for hardware accelleration

Example, Convert mkv to mp4 (Tested OK)

Now, with the above out of the way, the following command should encode your 1080P mkv H265 video to H264 ! all within GPU, so this re-encodes an nVidia compatible format to another nVidia compatible format, on my 1650 card, it was encoding at 12x. this provides better compatibility, if smaller file size and quality are what you seek, then you should do it the other way around

ffmpeg -i "1080p.mkv" -c:v h264_nvenc -pix_fmt yuv420p -minrate 500k -maxrate 1000k -c:a mp3 -b:a 128k "1080p.mp4"

The other way around

ffmpeg -i "1080p.mp4" -c:v hevc_nvenc -pix_fmt yuv420p -minrate 200k -maxrate 1000k -c:a aac -b:a 128k "1080p.mkv"

NOTE: The above does everything within the GPU, if for example you wanted the decoding on CPU, that will make things much slower because the decoded video (Huge) will still need to be copied to the GPU,

nVidia : DVD to H265

Encoding H265 with my entry level GPU (1650) is around five to fifteen times faster than with CPU (6 core, 12 thread i7-4930K), CPU was running at around 50% load through the encoding

Now one very common task people want to execute is converting their old, bulky DVD collection to H265 (Or H264 if they value compatibility over size and clarity), DVD files are usually on a DVD in the Video_TS folder, and the AudioTS folder, So this will create a few cases

Case 1: Audio_ts folder is empty, Video TS folder has files that you know the order they should be displayed in, the objective is to put them all in one video file (Assuming MKV but the container is your choice), in this case, I usually start by converting all the videos to H265, then combine them, here, most of my videos are interlaced (that will be dealt with with yadif), and sometimes, they are files of different resolutions, so I will unify their size

ffmpeg -i "v1.VOB" -c:v hevc_nvenc -c:a aac -b:a 256k -vf yadif,scale=1920:1080 -x265-params "crf=22:min-keyint=25:keyint=50" -preset slow "d1.mkv"

Now, create a list of the files

(for %i in (*.mkv) do @echo file '%i') > mylist.txt

And concatenate the videos

ffmpeg -f concat -i mylist.txt -c copy output.mkv
Now, to batch process a folder on the command line... in this example i am lowering the resolution of files to FHD from 4K
for /f "tokens=1 delims=." %a in ('dir /B *.mp4') do ffmpeg -i "%a.mp4" "%a.1080.mp4"

And here is one meant to extract the audio from all the MP4 files

Windows

for /f "tokens=1 delims=." %a in ('dir /B *.mp4') do ffmpeg -i "%a.mp4" -vn -acodec copy "%a.aac"

Linux

for i in *.mp4; do ffmpeg -i "$i" -vn -acodec copy "${i%.*}.aac"; done

Split audio file

ffmpeg -i 2024-07-27_20_38_2.m4a -f segment -segment_time 1740 output_%03d.m4a

Converting MKV to MP4

Here is a case where my MKV file contains the audio in AAC, and the video in H264, As you slide the slider in VLC media player, it tells you what the section is about, i should be able to copy the streams exactly as they are, but I was concerned that the “Slider Hints” would disappear, hence I split it into audio and video without re-encoding, checked that the hints are still there in the video, then combined them into an MP4, also without encoding, the reason I wanted the container to be MP4 is that sometimes I access my network files in a browser, and browsers seem more comfortable playing MP4 files than MKV

* ffmpeg -i My_Dinner_With_Andre_1981.mkv -vn -acodec copy ao.aac
* ffmpeg -i My_Dinner_With_Andre_1981.mkv -an -c:v copy vo.mp4
* ffmpeg -i ao.aac -i vo.mp4 -c:v copy -c:a copy My_Dinner_With_Andre_1981.mp4