Search This Blog

Sunday, October 3, 2021

Upstox new user referral code: Earn Rs 1000 as credit using https://bv7np.app.goo.gl/D3D6B

 

Hey, have you tried Upstox?  Upstox is one of India's largest and fastest-growing investment platforms with over 50 lakh users. Recently they’ve introduced a new app, which is swifter, smarter, smoother and easy-to-use, for both pro traders and beginners. It allows you to invest in Stocks, Futures, Options, Mutual Funds, IPOs and more and offers Rs. 1000 brokerage credit valid for the first 30 days. Opening an account is fast and paperless! Sign up now with my link to open your account:   https://bv7np.app.goo.gl/D3D6B

Tuesday, July 31, 2012

Synchronize time of two or more PCs with NTP

1) At first check whether NTP is installed or not. Install if its not installed.

#apt-get install ntp

2) Start or restart ntp using

#/etc/init.d/ntp restart/start

3) On server machine do following things.
Open /etc/ntp.conf and add following things


server ntp.ubuntu.com iburst
server pool.ntp.org
server 127.127.1.0
fudge 127.127.1.0 stratum 10


restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap

Here first two lines are external ntp servers which will be used to synchronize to time. 3rd and 4th line is used if machine has infrequent internet connection. Last line is used so that any machine from network 192.168.10.0 can use this machine as a server to synchronize time. So result would be that you would see same time on all machines in that network 192.168.10.0 and current machine(server).

Restart ntp using

#/etc/init.d/ntp restart

4) On client machine
Open /etc/ntp.conf and add ip address of the server machine. We assume that ip address of server machine was 192.168.10.12.

so in ntp.conf enter

server 192.168.10.12 iburst

Restart ntp
# /etc/init.d/ntp restart

Check using following command

#ntpq -c lpeer
And you should see ip address or hostname of server machine.

Thats it. Now onwards all the client machines in the network 192.168.10.0 and server machine(192.168.10.12) will always show same time and will remain synchronized.

Clear cache memory used by linux kernel and processor cache

You just give one command to do this:
# free && sync && echo 3 > /proc/sys/vm/drop_caches && free
This would clear only disk cache.

In order to clear processor cache memory, there is no perfect method. I can only suggest one method.
At first write a c program to allocate large amount of memory using malloc. That memory should be almost equal to the amount free memory available which you can see using top command. Now fill that allocated memory by writing it with random data or may be even 0. That would clear your processor cached.

Login without password using ssh

At first install openssh client and server using following commands.
#sudo apt-get install openssh-client
#sudo apt-get install openssh-server

Lets assume that there are two machines A and B. You want to login from B to A without using password..

1) So from machine B give following commands.
# ssh-keygen

After that press enter for the file (i.e. let it use default file), then press enter when asked for entering password.

Example from my machine:


root@hpc-13:~/.ssh# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): (PRESS ENTER)
Enter same passphrase again:  (PRESS ENTER)
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ac:d6:6a:b2:98:f6:8a:0f:df:76:af:a6:82:7c:4f:c1 root@hpc-13
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|    .  .         |
|     E  S        |
|      .o         |
|o.   .o .        |
|.=o=+.+.         |
|.oB=*Ooo.        |
+-----------------+

2) Now use ssh-copy-id command to do rest of the things.

 # ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_of_remote_machine(machine A in our case)

Example from my machine:

root@hpc-13:~/.ssh# ssh-copy-id -i ~/.ssh/id_rsa.pub user@hpc-12
The authenticity of host 'hpc-12 (10.192.19.158)' can't be established.
RSA key fingerprint is 3f:9b:b2:b2:8e:36:09:4b:92:4c:df:bd:d6:14:b7:9f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hpc-12,10.192.19.158' (RSA) to the list of known hosts.
user@hpc-12's password:
Now try logging into the machine, with "ssh 'user@hpc-12'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

3) Now try ssh to machine A

#ssh user@hostname_of_remote_machine(machine A in our case)

And you should be able to login without password.


Tuesday, July 10, 2012

How to find cached copy of any webpage url

Google stores all the pages in cache for few days and they can be found out by using this url

http://webcache.googleusercontent.com/search?q=cache:

Now just append the url who's cache copy you want to see. For example if you want to see cache copy of www.google.com then your url will be

http://webcache.googleusercontent.com/search?q=cache:http://www.google.com

You can offcourse try with those url which are not active currently for example facebook photos which are deleted later on.

Tuesday, June 26, 2012

error: Failed dependencies: libc.so.6 is needed

I actually got this error while trying to install rpm of driver of a network card on RHEL 6.2 64 bit. That error looked something like this:

# rpm -i  myri_dbl-2.  1.0.51076-3636.x86_64.rpm
error: Failed dependencies:
        libc.so.6 is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libc.so.6(GLIBC_2.0) is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libc.so.6(GLIBC_2.1) is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libc.so.6(GLIBC_2.1.3) is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libc.so.6(GLIBC_2.3) is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libdl.so.2 is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libdl.so.2(GLIBC_2.0) is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libpthread.so.0 is needed by myri_dbl-2.1.0.51076-3636.x86_64
        libpthread.so.0(GLIBC_2.0) is needed by myri_dbl-2.1.0.51076-3636.x86_64


This error occurs because of some 32 dependencies which are required. The solution is to install 32 version of glibc.


# yum install libstdc++-4.4.6-4.el6.i686


This will mostly solve your problem.

Friday, June 22, 2012

To check which application is using a particular port

You give following command to check which application is using a particular port.

# netstat -ltnp | grep portno

or

# lsof -i :portno