Skip to main content

Posts

Showing posts from 2022

Script for creating html bookmarks file for Chrome to import

#!/bin/bash # # Run this script on a file named urls.txt with all your URLs and pipe the output to an HTML file. # Example: ./convert_url_file.sh > bookmarks.html echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>" echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' echo '<TITLE>Bookmarks</TITLE>' echo '<H1>Bookmarks</H1>' echo '<DL><p>'   cat urls.txt |   while read L; do     echo -n '    <DT><A HREF="';         echo ''"$L"'">'"$L"'</A>';   done echo "</DL><p>"    

Simple Using SQUID proxy server for Ubuntu 20.04

sudo apt install squid sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.original sudo chmod a-w /etc/squid/squid.conf.original sudo nano /etc/squid/squid.conf   inside squid.conf http_port XXXXX http_access allow all sudo update-rc.d squid disable sudo systemctl restart squid.service sudo systemctl status squid sudo systemctl disable squid sudo systemctl stop squid  

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    

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