Posts

The right way to use rsync

 rsync -avW -LK --progress ./from /to   this is even better: rsync -avhPW -LK --ignore-existing --size-only /source/ /media/dest/    

Enable snap mysql-workbench to have access to the network

 sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service

Making sure my linux system does not wake up on suspend

Had this annoying problem in my linux Xubuntu 20.04 when putting on suspend the system then starts even though I put it in suspend and sleep. Using acpitool to turn off wake-up from unnecessary devices. But the problem the change is not permanent and does not survive a restart. So I used cron @reboot to make sure it is always off: @reboot acpitool -W 3 && acpitool -W 9 && acpitool -W 10 && acpitool -W 17 && acpitool -W 63 && acpitool -W 64 && acpitool -W 66 && acpitool -W 68 && acpitool -W 74    

Scanning Local Network for Devices

 nmap -sT 192.168.1.1/24    

MySQL Test Timezone Script

 CREATE TABLE tzt( id MEDIUMINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, ts TIMESTAMP NOT NULL, dt DATETIME NOT NULL ); SELECT @@global.time_zone, @@session.time_zone; SET GLOBAL time_zone = 'Asia/Jerusalem'; SET SESSION time_zone = 'Asia/Jerusalem'; INSERT INTO tzt SET ts='2021-08-22 13:30:00', dt='2021-08-22 13:30:00'; SELECT * FROM tzt\G SET GLOBAL time_zone = 'America/Sao_Paulo'; SET SESSION time_zone = 'America/Sao_Paulo'; SELECT * FROM tzt\G

Connecting to mysql with TLS 1.2 SSL encrypted connection

In order to be able to connect to MySQL remote server using encrypted connection overt TLS1.2 you will need a .pem certificate of CA.  You can obtain the certificate here: https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem (DigiCertGlobalRootCA.crt.pem) Read more here: https://docs.microsoft.com/en-us/azure/mysql/flexible-server/how-to-connect-tls-ssl Here is a PHP sample for connection with SSL to MySQL encrypted connection on TLS1.2: self::$mysqli = mysqli_init(); //self::$mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); self::$mysqli->ssl_set(NULL, NULL, "DigiCertGlobalRootCA.crt.pem", NULL, NULL); self::$mysqli->real_connect(host', 'username', 'password', 'database'); // , 3306, MYSQLI_CLIENT_SSL); //self::$mysqli = new mysqli('hots', 'username', 'password', 'database');    self::$mysqli->set_charset('utf8'); return self::$mysqli; Here is the full certificate for M...

Some pitfalls for using PWA and ServiceWorkers I hoped I knew before

Some pitfalls for using PWA and ServiceWorker I hoped I knew before - So I am writing them here so maybe others will get to rid them before or I can find them again when I'll need them again. This is not a tutorial for PWA, ServiceWorker. Those are just a few points that I encountered while developing a PWA ( Progressive Web App ) and ServiceWorker using Vanilla JavaScript and caching mechanism for Offline usage. There are plenty of good PWA ServiceWorker Caching tutorial on the internet. Full Vanilla JavaScript code is attached all the way at the bottom Double caches: First, the cache made by the cache mechanism which you as a coder decide what will be saved in this cache using the cache.addAll() command. And the second cache is the one the browser automatically caches for example images and javascripts code or others. Hence might be that when you work offline the browser will return cached images which you did not stated that should be cached only because the browser cac...