Friday, July 14, 2023

GPG PGP encryptions

Download  GPG:

brew install gpg2
sudo yum install gnupg
sudo apt install gnupg
Verify Installation:

gpg --version

Generate KeyPair:

gpg --gen-key

You will be asked for your key details. Fill them out. You can leave the comment field empty. After that, you will be asked for a passphrase, and then you'll be given a prompt to type it. You can leave it empty if you want. But you need to remember what you type in if you put something (required for decryption later.)

List all GPG  key pairs

gpg --list-secret-keys

Export your Public Key:

Once you've generated your keys, export your public key with the following command

gpg -export --armor

Import others Public Key:

Once you've generated your keys, export your public key with the following command

gpg --import abc_public.key

And you can check the list of keys by gpg --list-public-keys


Friday, May 5, 2023

ChatGPT, Benefits and Drawback !

About ChatGPT

ChatGPT is an advanced language model developed by OpenAI that is capable of generating human-like responses to various inputs. It is based on the GPT-3.5 architecture and is currently one of the most advanced AI models available. The model has been trained on a massive corpus of text data, allowing it to generate coherent and meaningful responses to various queries.


One of the primary benefits of ChatGPT is its ability to learn from vast amounts of data and use that knowledge to generate responses to various queries. This makes it a powerful tool for tasks such as language translation, content generation, and customer service. ChatGPT's ability to generate human-like responses also makes it an ideal tool for improving chatbot and virtual assistant technology.

Another benefit of ChatGPT is that it can help businesses automate their customer service processes. Chatbots that use ChatGPT can handle large volumes of customer queries without requiring human intervention. This can help businesses save time and money while improving customer satisfaction.

Drawback of ChatGPT

However, there are also some drawbacks to ChatGPT. One of the main concerns is that the model may be prone to bias. The data used to train the model may be biased in various ways, which could lead to biased responses. Another concern is that ChatGPT may not always provide accurate responses. The model may generate responses that are not factually correct or that could be misleading.


Despite these concerns, it is important to note that ChatGPT is not something that humans should be scared of. The model is a tool that can be used to augment human intelligence, not replace it. Humans still have a critical role to play in ensuring that the responses generated by ChatGPT are accurate and unbiased.

In conclusion, ChatGPT is a powerful tool that has the potential to revolutionize many industries. Its ability to generate human-like responses to various queries makes it an ideal tool for language translation, content generation, and customer service. However, it is essential to be aware of the potential drawbacks and biases that may be present in the model. As long as humans remain vigilant and use ChatGPT responsibly, it can be a valuable asset that enhances our capabilities rather than a threat that replaces us.

Tips using ChatGPT

Here are some tips for using ChatGPT effectively:

  • Provide clear and specific prompts: ChatGPT works best when it has a clear idea of what you're asking it. Make sure your prompts are specific and clearly worded. Avoid using ambiguous or open-ended questions.
  • Use high-quality data: ChatGPT is only as good as the data it's trained on. If you're training your own version of ChatGPT, make sure you're using high-quality data that is relevant to your use case.
  • Fine-tune the model: Fine-tuning the model to your specific use case can improve its accuracy and relevance. This involves training the model on a smaller dataset that is specific to your domain.
  • Monitor responses for accuracy and bias: As with any AI tool, it's important to monitor ChatGPT's responses for accuracy and bias. Make sure you're reviewing its responses regularly and correcting any errors or biases that you identify.
  • Use in combination with human intervention: While ChatGPT can handle many tasks on its own, it's important to use it in combination with human intervention. Human oversight can help ensure that ChatGPT's responses are accurate and appropriate.
  • Experiment with different inputs and prompts: ChatGPT can be used for a wide variety of tasks, so don't be afraid to experiment with different inputs and prompts. This can help you identify new use cases and improve your overall results.
  • Be aware of ethical considerations: As with any AI tool, there are ethical considerations to be aware of when using ChatGPT. Make sure you're using it in a responsible and ethical manner, and that you're not contributing to bias or harm in any way.
Note: This article was written by chatGPT


Wednesday, December 29, 2021

Find and copy File recursively on MAC terminal

The following command find allt he files with *jpeg extension with in the current folder/children folders recursicely and copy all the files to the ~/mac-photos folder
$ find . -name "*.jpeg" -type f -exec cp {} ~/mac-photos \;


Monday, November 8, 2021

Code to Split large file and keep the header row on each file

You can pass a single argument as the file name(Exclude the extension...) or you can modify the file to take extension as the arguments.
header=$(head -1 ${fileName}.dat)
split -l 40000 ${fileName}.dat splitFileNamePrefix
for f in splitFileNamePrefix*
    if [[ ${n} -gt 9 ]]; then
    echo ${outputFileName}
    if [[ ${n} -ne 1 ]]; then
        echo ${header} > ${outputFileName}
    cat ${f} >> ${outputFileName}
    rm ${f}


Saturday, September 12, 2020

Running a command as a service in Window!

To create service:
Example:  sc.exe create dockerDService binPath= "C:\Program Files\Docker\Docker\resources\dockerd.exe" start= auto

To delete service:
  sc.exe delete SERVICE_NAME 
 Example : sc.exe delete dockerDService 

Note: Use PowerShell or the command Terminal with Administrator mode


Sunday, July 26, 2020

Backup(Transferring and Synchronizing files) using python multiprocessing and rsync !

rsync(remote sync) is a utility for efficiently transferring and synchronizing files between a computer and an external storage

  1. Copy or sync files locally:

  2. rsync -zvh [Source-Files-Dir] [Destination]

  3. Copy or sync directory locally:

  4. rsync -zavh [Source-Files-Dir] [Destination]

  5. Copy files and directories recursively locally:

  6. rsync -zrvh [Source-Files-Dir] [Destination]  

  7. Sample  python code  script to do a backup using python...

  8. #!/usr/bin/env python

    import subprocess

    from multiprocessing import Pool

    from os import walk 

    src= "/home/user/data/"


    def backupData(dir):

        print("dir = "+ src+dir +" dest = " + dest+dir)["rsync", "-arq", src+dir, dest+dir]) 

    dirList = []

    for (root, dirs, files) in walk(src):



    print (dirList)

    p= Pool(len(dirList)), dirList)


Saturday, June 6, 2020

Cucumber/Gherkins with Java(kotlin) !

Cucumber is an opensource, Behavior-Driven Development (BDD) framework, where you execute your automated tests. You can pick up a regression suites for your automation test. We will mostly discuss about the the automation test written in Java/Kotlin in this tutorials.
Cucumber reads executable specifications written in plain text and validates that the software does what those specifications say.

What is Gherkins:
Gherkins is a business readable domain specific language. It is a set of grammar rules that makes plain text structured enough for Cucumber to understand.
Example :  Users are presented with Invalid Username/Password method when authentication fails
Cucumber uses Scenarios to defines the steps . You describe the Scenarios using Given, When, And and Then, But 
Scenario: Users are presented with Invalid Username/Password method when authentication fails
Given User is in the login page
when User fills the invalid username or password
And User hit the submit button
Then User see the pop up screen saying Invalid Username/Password
When we define the  Scenario, we  can define multiple pre condition and multiple action and multiple expected outcomes.

We can collapse these two or more similar scenarios into a Scenario Outline as following
Scenario Outline: eating
  Given there are <start> cucumbers
  When I eat <eat> cucumbers
  Then I should have <left> cucumbers

    | start | eat | left |
    |    12 |   5 |    7 |
    |    20 |   5 |   15 |
What is Feature and Feature File:
Feature can be defined as a standalone business functionality of a project. Feature file describes the testing needs for any features. A features file can contains one or many scenarios for you automated testings.In order the automatically detect the features by cucumber framework, you need to define it with .feature file extension. You will normally have a desperate feature file for each feature. 
(This post is still in progress--- keep visit us again)


Tuesday, June 2, 2020

Updating the hosts file in MAC

echo ' hdp hdp' | sudo tee -a /private/etc/hosts


Saturday, May 16, 2020

Bash script to rename or move files from a directory !

Following is the bash script that renames a sets of file form the current directoy. In the following is just updating the extension.


for file in *.JPEG; do

        name=$(basename "$file" .JPEG)

        mv "$file" "$name.jpeg"



Monday, April 20, 2020

Git - more on Git Tags -

The following steps outlines the Git Tag delete process both locally and remotely.
  1.  Fetch all the tags from
    git fetch --tags
  2. Delete the tag locally
    git tag -d yourTagToDelete  (eg: git tag -d v1.15.0)
  3. Delete the tag in Remote
    git push origin :yourTagToDelete (eg git push origin :v1.15.0)
  4. Create a new  tag locally
    git tag yourNewTag  (eg: git tag v1.15.0)
  5. Push tag to Remote
    git push origin yourTagToDelete (eg git push origin v1.15.0)


Saturday, April 18, 2020

Restarting Spring Boot Application !

Restarting Spring Boot Application  !

You have several options to restart Spring boot Application . You can restart either of the following three options. Based on your requirement you can choose one of the following.

  1. Using spring-boot-devtools
  2.            Add your Gradle dependency
        After that Add, you can simply add an end poing on your controller class and have the following:

    The drawback of using tools is you cannot make a good used of @Cacheable . it might cause ClassCastException while reading from the cache.

  3. Using RestartEndPoint from 
  4.    Add your Gradle dependency
         compile "org.springframework.boot:spring-boot-starter-actuator"
        After that Add, you can simply add an end on your controller class and have the following:
         RestartEndpoint restartEndpoint;
        And call the following methond from your controller :
    You might see NullPointer Exception while trying to bring the application up specially when you have UnderTow as your servlet container 
     3.   And the third one is reading the current context and restarting it. You can simply add the following method on the Main Class and invoke from your controller
       public static void restart() {
          ApplicationArguments args = appContext.getBean(ApplicationArguments.class);
          Thread thread = new Thread(() -> {
          SpringApplication springApplication = new SpringApplication(MyBootApplication.class);
          springApplication.addListeners(new ApplicationPidFileWriter());


Saturday, March 21, 2020

Thread Dumping in Unix - flyway recorder !

 jcmd 8308 JFR.start duration=100s filename=tempo.jfr


Thursday, March 5, 2020

Monogo Pipeline scripts !

1. Filter by an assistance of an array element in a document:
  $and:[{assessmentPeriods:{$ne:null, $exists:true, $ne: []}}  ]



Friday, April 5, 2019

Java 11 and Groovy Compatibility and JAXBContext !

If you see the following error during compile : 

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestGroovy'.
> org/codehaus/groovy/ast/MethodCallTransformation

Add the folling line to your gradle file :

ext['groovy.version'] = '2.5.6'  //i.e your grovy version.

Another issues with java 11

 Unable to load class groovy.xml.jaxb.Jaxb GroovyMethods due to missing dependency javax/xml/bind/JAXBContext 

You can fix this by adding the following dependency on the latest groovy version


Wednesday, February 6, 2019

Useful Unix Commands

1. Count number of lines on all the files in the current folder
wc -l *

2. Count the number of files on the current directory :
ls | wc -l
3. Print all the line containing word/s in a file
grep -iw "search words" arc.log
4. Thread dumping for a process
 jcmd 8308 JFR.start duration=100s filename=tempo.jfr



 © 2006-2010