Monday, July 31, 2023

How to show verbose output when connect to GIT via SSH

 If we have issue when trying to ssh, we can use ssh -vvv to examine on which step ssh fail. For connection to GIT via SSH. We can do the same also with the following command

Friday, September 9, 2022

Error: Failed to download metadata for repo 'AppStream'

The error is due to CentOS is already EOL and you need to update your repo so it points to the archived repo. You can do this by using the following sed command.

Once done, you should be able to do your yum update or dnf update.

Tuesday, June 7, 2022

ldapsearch password file with no newline

ldapsearch allow you to specify password file with option -y. However, there is one condition for this password file is it cannot contain newline. To make sure you create a password file without newline, use echo -n where -n allow you to output without trailing newline. Example:

echo -n 'password' > .passFile


Friday, June 3, 2022

How to Print Affected Row(s) for job run using SQL Server Agent

 To do this, you need to do the following:

DECLARE @AffectedRows AS INT

UPDATE testdb set col1 = 1 where col2 = '2'

SET @AffectedRows = @@ROWCOUNT 

PRINT 'Row(s) affected ' + CAST(@AffectedRows AS VARCHAR)

Which will write the following in your defined log file when your SQL Server Agent job is running.

Job 'TestJob' : Step 1, 'Update Test' : Began Executing 2022-06-03 16:21:16


Row(s) affected 6 [SQLSTATE 01000]


Do note that you cannot just do PRINT @@ROWCOUNT as PRINT will reset @ROWCOUNT value to 0. Therefore you need to assign @@ROWCOUNT to a variable first before you PRINT.


Thursday, May 5, 2022

Excel Slow Performance - Calculating (8 Threads)

If you experience slowness while working on your Excel workbook and you can see the calculating message appear at the bottom right of your Excel workbook. It could be due to you are using formula such as COUNTIF and your argument is to scan all the rows (e.g. A:A).
If your data do not occupy all the rows, then make it more explicit so that it scan only rows with data. If doing this is troublesome, you can just scope it such as it is big enough (e.g.A1:A800) to cover your case. Once this is done, you should not experience slowness as the scanning can be done faster.

Friday, March 26, 2021

Using Exchangelib to test EWS + oAUth2

Exchangelib is a Pyhton library where you can develop Python script that need to interact with Exchange. One of the use case for me is to develop a test script to troubleshoot connection to Office 365 using EWS + oAuth2 

The script below will need the following information and you will also need to register your application with Microsoft Azure.

Tenant ID, Client ID, Client Secret:  After your app is registered successfully, these information can be obtained from Azure.

Primary SMTP Address: Your email address that use for this integration

Exchange Web Service URL: This guide help you to identify your URL

The script will have debug mode enabled so you can see all the information when the script is run. It will print out total item in your inbox and also send out a test email.

Thursday, March 25, 2021

Make Outlook the Default Mail App

To do this, you have to go to Settings -> Apps ->Default apps and for the email, select "Outlook".


Please note that this is required even if you set the following in Outlook app. 

Make Outlook the default program for Email, Contacts, and Calender