“Linux”的版本间的差异
跳到导航
跳到搜索
(→工具) |
|||
(未显示1个用户的9个中间版本) | |||
第7行: | 第7行: | ||
* [[https://geoff.greer.fm/ag/ ag]] The Silver Searcher代码搜索工具 | * [[https://geoff.greer.fm/ag/ ag]] The Silver Searcher代码搜索工具 | ||
* [[https://github.com/yaosonglive/vim .vimrc]] vim制表符换成控制配置 | * [[https://github.com/yaosonglive/vim .vimrc]] vim制表符换成控制配置 | ||
− | + | * aview 从图片生成 ASCII 字符画,命令:asciiview | |
+ | ** $ sudo apt install aview | ||
+ | ** $ sudo apt install imagemagick | ||
== Nginx == | == Nginx == | ||
* [[Nginx灰度]] cookie实现灰度 | * [[Nginx灰度]] cookie实现灰度 | ||
+ | * 常见错误 | ||
+ | ** 413 Request Entity Too Large | ||
+ | **: <code>client_max_body_size 8m;</code> | ||
+ | |||
+ | == 图片压缩 == | ||
+ | 使用imagemagick进行图片压缩 | ||
+ | 首先安装apt install imagemagick | ||
+ | |||
+ | 下面是demo,把再当前路径下的public目录中的图片进行压缩: | ||
+ | <nowiki> | ||
+ | import os | ||
+ | |||
+ | arr = [ | ||
+ | '/upload/images/c0d0d881b2d742165999d91ec6380de2.jpg', | ||
+ | '/upload/images/4e16982954bcbe89667ec70f67c02f20.jpg', | ||
+ | ] | ||
+ | |||
+ | for i in arr: | ||
+ | try: | ||
+ | # print i | ||
+ | kb = os.path.getsize('./public%s' % i) | ||
+ | newNames = os.path.splitext(i) | ||
+ | strname = '%s_s%s' % newNames | ||
+ | if kb/1024 > 1: | ||
+ | shell = "convert -sample 30%%x30%% ./public%s ./public%s" % (i, strname) | ||
+ | os.system(shell) | ||
+ | # print "update themes set preview='%s' where preview='%s';" % (strname, i) | ||
+ | except Exception,e : | ||
+ | print e | ||
+ | pass | ||
+ | |||
+ | </nowiki> | ||
+ | -resize 是缩小,-sample 是压缩 | ||
== 其他 == | == 其他 == | ||
* [[公钥]] | * [[公钥]] | ||
+ | * 终端不能输入中文 | ||
+ | *# 先<code>locale -a</code>查看,是否有<code>zh_CN.utf8</code> | ||
+ | *# 如果没有,安装: | ||
+ | *#: centos: yum install glibc-common | ||
+ | *#: ubuntu: apt-get -y install language-pack-zh-hans | ||
+ | *# 重新进入终端,检查环境变量, 如果还是不行,修改环境变量: | ||
+ | *#* LANG=zh_CN.UTF-8 | ||
+ | *#* LC_ALL=LC_ALL=zh_CN.UTF-8 | ||
== 端口检测 == | == 端口检测 == | ||
第42行: | 第85行: | ||
<nowiki> | <nowiki> | ||
sudo netstat --all --numeric --tcp --programs</nowiki> | sudo netstat --all --numeric --tcp --programs</nowiki> | ||
+ | |||
+ | |||
+ | |||
+ | == nginx fpm connect() to unix:xxx failed. http 502 == | ||
+ | https://forum.nginx.org/read.php?11,215606,215606#msg-215606 | ||
+ | |||
+ | 1)调高nginx和php-fpm中的backlog | ||
+ | |||
+ | 2)增加sock文件和php-fpm实例数 | ||
+ | |||
+ | |||
+ | pm | ||
+ | |||
+ | pm.max_children | ||
+ | |||
+ | |||
+ | listen.backlog = 4096 | ||
+ | |||
+ | * nginx | ||
+ | |||
+ | <nowiki> | ||
+ | server { | ||
+ | listen 80 backlog=1024; | ||
+ | ... ... | ||
+ | } | ||
+ | </nowiki> | ||
+ | |||
+ | 开多个fpm | ||
+ | |||
+ | == 终端中文输入 == | ||
+ | * ubuntu | ||
+ | locale-gen zh_CN.UTF-8 | ||
+ | |||
+ | dpkg-reconfigure locales | ||
+ | |||
+ | |||
+ | == ubuntu 阿里云源 == | ||
+ | ubuntu 18.04 (bionic) 配置 opsx 安装源 | ||
+ | https://opsx.alibaba.com/guide?lang=zh-CN&document=69a2341e-801e-11e8-8b5a-00163e04cdbb |
2019年12月5日 (四) 21:22的最新版本
目录
工具
- [jq] 一个轻量级且灵活的命令行JSON处理器
- [ag] The Silver Searcher代码搜索工具
- [.vimrc] vim制表符换成控制配置
- aview 从图片生成 ASCII 字符画,命令:asciiview
- $ sudo apt install aview
- $ sudo apt install imagemagick
Nginx
- Nginx灰度 cookie实现灰度
- 常见错误
- 413 Request Entity Too Large
client_max_body_size 8m;
- 413 Request Entity Too Large
图片压缩
使用imagemagick进行图片压缩 首先安装apt install imagemagick
下面是demo,把再当前路径下的public目录中的图片进行压缩:
import os arr = [ '/upload/images/c0d0d881b2d742165999d91ec6380de2.jpg', '/upload/images/4e16982954bcbe89667ec70f67c02f20.jpg', ] for i in arr: try: # print i kb = os.path.getsize('./public%s' % i) newNames = os.path.splitext(i) strname = '%s_s%s' % newNames if kb/1024 > 1: shell = "convert -sample 30%%x30%% ./public%s ./public%s" % (i, strname) os.system(shell) # print "update themes set preview='%s' where preview='%s';" % (strname, i) except Exception,e : print e pass
-resize 是缩小,-sample 是压缩
其他
- 终端不能输入中文
- 先
locale -a
查看,是否有zh_CN.utf8
- 如果没有,安装:
- centos: yum install glibc-common
- ubuntu: apt-get -y install language-pack-zh-hans
- 重新进入终端,检查环境变量, 如果还是不行,修改环境变量:
- LANG=zh_CN.UTF-8
- LC_ALL=LC_ALL=zh_CN.UTF-8
- 先
端口检测
- telnet
- 在telnet连接成功后,使用
Control +]
然后使用Control + D
退出它。 - 列出所有TCP连接套接字
telnet localhost 80
- lsof
- 监听ipv4进程
sudo lsof -n -i4TCP:5672 | grep LISTEN
- IPv6的程序:
sudo lsof -n -i6TCP:5672 | grep LISTEN
- ss
- 使用ss显示使用IPv4及其操作系统进程的侦听TCP套接字:
sudo ss --tcp -f inet --listening --numeric --processes
- 同样,对于使用IPv6的TCP套接字:
sudo ss --tcp -f inet6 --listening --numeric --processes
- netstat
sudo netstat --all --numeric --tcp --programs
nginx fpm connect() to unix:xxx failed. http 502
https://forum.nginx.org/read.php?11,215606,215606#msg-215606
1)调高nginx和php-fpm中的backlog
2)增加sock文件和php-fpm实例数
pm
pm.max_children
listen.backlog = 4096
- nginx
server { listen 80 backlog=1024; ... ... }
开多个fpm
终端中文输入
- ubuntu
locale-gen zh_CN.UTF-8
dpkg-reconfigure locales
ubuntu 阿里云源
ubuntu 18.04 (bionic) 配置 opsx 安装源 https://opsx.alibaba.com/guide?lang=zh-CN&document=69a2341e-801e-11e8-8b5a-00163e04cdbb