Undo a Single File in Git

I just had a need to undo (reset) a single file while I was working on multiple files. I was just testing stuff in different files and I wanted to undo the changes in a single file. Here is what you can do.

git checkout HEAD -- myfile

I think I did this before but I had forgotten it. I’m hoping to remember it by blogging it and help someone out there. 🙂

WordPress Site on ARM64 Linux

I struggled with provisioning MySQL 8 Docker container for ARM64 today. I just could not access MySQL instance from MyPHPAdmin. I eventually ended up with provisioning Maria DB for ARM64 and now I am able to access it from MyPHPAdmin.

I will spend my time later to migrate my WordPress to the new instance. I believe it will be snappier when it’s done.

New Stuff

I am using Visual Studio 2012 Preview 3.1 on Windows 11. I didn’t plan on it but I just installed them when I saw them available on my personal laptop. I wouldn’t do it to my work laptop but I don’t mind being bleeding edge on my personal machine.

I like new stuff. It’s been my nature for decades in my software engineer career. I believe it has been doing good to me. Being a software engineer, you always need to keep up with new technology. The technology I used to work with a decade or 2 ago is completely different from what I deal with today.

If you find it hard to do, software engineer might not be the career for you. If you find it fun to do, then you have a good chance to be a good software engineer.

I’m not saying new stuff is always better. I think balance is very important. Using everything new is not good and sticking with old way only is not good either. It’s a matter of balance.

This blog is a place where I explore new stuff and keep it so that I can come back to it if I forget and share it with the people all over the world.

WordPress Migration to OCI: Opening Ports

When you provision an instance (host) on OCI, a public IP address is assigned.

I have already covered how to open ports on OCI in my previous post.


Next time, I will cover how to install the necessary software on the newly provisioned instance.

SSH Public and Private Keys

As we use services like GitHub, GitLab, BitBucket, Azure DevOps and etc, we are required to use SSH public/private key for authentication. SSH public and private keys can easily be created using ssh-keygen tool on your computer. You may need to install Git (Git Bash) if you use Windows as your client machine.

So ssh-keygen lets you generate private/public key pair on your machine. Here is how it looks like.

[amaterasu48@hogesvr ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/amaterasu48/.ssh/id_rsa): 
Created directory '/home/amaterasu48/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/amaterasu48/.ssh/id_rsa.
Your public key has been saved in /home/amaterasu48/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:4Yuih+5+BowypaHOk/bp9mGXho24Kbyf/SaNZCF1upY amaterasu48@hogesvr
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|     . .         |
|    . o .        |
|. .. o . .       |
|.*  . + S        |
|* o .E+...       |
|=..+==+=.        |
| O.o@++o         |
|.=&%.o+.         |

When you execute ssh-keygen, it asks you to enter passphrase. You can enter it or choose not to enter it. It generates 2 files at ~/.ssh They are id_rsa.pub and id_rsa.

id_rsa.pub is the public key. The content of the file looks like the following.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsI1olqIE+PRQ0I5PhtyAHqWf0Z9ImXq3RbIclMi123um

You usually paste the string to services like GitHub for authentication.

id_rsa is the private key which you never want to expose to anyone at all. The public key that you uploaded to a service like GitHub is used to encrypt data on the other end and your private key is used to decrypt the data. The private key that was generated in this example looks like the following. Don’t worry, I’ve already got rid of the sample private key from a machine where I generated the sample keys.


Once you generated your private/public key pair, go to your icon –> Setting –> SSH and GPG Keys in GitHub to add the public key to it and then you will be able to do git clone and other operations against GitHub.

I wanted to cover this basic so that I can move on to Jenkins installation and configuration on Azure.

PowerShell Doesn’t Fail Jenkins Job

When dealing with automation on Windows platform, PowerShell comes in very handy and there is no doubt about it. Things can be automated quite easily with it.

However, you want the Jenkins job in which PowerShell is used to fail if your PowerShell script fails. I have had cases where I saw my script crapped out but the job itself succeeded.

To solve the problem, all you have to do is to add the following line at the beginning of the PowerShell script step.

$ErrorActionPreference = "Stop"

This will “successfully fail” your Jenkins job if your script throws any exception.

Free SSL

I tried to do a research on how to create your own Certificate Authority (CA) and issue SSL certificate for your own server, but I ended up with coming across this free service.


I successfully implemented SSL on my own instance of Jenkins on Azure. After generating the certificate along with private key, I uploaded the files to Azure and made my change in nginx configuration file. Remember that NGINX is playing a reverse proxy role.

server {
    listen 80;
    server_name yourstuff.whicheverregion.cloudapp.azure.com;
    return 301 https://yourstuff.whicheverregion.cloudapp.azure.com;
server {
    listen 443 ssl;
    server_name yourstuff.whicheverregion.cloudapp.azure.com;
    ssl_certificate /etc/nginx/ssl/certificate.crt;
    ssl_certificate_key /etc/nginx/ssl/private.key;
    location / {
        proxy_set_header        Host $host:$server_port;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_pass          http://localhost:8080;
        proxy_redirect      http://localhost:8080 http://yourstuff.whicheverregion.cloudapp.azure.com;
        proxy_read_timeout  90;

Nowadays, there is almost no website that doesn’t use SSL. I guess I should start to use SSL for Free to make this website more secure.