Compare Numbers and Integers in Bash

Here is an example bash script to compare numbers: #!/bin/bash   a=123456 b=123456   if [ "$a" -eq "$b" ]; then echo "Numbers are equal"; fi#!/bin/bash a=123456 b=123456 if [ "$a" -eq "$b" ]; then echo "Numbers are equal"; fi Here are all comparison operators: -eq # equal -ne # not equal -lt # less […]

How to Allow USB Encryption with Bitlocker

If you get a Bitlocker group policy conflict when trying to protect a USB removable media with Bitlocker, then you may need to enable a specific option in Group Policy Editor. You need to enable “Allow Bitlocker without a compatible TPM” option:

Download Old Sent Emails on POP Account with Thunderbird

POP mail accounts can only access and download inbox messages. However you can use a smart workaround to download also old sent messages, in short what you can do is create a new IMAP mail account, download the sent emails there, then select all sent emails, copy them to the POP mail account’s sent folder, […]

Problems with /etc/cron.d/certbot on Debian

If you are using certbot (Let’s Encrypt) with Nginx on Debian Buster you may have encountered problems in auto-renewal of your certificates. This may be because the /etc/cron.d/certbot didn’t actually execute, ore information can be read here: https://community.letsencrypt.org/t/cerbot-cron-job/23895/5 It looks like that if the directory /run/systemd/system/ exists it won’t execute the renew command, because you […]

Get Number of CPU Threads on Linux Debian

You can get the number of CPU threads with this command: nproc –allnproc –all Here is an example output on an AMD Ryzen 5 3600 Hexa-Core: 1212 That is correct, the AMD Ryzen 5 3600 has 12 threads. The command supports also multi-sockets servers. Get number of CPU cores

Get Number of CPU Cores on Linux Debian

Get the correct number of CPU cores on a Linux Debian server: grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2 | awk ‘{s+=$1} END {print s}’grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2 | awk ‘{s+=$1} END {print s}’ Here is an example output on an AMD Ryzen 5 3600 Hexa-Core: 66 That […]

NodeJS ETIMEDOUT, ESOCKETTIMEDOUT, ENOTFOUND

While using request package with a NodeJS script I noticed it was causing a lot of errors like ETIMEDOUT, ESOCKETTIMEDOUT and also getaddrinfo ENOTFOUND after some HTTP requests on the same URL. That was very strange because the remote URL was working correctly… So I started to analyze a few things and I noticed that […]

jQuery Trigger Form Submit with Parameters

You can submit a form using jQuery .trigger() function: $(‘#myForm’).submit(function (e, pass_through) { if(typeof bypass_checks == ‘undefined’ || bypass_checks == false) { e.preventDefault(e);   // Do some Ajax checks here   $(‘#myForm’).trigger("submit", [true]); } });$(‘#myForm’).submit(function (e, pass_through) { if(typeof bypass_checks == ‘undefined’ || bypass_checks == false) { e.preventDefault(e); // Do some Ajax checks here $(‘#myForm’).trigger("submit", […]

NodeJS Disable SSL Verification on Request

You can set strictSSL to false on NodeJs request: var options = { url: ‘http://url’, strictSSL: false }   request(options, function(err, resp, body) {});var options = { url: ‘http://url’, strictSSL: false } request(options, function(err, resp, body) {}); More information can be found here: https://github.com/request/request#user-content-requestoptions-callback strictSSL – if true, requires SSL certificates be valid. Note: to […]

Modify NodeJS Request Default Timeout

You can modify the default request timeout like this: var options = { url: ‘https://www.google.com/’, timeout: 120000 }   request(options, function(err, resp, body) {});var options = { url: ‘https://www.google.com/’, timeout: 120000 } request(options, function(err, resp, body) {}); Details of the param timeout can be found here: https://github.com/request/request#user-content-requestoptions-callback timeout – integer containing number of milliseconds, controls […]