8. Shell正则表达式

The Unix shell recognises a limited form of regular expressions used with filename substitution: Operators Operator Effect ? The hook operator specifies any single character. [ ] boxes enable a single character to be matched against a character lists or character range. [! ] A compliment box enables a single character not within in a character list or character range to be matched. * An asterisk specifies zero or more…

7. Emacs正则表达式

Notes on regular expressions used in text editor Emacs: For backslash escaping (magic vs literal), Emacs uses a mixture of BRE and ERE. Like in ERE, Emacs supports unescaped +, ?. Like in BRE, Emacs supports escaped \(, \), \|, \{, \}. GNU extensions to regular expressions supported by Emacs include \w, \W, \b, \B, \<, \>, \` , \’ (start and end of buffer) No “\s” like in PCRE; whitespace…

6. 非Posix基本正则表达式

Non POSIX Basic Regular Expression Syntax: An additional non-POSIX class understood by some tools is [:word:], which is usually defined as [:alnum:] plus underscore. This form of regular expression is used to reflect the fact that in many programming languages these characters may be used in identifiers. Operators Operator Effect . The dot operator matches any single character. [ ] boxes enable a single character to be matched against a…

Debian搭建vpn服务器

搭建 VPN 服务器的方法非常多,比较著名的有 PPTP, L2TP/IPSec 和 OpenVPN。这三种方式中后两者的安全性比较好,但配置较麻烦,PPTP 是这三者中配置最容易的方式,而且 Windows/Mac 系统中都内建相应的客户端。 1、安装pptp,这是个vpn的服务端软件 sudo apt-get install pptpd 系统会自动解决依赖关系,安装好后,需要进行一番设置。 2、编辑 /etc/pptpd.conf sudo vi /etc/pptpd.conf 去掉文件最末端的 localip 和 remoteip 两个参数的注释,并进行相应修改。这里,localip 是 VPN 连通后服务器的 ip 地址,而 remoteip 则是客户端的可分配 ip 地址,自己设置置。 3、这里绝大多数参数只需维持原来的默认值即可,我们只需要改变其中的 ms-dns 选项,为 VPN 客户端指派 DNS 服务器地址,可以修改为google提供的DNS server或其他DNS: ms-dns 8.8.8.8 ms-dns 8.8.4.4 4、 修改文件 /etc/ppp/chap-secrets,第一列是用户名,第二列是服务器名(默认写 pptpd 即可,如果在 pptpd-options 文件中更改过的话,注意这里保持和文件中的name行一致),第三列是密码,第四列是 IP 限制(不做限制写 * 即可)如创建一个名为user,密码为userpasswd,不限制登录IP的VPN账号: user pptpd userpasswd * 全部搞定后,我们需要重启 pptpd 服务使新配置生效: sudo /etc/init.d/pptpd restart 如果这时候尝试连接的话是可以连上的,但是只能访问机器资源,不能上网,想上网的话需要继续配置。 6、修改文件…

Hello world的autoconf和国际化支持教程

本文将讲解如何将一个使用Makefile的Hello world程序国际化以及如何采用autotools进行配置和编译。 下面是大家所熟知的Hello world程序,将其命名为helloworld.c: #include <stdio.h> int main (void) { printf ("Hello, world!\n"); } 1.首先我们创建源代码目录树:    /                这是顶层目录    /src           这是放置源代码的目录将helloworld.c放入src/目录中。 2.如果你的程序还没有启用autoconf,你可以先创建configure.scan文件(),将其重命名为configure.ac: autoscan mv configure.scan configure.ac 编辑configure.ac,进行一些修改。你可以删除AC_INIT后面的所有内容。我们将采用AM_INIT_AUTOMAKE来传递变量。在AC_INIT后添加如下几行: PACKAGE=helloworldVERSION=0.0.1AM_INIT_AUTOMAKE($PACKAGE, $VERSION) 并将AC_CONFIG_HEADER改变为AM_CONFIG_HEADER。如果你有一个空的AC_CONFIG_FILES 宏,注释掉它,否则下一步会出现错误。最后添加Makefile到AC_OUTPUT宏: AC_OUTPUT(Makefile)     注释:configure.ac以前叫configure.in 3.添加一些额外的文件:NEWS、README、AUTHORS、Changelog,这些文件不是automake工具所需要的,这是为了遵循GNU标准。在新建另外两个文件:config.h.in、Makefile.am,这两个文件是automake工具所必须的。我们将稍后创建Makefile.am。 4.添加GNU所要求但还不存在的文件(如CONPING、INSTALL等): automake --add-missing --gnu 5.接下来,我们将添加国际化支持。同样,在顶层目录运行下面的命令: intltoolize 6.运行autoheader来创建config.h.in: autoheader 7.打开configu.in进行一些修改: IT_PROG_INTLTOOL(0.26) AM_GNU_GETTEXT([external]) # 我们只需要这两个 AM_GLIB_GNU_GETTEXT # 宏中的一个 ALL_LINGUAS="da nl" # 国际化,意味着将为danish和dutch语言创建.po文件 AC_OUTPUT( Makefile…