Secret Angular (2+) Key event filtering

According to the official document (here) You’ll be able to bind

 to your

 control to just handle keyboard

 event like this:

What else can you do with this cool filter then? 

According to the source code of Angular (Github) , you could use a lot more like:

  • two events: keydown, keyup
  • modifiers: e.g. keyup.control.shift.enter
  • special key names: e.g. dot, space, escape, enter
  • short forms: e.g. esc (short for escape)

Find Out What Process is Listening on a Specific TCP Port

There are two commands which are popular to get the result: netstat and lsof. We probably already have been familiar with

netstat -nlp

to list all the listening ports. We actually could do

lsof -Pnl +M -i4

to list all IPv4 ports or

lsof -Pnl +M -i6

to list all IPv6 ports as well.

Split a subfolder out into a new repository

If you want to turn a folder within a Git repository into a brand new repository, and you don’t want to lose any of your Git history or changes, you can use git filter-branch command. For example,

git filter-branch --prune-empty --subdirectory-filter SUBFOLDER_NAME master

All the other files but the subfolder would be removed. Now you can add a new remote and then push it to your new location.

Static IP Configuration in CentOS

For example, to configure the IP of eth0, edit the file /etc/sysconfig/network-scripts/ifcfg-eth0

## Configure eth0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
NAME="System eth0"
IPADDR= # Replace with your ip address
## Configure Default Gateway
# vi /etc/sysconfig/network

And then restart the network interfaces by

/etc/init.d/network restart

Optionally, configure the DNS servers by editing the file /etc/resolv.conf

## Configure DNS Server
# vi /etc/resolv.conf
nameserver # Replace with your nameserver ip
nameserver # Replace with your nameserver ip