0%

1
2
3
4
5
6
7
$ git clone https://github.com/shadowsocksrr/shadowsocksr-libev
$ cd shadowsocksr-libev
$ sudo apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev \\
gawk debhelper dh-systemd init-system-helpers pkg-config asciidoc xmlto apg libpcre3-dev
$ dpkg-buildpackage -b -us -uc -i
$ cd ..
$ sudo dpkg -i shadowsocks-libev*.deb

可以单独阻止个别软件包在执行update和dist-update命令时进行更新,也就是不让这些包从源里更新。

dpkg维护软件包的状态,分别有以下几种状态:

unknown – 用户并没描述他想对软件包进行什么操作。
install – 用户希望对软件包进行安装或升级。
remove – 用户希望删除软件包,但不想删除任何配置文件。
purge – 用户希望完全删除软件包,包括配置文件。
hold – 用户希望软件包保持现状,例如,用户希望保持当前的版本,当前的状态,当前的一切。

只要将软件包foobar的状态修改为hold就可以阻止更新:

1
echo foobar hold sudo dpkg --set-selections

如果要恢复软件包foobar的更新,只要将状态修改为install就可以了:

1
echo foobar install sudo dpkg --set-selections

===
[erq]

因为种种原因,自备机房联通和移动双物理链路接入互联网访问,联通线路经常挂掉,影响互联网访问,使用NQA(network quality analyzer)+track可以根据物理链路是否有效来自动选择静态默认路由。

两条默认路由的preference是不同的,网通链路优先,当两条链路都有效时,默认路由走联通链路,当联通链路失效时,联通默认路由自动被禁止,从而默认路由走移动链路。

配置步骤
启用nqa,默认是启动状态

1
nqa agent enable

1、配置nqa自动侦测两条物理链路
网通链路nqa侦测组(test group):

1
2
3
4
5
6
7
8
9
#
nqa entry admin wangtong #添加nqa侦测项目
type icmp-echo #配置测试例类型为ICMP-echo并进入测试类型视图
  destination ip 网通网关ip #配置测试操作的目的IP地址,如果网关开启了防ping功能,是ping不通的,必须设置其他一个可以ping通的地址
  next-hop 网通网关ip #配置IP报文的下一跳IP地址,即网关的ip,若destination设的是网关ip,可以不配置,若destination不是网关ip,则必须配置
  probe count 3 #配置一次NQA测试中进行探测的次数,默认为1,此处也可以不设置
  probe timeout 1000 #配置NQA探测超时时间,默认为3000ms,可以不设置,用默认的
  frequency 1000 #测试频率为1000ms既测试组连续两次测试开始时间的时间间隔为1秒,最好设置下
  reaction 2 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only #建立联动项2,既如果连续测试3次失败则触发相关动作。每个测试组可以有多条reaction,分别指定不同的编号即可。

移动链路nqa侦测组(test group):

1
2
3
4
5
6
7
8
9
#
nqa entry admin yidong #添加nqa侦测项目
type icmp-echo #配置测试例类型为ICMP-echo并进入测试类型视图
  destination ip 移动网关ip #配置测试操作的目的IP地址,如果网关开启了防ping功能,是ping不通的,必须设置其他一个可以ping通的地址
  next-hop 移动网关ip #配置IP报文的下一跳IP地址,即网关的ip,若destination设的是网关ip,可以不配置,若destination不是网关ip,则必须配置
  probe count 3 #配置一次NQA测试中进行探测的次数,默认为1,此处也可以不设置
  probe timeout 1000 #配置NQA探测超时时间,默认为3000ms,可以不设置,用默认的
  frequency 1000 #测试频率为1000ms既测试组连续两次测试开始时间的时间间隔为1秒,最好设置下
  reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only #建立联动项1,既如果连续测试3次失败则触发相关动作

每个nqa侦测可以绑定多个reaction动作,比如reaction 1, reaction 2, reaction 3,…

2、创建侦测项目中reaction关联的track

1
2
track 1 nqa entry admin yidong reaction 1
track 2 nqa entry admin wangtong reaction 2

3、启动nqa侦测组

1
2
nqa schedule admin wangtong start-time now lifetime forever #启动网通链路探测组
nqa schedule admin yidong start-time now lifetime forever #启动移动链路探测组

可以用undo来停止侦测组

1
2
undo nqa schedule admin wangtong #停止网通链路侦测组
undo nqa schedule admin yidong #停止移动链路侦测组

4、设置track联动的静态默认路由

1
2
ip route-static 0.0.0.0 0.0.0.0 222.132.*.* track 2 #联通链路,默认preferece为60,低于80,所以优先使用联通链路
ip route-static 0.0.0.0 0.0.0.0 218.201.*.* track 1 preference 80 #移动链路,备份线路

查看状态

查看track

1
2
3
4
5
6
7
8
9
10
11
12
13
display track all #或者查看指定的track: display track 1
Track ID: 1
Status: Positive
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
NQA entry: admin yidong
Reaction: 1
Track ID: 2
Status: Negative
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
NQA entry: admin wangtong
Reaction: 2

可以看到网通链路挂了,移动链路是有效的。

查看nqa统计

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
display nqa statistics
NQA entry(admin admin, tag yidong) test statistics:
NO. : 1
Destination IP address: 218.201.*.*
Start time: 2000-10-16 15:00:37.9
Life time: 3520
Send operation times: 33633 Receive response times: 33628
Min/Max/Average round trip time: 1/5/1
Square-Sum of round trip time: 33773
Extended results:
Packet lost in test: 0%
Failures due to timeout: 5
Failures due to disconnect: 0
Failures due to no connection: 0
Failures due to sequence error: 0
Failures due to internal error: 0
Failures due to other errors: 0
Packet(s) arrived late: 0
NQA entry(admin admin, tag wangtong) test statistics:
NO. : 1
Destination IP address: 222.132.*.*
Start time: 2000-10-16 15:00:07.6
Life time: 3549
Send operation times: 1099 Receive response times: 0
Min/Max/Average round trip time: 0/0/0
Square-Sum of round trip time: 0
Extended results:
Packet lost in test: 100%
Failures due to timeout: 1099
Failures due to disconnect: 0
Failures due to no connection: 0
Failures due to sequence error: 0
Failures due to internal error: 0
Failures due to other errors: 0
Packet(s) arrived late: 0

可以看到网通链路是无效的。

查看当前路由表

1
2
3
4
5
6
7
8
9
display ip routing-table
Routing Tables: Public
Destinations : 419 Routes : 419

Destination/Mask Proto Pre Cost NextHop Interface

0.0.0.0/0 Static 80 0 218.201.*.* Vlan200
2.0.0.0/8 Direct 0 0 2.0.0.59 Vlan300

可以看到当前默认路由走的是移动链路。

References:
[1]H3C防火墙/路由器通过Track实现双线接入的链路备份
[2]H3C NQA Configuration

从头顺序播放:

1
$ mplayer -cdrom-device /dev/sr0 cdda:// -cache 5000

播放指定音轨:

1
$ mplayer -cdrom-device /dev/sr0 cdda://5 -cache 5000

播放部分音轨:

1
$ mplayer -cdrom-device /dev/sr0 cdda://6-13 -cache 5000

一定要加cache参数,因为读取CDROM是很慢的,不缓存会爆音。

References:
[1] Mplayer: Play Audio CD Using Linux Command Line

安装certbot

stretch源里的版本太低,因此需要配置stretch backports源,然后用以下命令安装

1
$ sudo apt-get install certbot -t stretch-backports

或者直接去官方下载安装使用:

1
2
3
$ wget https://dl.eff.org/certbot-auto
$ chmod a+x ./certbot-auto
$ ./certbot-auto --help

申请统配证书

1
2
3
4
$ sudo certbot certonly \\
--server https://acme-v02.api.letsencrypt.org/directory \\
--manual --preferred-challenges dns \\
-d *.openwares.net

或者如果手工安装certbot的话请用certbot-auto命令
这里只是申请证书,并不会自动安装,需要手工配置应用服务器,那些自动部署证书的插件并不是很好用。

要申请wildcard子域统配证书,certbot必须为0.22.0或以上版本,而且要使用ACMEv2服务器申请证书。

然后会有一通问题,看清楚回答即可,后面会要求为申请证书的域名配置TXT记录,类似如下:

1
2
3
4
5
6
Please deploy a DNS TXT record under the name
_acme-challenge.openwares.net with the following value:

ZvjRBkEYcMVZSEslsuj*******************

Before continuing, verify the record is deployed.

按照要求配置域名TXT记录,确认TXT记录生效

1
2
$ host -t TXT _acme-challenge.openwares.net
_acme-challenge.openwares.net descriptive text "ZvjRBkEYcMVZSEslsu************"

TXT记录生效可能稍微会需要一些时间,确认生效后继续,如果通过验证则会生成证书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/openwares.net/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/openwares.net/privkey.pem
Your cert will expire on 2018-08-31. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

现在已经有了wildcard证书了,将证书配置到你的web服务器中就ok了。

证书的有效期只有三个月,距离失效期30日内,可以简单的执行以下命令来更新证书:

1
$ sudo certbot renew

===
[erq]

ubuntu 16.04.4
amdgpu-pro 17.40-492261

before install amdgpu-pro
UEFI:
peg0 -> gen2
peg1 -> gen2
pci latency time -> 96
above 4G memory -> disable
hd audio controller -> disable
intel serial i/o -> disable
legacy usb support -> enable
fastboot -> disable
boot mode -> legacy + uefi
comm port -> disable
LPT port -> disable

install amdgpu-pro
$> sudo update-pciids

reboot

UEFI:
above 4G memory -> enable

CPPFLAGS是C/C++ PreProcessor预处理器选项,适用于C和C++语言。CFLAGS是适用于C语言的编译器选项,而CXXFLAGS是适用于C++的编译器选项。

因为MacOS安全与权限的问题,运行gdb需要用证书签名gdb,好麻烦。所以使用docker运行debian stretch容器,执行gdb时出现类似错误:

1
warning: Error disabling address space randomization: Operation not permitted

那么在运行容器的时候添如下参数就可以了:

1
--security-opt seccomp=unconfined

如果需要ptrace,可以添加如下参数:

1
--cap-add=SYS_PTRACE

现在post格式的支持放在theme里,打开当前使用的theme的function.php,找到

1
2
3
4
5
6
7
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'status',
) );

在format列表里添加status即可。

如果编译CPP程序时出现类似如下的错误:

1
2
3
/usr/bin/locale:111:128: error: stray ‘\\21in program 
/usr/bin/locale:111:130: error: stray ‘\\3in program
/usr/bin/locale:111:136: error: stray ‘\\376in program

那是因为有代码包含了locale头文件:

1
#include <locale>

而编译时include搜索路径包含了/usr/bin,导致编译器找到了/usr/bin/locale这个二进制程序当做了locale头文件,所以有时候就是这么莫名其妙,include路径为什么要包含/usr/bin呢,这是错误的。

仔细的检查你的
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
等环境变量,还有编译指令的-I参数吧

我就是因为包含CPATH时写成了PATH,真无语了。