All posts by Arvind Kumar

Setting up ssh key-pair with different name than id_rsa

I have had got a id_rsa key in my local machine which I used to connect to github. Now I wanted another keypair so that I could connect to bitbucket repository and another one for the digitalocean vps server.

For my DigitalOcean server I created a new key-pair using ssh-keygen and named it do_rsa so that it created two keys, do_rsa and do_rsa.pub, private and public key respectively.

Now the issue is if I try to connect using:

ssh root@xxx.xxx.xxx.xxx

it gives Permission denied(publickey) error. This is because by default ssh client tries to read the id_rsa key pair values which is not the correct one. Actually I had assumption that my local ssh client would read all files in .ssh folder but this was not the case perhaps.

To make it work correctly we need to specify the correct private keyfile for the given IP address I have had for my digitalocean server. We can do it by creating a config file in the .ssh folder

So here is the content of the config file in .ssh folder

Host xxx.xxx.xxx.xxx
	IdentityFile ~/.ssh/do_rsa

After saving it I tried root@xxx.xxx.xxx.xxx and it worked like a charm!

ReactJS check radio/checkbox buttons and scrolling of wrapper div to top – fixed

Issue:

There is a long list of categories to select from. Since the list was long and it could not fit within the wrapper div the maximum height of the wrapper div had to be set and make the wrapper div scrollable by using css properties. Here comes the issue. Whenever a category is checked the react state is changed which caused the component to re-render the html. The re-rendering of html cause to show the upper part visible and not the area which was in the view port while checking the category. Makes sense? Read on!

Continue reading

How to prevent parent’s onclick event from firing when a child tag is clicked with jquery?

Generally, Javascript events bubble (listen) to the highest point in the DOM to which a click event had been attached. So even if you don’t have any other explicitly click-able elements in the div, every child element of the div would bubble their click event up the DOM to until the DIV’s click event handler catches it. Continue reading

MYSQL – Useful commands you must know – Part-1

To know the current MYSQL version:
SELECT version();

To format and formulate a float value:
FORMAT(SUM(amount) * 0.6, 2)
The above line sums up entire amount value, cut it down to 60% of total value and returns value precised up to 2 decimal places.

To get the size of database in MB
SELECT table_schema “Data Base Name”, sum( data_length + index_length) / 1024 / 1024
“Data Base Size in MB” FROM information_schema.TABLES GROUP BY table_schema ;