Saturday, April 24, 2021

Are you feeling low? Top 5 ways to live with coronvavirus COVID-19 pademic

COVID-19 made it's may into 2020 and now 2021.

How do I feel about it? It's mixed emotions.

I miss the strangers, the acquaintances, friends, colleagues and buddies I use to spend time with.We are all aging as the day passes by, our friends and family are not limited to only family.

The pandemic has taken a toil on our mental health. We as people are born to be on the move.

I miss the coffee talks, the cafeteria chats, eleventh hour plans and it all comes down to freedom and independence.

We have now seen a series of lockdowns and unlockdowns but our minds have taken a hit.

I am no spiritual healer not a motivational speaker, but here's how I deal with the ups and downs and high's and low's.

1. Read a book:
I wasn't a voracious reader ever, I've managed to be better than I was. Pick up a book, read 5 pages a day.

2. Health:
I wouldn't suggest this to people. I was overweight and still I am, I had a routine to walk ~10,000 steps a day a year before pandemic and I lost 1.5 kgs a month. I continued this for 14 months and I lost ~20 kgs. This story is for another day.

I walk 3 to 4 times a day - 10 to 15 min walk in my room, jog around. This will clear up your mind.

3. Ask yourself, What am I doing? and What should I be doing?
I picked this from a book. We are become mindful with each day, but with each day we add thoughts to the millions we already have. Our whole life is about thoughts.

If you have work to do and you want to focus, question yourself. What am I doing? You'll notice your brain stops for a second, keeps all thoughts aside and becomes blank. Continuously do this the whole day, you will observe a sense of awareness.

4. Pick a hobby:

 Learn something and start writing. Try to enjoy activities with family. If you like to be alone, pick an area of interest, read and write a blog about it like I am doing now.

5. Time your activities:
Time your activities in the day, use a mobile to time them, you should be able to make a 24 hour plan for yourself in a couple of months. This is how I did it. Time a task let's say read a book for 5 mins or 10 mins. Snooze it if you want to continue it for another 5 mins. Eventually you will find that time that suits your concentration levels.

Remember to take breaks and don't let the breaks break you either.

Cheers,

Ajith


 


What does CRSF stand for?

CRSF stands for Cross-site request forgery.
CSRF is also used as an abbreviation in defences against CSRF attacks, such as techniques that use header data, form data, or cookies, to test for and prevent such attacks.

The app must send a request header called X-CSRF-Token with the value fetch in this call. The server generates a token, stores it in the user's session table, and sends the value in the X-CSRF-Token HTTP response header.

 

Cross-site request forgery, also known as one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf) or XSRF, is a type of malicious exploit of a website where unauthorized commands are submitted from a user that the web application trusts.

 

cross-site scripting (XSS), exploits the trust a user has for a particular site,
CSRF exploits the trust that a site has in a user's browser.  

 

Source:https://en.wikipedia.org/wiki/Cross-site_request_forgery 

Thursday, April 22, 2021

How to set css color property to red in JQuery

 $('h1').css('color','red')
 $('*').css('color','red')

What is Patmos in the Book of Revelation?

 Patmos is mentioned in the Book of Revelation, the last book of the Christian Bible. 

Patmos, an Aegean island in the north of Greece’s Dodecanese island group, is a significant Christian pilgrimage site. Its Cave of the Apocalypse is where John of Patmos (St. John the Theologian) is said to have written the Book of Revelations.


source:https://en.wikipedia.org/wiki/Patmos

What are the seven Spirits which are before the throne of God? - Revelation 1

I was curious to find out the meaning of "the seven Spirits, which are before the throne of God" which reading the Bible today.

Here's something that I found. Please feel free to add:

 The seven gifts of the Holy Spirit are wisdom, understanding, counsel, fortitude, knowledge, piety, and fear of the Lord

Wednesday, April 21, 2021

How to add google analytics code to blogger blog?

Go to Design mode. Click Theme.

Click Customize drop down > Click Edit as HTML
under head paste your google code from analytics. Steps to get google analytics code is below.

In google analytics go to ADMIN

Then create account and add blog.

If you have already have one, Click Account Management. Close the Popup that comes up.

Look for "Tracking Info" under property>

Click "Tracking Code" under it.

Copy the code under Global site tag.

Paste it now in the section under head.


https://www.youtube.com/watch?v=N3jGnYbkr50

What is Ram Navami

 What is Ram Navami?

It is a sprint Hindu festival that celebrates the birthday of Hindu God Lord Rama.

Ram was born to King Dasharath and Queen Kaushalya in Ayodhya in the Tretha Yug.

Ram is considered the the seventh incarnation of Vishnu.

It is celebrated as ninth day of Chaitra Navratri.

Tuesday, April 20, 2021

How to create a HTTP server, listener and response with NodeJS at runtime?

Pre-requisute: Install nodejs, visual studio code and the http modul

Descrption: The use of createServer from http module - will help create an object that servers as a webserver running on localhost:8080

const {createServer} =require('http');
cons server=createServer((request,response))=>{
    response.writeHead(200,{'Content-Type':'application/json'});
    response.write(JSON.stringify({a:1,b:2,c:3}));
    return response.end();
});

server.listen(8080);

What does this mean?

This means, you can technically launch a webserver on the fly and create a response work temporarily and shut it down. 

I am assuming its a good strategy to not have a webserver always running, but that question is for another day.

Cheers

Credits : https://www.youtube.com/watch?v=TrofE5tDRag

How to copy filepath from Finder and open it in Terminal on MacOS

 Open Finder

If you do not see the Path listed above status bar, do the following.

Select the following Menu Option
View -> Show Path Bar

Now click on any file in the finder window.

You should be able to see the path of the file below

Macintosh > Library > WebServer > Documents > index.html

The format we are looking for is /Library/WebServer/Documents/index.html

Right click on index.html file you should see an option Copy "index.html" as Pathname

Paste it into a Terminal and you should be the path of the format.
/Library/WebServer/Documents/index.html

To open the folder in the Termainal, right click on any folder (blue icons), example Documents in this case or Library. Use "New Terminal Tab at Folder" or "New Terminal at Folder". A new terminal would open with the path set by default.

use pwd to verify the path.

What is prometheus?

Prometheus is a software for mentoring and alerting. The idea it to time 

Similar tools:

Borgman remains internal to Google. Treating time-series data as a data source

Monday, April 19, 2021

What is graphana? what does it do?

Graphana is an open source web application.

It supports Prometheus database and ships it inbuilt.

What purpose does it serve?

It allows you to build Charts, Graphs and Dashboards that you want to Visualize

What is the architecture of Graphana?

-> Data producer (Jenkins, Kubernetes, Virutal Machine) - Aggregate data - Temperate, weather
-> Data Source (Prometheus or any other database) - Pull data (sensor data) or Data Producer pushes data
-> Graphana queries the data source and provides a Dashboard

What are the Categories of data that Graphana visualizes over?

Metrics - CPU Load, Memory Usage
Logs - errors [TimeSliced]

What does the Dashboard show?

It shows CPU/Memory along with TimeSeries Graph that you can Zoom in and factor data for the controlled set of data.

Similar Tools:

Kibana


Sunday, April 18, 2021

How to find a file in macOS Terminal using bash?

Cd into the directory. 

Example:
List down all the files with the name test.

 find . -type f -name "test*"

Additional tip

List down all the directories with the name test.

find . -type d -name "test*"

How to configure settings in php on MAMP ?

 The configuration file for php is php.ini.

The file is present in /etc directory.

Open a Terminal. Change to Root user.

bash#su -s
enter password

bash# cd /etc

bash# ls -l | grep php.ini

-rwxr-xr-x   1 root  wheel   72020 Apr 18 11:17 php.ini.default

bash# chmod 755 php.ini.default

Rename the file to pho.ini

mv php.ini.default

Edit the file and set the following settings if you wish too.

vi php.ini

To seach use /<word>

Userful settings

display_errors On
disaplay_start_errors - On
error_log /var/log/apache2/php_errors.log

write and quit

restart apache to reflect changes

bash#apachectl restart

Additional commands

php -v          -         version of php
php -m        -          modules installed like ssl, sockets etc.,
php -i            -        view php.ini configuration files

Saturday, April 17, 2021

Top 5 keywords associated with Beauty?

Words have meanings associated to it, some are synonyms like siblings and some are distant relatives like friends and associates.

Let's write the words down and you and I can later figure out our preferences to categorize them.

  1. Beauty
  2. Makeup?
  3. Dress
  4. Women
  5. Hair
  6. Wardrobe
  7. Face
  8. Beauty products



Friday, April 16, 2021

How to increase the font size of MacOS terminal?

Open a command Terminal. 

Use command + command - to increase or decrease the font size

How to solve InnoDB: Unable to lock ./ibdata1 mysql error? Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive

Problem Statement:

bash-3.2# /usr/local/mysql/support-files/mysql.server start


Starting MySQL
.................................................................................................... ERROR! The server quit without updating PID file (/usr/local/mysql/data/xx-xxx.pid).
bash-3.2# cat /usr/local/mysql/data/xx-xxxx.pid

 

Root Case :

There might be multiple mysql processes running. Kill them.

Solution:

bash-3.2# ps aux|grep mysql


root             28892   0.9  0.0  4277256    796 s001  S+    1:09PM   0:00.00 grep mysql
 

_mysql           22971   0.0  1.1  4884468 186036   ??  Ss    9:49AM   0:23.22 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so

sudo kill 22971

Restart the server

bash-3.2# /usr/local/mysql/support-files/mysql.server start

Starting MySQL
. SUCCESS!

Additional information

Error Messages from logs could look like:

bash-3.2# cat /usr/local/mysql/data/amoni-mac.err
2021-04-16T07:05:06.321323Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) starting as process 27393
2021-04-16T07:05:06.324284Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-04-16T07:05:06.342917Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-04-16T07:05:06.365435Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2021-04-16T07:05:07.368910Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2021-04-16T07:05:08.372637Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35

How to list directories in linux macOS

The following are few of the different ways to list the directories in linux
  1. find * -maxdepth 0 -type d
  2. ls -al | grep '^d'

Thursday, April 15, 2021

How do configure apache web server on MAMP on a Mac?

To install MAMP Read here.

 Open Terminal in Mac

If sudo su (doesn't work)

Use : "sudo -s"

This should bring you to a bash prompt


httpd -v

Server version: Apache/2.4.34 (Unix)
Server built:   Feb 22 2019 20:20:11


apachectl stop
apachectl start

If it's already started, you may see a message similar as follows:
apachectl start
/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded
apachectl status

Open "http://localhost:80" in the web browser of your choice.

Stopping a server

apachectl graceful

apachectl -k stop
AH00557: httpd: apr_sockaddr_info_get() failed for amoni-mac
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

To Unload the server

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist


In order to avoid the message above,you can configure the server name using the command in the Terminal

vi /etc/apache2/httpd.conf

Look for the following section and uncomment #ServerName <provide a name here>

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost