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
 
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
NAME="System eth0"
TYPE=Ethernet
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
BOOTPROTO=static
IPADDR=192.168.1.88 # Replace with your ip address
NETMASK=255.255.255.0
 
 
## Configure Default Gateway
#
# vi /etc/sysconfig/network
 
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

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 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip