Few Tips To Overcome Unstable Mind

Few Tips To Overcome Unstable Mind

The silly truth I realized, when you have fears, and if your mind becomes unstable, then events happening in your day might take over you and your day and that will lead to procrastination, the feeling of dont want to do anything.

In some other words, we might also call it as depression and if you also feel that the task at your hand is either completely new to you or you dont like at all.

But if you like the task at your hand then all these fears, events that might unstable you will not have any impact.

So to make or build the task which you dont like you have to break the task into into known and unknown piece. Then devide your time.

When your mind is stable, focus on unknown things because in tough times to move forward what we need is hope and will power which are like twin sisters, one doesn’t exist without the other.

When your mind is not stable focus on known things which can be completed with no effort, focus on things which you know how to deal. Now this will help to bring back your stability. As the task is not completely new and you know how to do it, you will start doing it. So you are not feeding the unstable thoughts any more and you are becoming focused and aware and your mind starts to become stable.

But sometimes, known tasks which are boring like reviwing other’s work, reading word docs, reading mails might not help. Because I want you to think with visualizations and assumptions.

Here is the key point #1, when your mind is unstable its getting feeded by your assumptions and your visulizations of negative thoughts or events , and now stop feeding your mind with those assumptions and visualizations and feed them something else, like known but interesting tasks at your hand, or close your eyes and go with imagination that you are doing great or you have achieved your long-term goals, so this will give you a great feeling, so close your eyes and feel it.

And one more key point #2, always focus on moving forward, something unexpected happened today with work life or personal life, dont stop there and feel sad about it, its okay take your time to come out but dont stop there, from your schedule / plan (which is very important) and move forward.

And last one, if you have positive energy, spread that around. if you spread positive energy, it will help the people with negtative or depressed state of mind to feel better and to spark a positive light inside their mind. If you have a negative feeling dont spread that around and use the #1 key point from above and turn your self/mind into positive.

You just read 500 + words.
Hope it helps you.


Thank you.
Raaz

QEMU: Installation of QEMU VMs on Mac OS

QEMU: Installation of QEMU VMs on Mac OS

Credit Goes to : Gist GitHub

Install QEMU on OSX

QEMU requires brew in OSX, so we need to install brew first.

Installing Brew

To install brew we need to have the developer tools enabled in our system. In order to install those tools, we have two options.

  1. Download Xcode form the AppStore
  2. In your terminal run the following command: xcode-select --install

Once you have the developer tools, run the following command in your terminal to install brew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once the installation is finished, we can test the brew installation in our terminal with the command

$ brew doctor

Installing QEMU

Now that we have brew on the system we can proceed to the QEMU installation. To do that we use a simple command:

$ brew install qemu

When the installation is finished, we can run the following command to test if the installation was successful:

$ qemu-system-x86_64 --version

Installing Ubuntu on QEMU

We need to follow a series of steps in order to install an Ubuntu VM on QEMU. The first one is go to the Ubuntu website and download an .iso file of the operating system.
Once we have the .iso, we need to to this:

  1. Create a folder in your computer (with any name and anywhere). $ mkdir ubuntu_vm
  2. Move the .iso file in the folder that you just create. $ mv ubuntu.iso ./your-folder
  3. Then move inside the folder you just create $ cd ubuntu_vm
  4. Inside the folder, create the drive file of the system qemu-img create -f qcow2 ubuntu_drive.qcow2 10G
  5. Run ls to verify that the .iso and the qcow file are inside the folder

Once you have the previous steps, you can run the following command to run the iso and complete the installation:

  • -show-cursor option didnt worked for me in the mac
  • -enable-kvm Mac OS is BSD based, so it wont have Linux Kernel where KVM supported.

So please remove them on Mac before using.

qemu-system-x86_64 \
  -m 2048 \
  -vga virtio \
  -show-cursor \
  -usb \
  -device usb-tablet \
  -enable-kvm \
  -cdrom your_ubuntu.iso
  -drive file=ubuntu_drive.qcow2,if=virtio \
  -accel hvf \
  -cpu host

The previous command, will run the iso, when you are there, you need to complete the ubuntu installation, so once you see something you must:

  1. Click on Install Ubuntu
  2. Select erase disk when the installer ask about it
  3. When the installer asks you to restart the machine close the QEMU window.

Now, in order to make more easy to run our QEMU VM, we are going to create a shell command. So, lets do the following.

First, create a new file in any place you want:

$ vi ubuntuvm.sh

Then, paste the following and adept it to your needs:

qemu-system-x86_64 \
  -m 2048 \
  -vga virtio \
  -show-cursor \
  -usb \
  -device usb-tablet \
  -enable-kvm \
  -cdrom your_ubuntu.iso
  -drive file=~/absolute/path/to/your/ubuntu_drive.qcow2,if=virtio \
  -accel hvf \
  -cpu host

And finally, write and quit.

As you can see, the command deletes the instruction about the .iso file. This is because now we have the operating system already installed.
Now in order to run the vm, we need to make our file executable. So run the following command:

$ chmod +x ubuntuvm.sh

And finally to run it:

$ ./ubuntuvm

And that is it. We should see our virtual machine running correctly.

Python FastAPI: Notes

Python FastAPI: Notes

My FastAPI notes.

Installation

pip install "fastapi[all]"

Basic App: Assume filename main.py

from typing import Optional
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}

To start the API service

uvicorn main:app --reload
  • To access API Documentation, http://ip.port/docs

How to resolve InitializeSandbox() called with multiple threads in process gpu-process. Error in Linux with Google Chrome ?

How to resolve InitializeSandbox() called with multiple threads in process gpu-process. Error in Linux with Google Chrome ?

Hello Everyone,

While launching google chrome browser, if you are getting below error in Linux, remove Google Chrome config directory from your home folder.

❯❯ ~  18:03 google-chrome-stable   
[45359:45359:0125/180542.953317:ERROR:sandbox_linux.cc(378)] InitializeSandbox() called with multiple threads in process gpu-process.

Note: Doing below command will delete your chrome data, hope you have enabled cloud sync.
So remove config directory of google chrome from your home directory

❯❯ ~   18:07 rm -rf ~/.config/google-chrome

Then launch google chrome again
Hope it helps.


Thanks
Raaz

Linux: How to generate self-signed certificate in Linux using openssl ?

Make sure openssl installed in your server/machine

Process includes 3 steps as below

  • {{ step.description }}
    {{ step.command }}

Execution and output


                    ❯❯ cert  23:03 openssl genrsa -out ca.key 2048
                    Generating RSA private key, 2048 bit long modulus (2 primes)
                    ............+++++
                    ...........................+++++
                    e is 65537 (0x010001)
                    ❯❯ cert  23:03 openssl req -new -key ca.key -subj "/CN=THELINUXNMEN-BLOG-CA" -out ca.csr
                    ❯❯ cert  23:03 ls
                    ca.csr  ca.key
                    ❯❯ cert  23:03 openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt
                    Signature ok
                    subject=CN = THELINUXNMEN-BLOG-CA
                    Getting Private key
                    ❯❯ cert  23:04 ls
                    ca.crt  ca.csr  ca.key
                    ❯❯ cert  23:04