let bindings are created at the top of the (block) scope containing the declaration, commonly referred to as "hoisting". Unlike variables declared with var, which will start with the value undefined, let variables are not initialized until their definition is evaluated. Accessing the variable before the initialization results in a ReferenceError. The variable is in a "temporal dead zone" from the start of the block until the initialization is processed.
所以上面的id會引發reference error 但是比較var範例
var id = 2;
function x() {
console.log(id);
//undefined,因為下面定義的variable hoisting
var id = 3;
console.log(id);
}
x();
Strings may be single quoted/支援多行/支援 \x的escape (U+0000 through U+00FF)
String更寬容的escape字元包含
JSON:All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).
JSON5:All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: the quotation mark used to begin and end the string, reverse solidus, and line terminators.
//BEFORE
// from $HOME_PROJECT/lib/math/
var myLib = require('../myLibrary');
var myUtils = require('../../utils/myUtils');
var myTest = require('../../test/myTest');
//AFTER
// from $HOME_PROJECT/lib/math/
require('rootpath')();
var myLib = require('lib/myLibrary');
var myUtils = require('utils/myUtils');
var myTest = require('test/myTest');
SOCKS5 rfc可參考1996年 rfc 1928 (其他: rfc 3089 socks based gateway) 須注意socks5本身並未加密,最好是透過ssh port forwarding
SOCKS5 proxy設置最簡單的方式 是
putty ssh tunnel
ssh -D 1080 user@server
注意port number 1024以下的權限問題(root)
-D [bind_address:]port Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the configuration file.
在server1上先建立SOCKS5 proxy to server2 ssh -D 1080 server2 在client端建立ssh tunnel local port forwarding ssh -L 1080:localhost:1080
#ss5 install
yum groupinstall 'Development Tools'
yum install gcc automake autoconf libtool make pam-devel yum-utils openldap-devel openssl-devel
mkdir /opt/ss5
cd /opt/ss5
wget http://sourceforge.net/projects/ss5/files/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
tar -zxf ss5-3.8.9-8.tar.gz
cd ss5-3.8.9
./configure
make
make install
cd /etc/opt/ss5/
設定全帳密認證 /etc/opt/ss5.conf 加上 auth 0.0.0.0/0 – u permit u 0.0.0.0/0 – 0.0.0.0/0 – – – – –
pkg-config exits with a nonzero code if it can’t find metadata for one or more of the packages on the command line
Libs: link flags
Libs.private: Private libraries are libraries which are not exposed through your library, but are needed in the case of static linking
Cflags: preprocessor flags, compiler flags, 不需要加上required package flags (pkg-config會處理)