275篇 Default中的文章

德国computeruniverse优惠码

德国computeruniverse网上商城成立于1999年9月2日,主要销售各种电子产品、小家电、照相机、游戏机、手机等,支持直邮中国,运费低至27欧元,而且自动退税19%!海淘brita滤水壶、Severin斯维林酸奶机、BEURER IH 50雾化器、Unold面包机、Sanitas SBM 血压器、beurer空气净化器、dyson吸尘器、博雅Beurer IL50远红外线治疗仪等的好地方!如果您第一次在computeruniverse海淘,使用新人优惠码FWWMFRL3还可以享受5欧元的优惠。
新人5欧元优惠码:FWWMFRL3

https://www.computeruniverse.net/

More ~

nginx加上basic auth验证

创建密码文件

htpasswd -c -d  htpasswd -c -d /etc/nginx/conf.d/passwd username

在nginx配置文件中加上:

auth_basic "validate required";
auth_basic_user_file /etc/nginx/conf.d/passwd;

重启nginx服务即可

More ~

centos 配置dhcp简记

yum -y install dhcp

配置文件:/etc/dhcp/dhcpd.conf

示例配置文件:/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example

default-lease-time 7200;
max-lease-time 14400;
subnet 10.1.119.0 netmask 255.255.255.0 {
  option routers 10.1.119.128;
  option domain-name-servers 10.1.102.2;
  range 10.1.119.200 10.1.119.220;
}
More ~

SS的PAC规则

参考 https://help.eyeo.com/en/adblockplus/how-to-write-filters

  1. 通配符支持,如 *.example.com/* 实际书写时可省略 * 如 .example.com/ 意即 *.example.com/*
  2. 正则表达式支持,以\开始和结束, 如 \[\w]+:\/\/example.com\
  3. 例外规则 @@,如 @@*.example.com/* 满足@@后规则的地址不使用代理
  4. 匹配地址开始和结尾 |,如 |http://example.comexample.com| 分别表示以 http://example.com 开始和以 example.com 结束的地址
  5. || 标记,如 ||example.com 则 http://example.com 、https://example.com 、ftp://example.com 等地址均满足条件,只用于匹配地址开头
  6. 注释 ! 如 ! Comment
  7. 分隔符^,表示除了字母、数字或者 _ - . % 之外的任何字符。如 http://example.com^ ,http://example.com/ 和 http://example.com:8000/ 均满足条件,而 http://example.com.ar/ 不满足条件
More ~

ubuntu: Read-only file system

文件系统挂了,变成只读模式。supervisor无法启动,就连ping 域名时无法解析dns,想要修改/etc/resolve.conf,只读也写不进去。
试下往临时目录写也是这:

touch /tmp/aaa.txt
touch: cannot touch '/tmp/aaa.txt': Read-only file system
More ~

CRLF to LF

You can use vim programmatically with the option -c {command} :

Dos to Unix:

vim file.txt -c "set ff=unix" -c ":wq"

Unix to dos:

vim file.txt -c "set ff=dos" -c ":wq"

"set ff=unix/dos" means change fileformat (ff) of the file to Unix/DOS end of line format

":wq" means write file to disk and quit the editor (allowing to use the command in a loop)

More ~

git 找回已删除的文件

找出已删除文件的提交记录:

git rev-list -n 1 HEAD -- <file_path>

返回为commit id

使用提交记录ID检出文件, commit id后缀**^**:

git checkout <commit id>^ -- <file_path>

或者一行命令:

$file 是文件路径

git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"
More ~