[Linux] Get My Public IP
If You are not Behind a Router
- You can find it out using
ifconfig
.
If You are Behind a Router
- Your computer will not know about the public IP address as the router does a network address translation.
curl icanhazip.com
ifconfig
.curl icanhazip.com
rpm-qa kernel
–count=n, n is the number of kernels YOU WANT TO LEFT.
yum install yum-utils
package-cleanup --oldkernels --count=1
edit /etc/yum.conf
installonly_limit=1
References have to be initialized, and will represent the variables assigned to them.
int x=10,y=5;
//wrong
int &A;
A=x;
//right
int &A=x;
//set x's value by y
A=y;
#include<iostream>
#include<typeinfo>
using namespace std;
int main()
{
int x;
cout << typeid(x).name() << endl;
system("pause");
return 0;
}
*x++ same as *(x++)
*++x same as *(++x)
*x+1 same as (*x)+1
//#include<algorithm> to use this template
template <class T> void swap (T& a, T& b)
{
T c(std::move(a)); a=std::move(b); b=std::move(c);
}
template <class T, size_t N> void swap (T (&a)[N], T (&b)[N])
{
for (size_t i = 0; i<N; ++i) swap (a[i],b[i]);
}