form1.cn
Make a little progress every day
18th of March 2020 Linux Nginx 3175

Nginx防止网站被CC攻击简单配置

Nginx0.7开始提供了2个限制用户连接的模块:NginxHttpLimitZoneModule和NginxHttpLimitReqModule。NginxHttpLimitZoneModule可以根据条件进行并发连接数控制。NginxHttpLimitZoneModule可以根据条件进行并发连接数控制(限制同时并发访问的数量):limit_conn_zone$binary_remote_addrzone=perip:50m;limit_c...
18th of March 2020 Linux Nginx 2477

用nginx中的$http_user_agent简单配置防爬虫

有些爬虫对服务器恶意获取网站信息,不遵守robots规则,我们需要进行拦截。可以禁止某些UserAgent抓取网站.如果对方真想爬你,他可以编写程序模拟真实浏览器信息,下面只是防一些工具类的在vhost中新建配置配置文件agent_deny.ngxfix#禁止Scrapy等工具的抓取if($http_user_agent~*(Scrapy|Curl|HttpClient)){...
18th of March 2020 Linux Nginx 1926

nginx日志格式设置与负载均衡下获取真实ip

日志格式设置:$remote_addr与$http_x_forwarded_for用以记录客户端的ip地址;$remote_user:用来记录客户端用户名称;$time_local:用来记录访问时间与时区;$request:用来记录请求的url与http协议;$status:用来记录请求状态;成功是200,$body_bytes_sent:记录发送给客户端文件主体内容大小;$http_ref...
17th of March 2020 Linux Command 1737

CentOS 7.0中iptables的安装与使用

iptables也叫netfilter,是Linux下自带的一款免费且优秀的基于包过滤的防火墙工具,他的功能十分强大,使用也非常灵活,可以对流入、流出、流经服务器的数据包进行精细的控制。但是iptables在CentOS7的版本上已经被阉割掉了,我们需要自行安装,以下是在CentOS7下安装iptables和使用方式。CentOS7.0默认使用...
29th of February 2020 Linux tensorflow 1394

matplotlib.pyplot的最基本使用

对于刚接触matpltlib的程序员,一般都只使用它的pyplot就够用了,下面是两个非常简单的例子importnumpyasnpimportmatplotlibasmplimportmatplotlib.pyplotaspltx=np.linspace(0,10,100)y=np.sin(x)cosy=np.cos(x)siny=y.copy()plt.scatter(x,cosy,color='red',linestyle='--',label='cos')plt.plot(x,siny,co...
16th of February 2020 Linux tensorflow 1523

numpy的基本使用方法整理

importnumpyasnp一、创建数组像python原生一样创建数组array=np.array([iforiinrange(10)])Out:array([0,1,2,3,4,5,6,7,8,9])全零数组np.zeros(10,dtype=int)Out:array([0,0,0,0,0,0,0,0,0,0])全1数组np.ones(10,dtype=int)Out:array([1,1,1,1,1,1,1,1,1,1])指定值数组np.full(10,23,dtype=float)Out:array...
19th of December 2019 Linux tensorflow 2789

anaconda简单使用与原理解释和tensorflow安装说明

一,安装Anaconda从官网下载:https://www.anaconda.com/download/官网下载起来很慢,可以用国内清华镜像网站:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/默认安装即可,两个复选框都选中,点next继续二,conda常用命令conda--version查看conda版本conda--help获取帮助condaupdate--helpcondar...
17th of December 2019 Linux Command 2777

Linux\CentOS中auditd安全审计工具的使用

介绍Auditd工具可以帮助运维人员审计Linux。这个工具在大多数Linux操作系统中是默认安装的,是Linux审计系统中用户空间的一个组件,其负责将审计记录写入磁盘。安装$apt-getinstallauditdor$yum-yinstallauditauditd-libs相关命令auditctl:即时控制审计守护进程的行为的工具,比如如添加规则等等$sudoauditct...
17th of December 2019 Linux Command 2027

fail2ban的使用以及防暴力破解

yum安装:yuminstallfail2banfail2ban的配置文件路径:/etc/fail2banfail2ban安装目录:/usr/share/fail2ban日志文件:/var/log/fail2ban.log达到阈值之后的执行的动作的配置文件:action.d/包含所有的过滤规则:filter.d/2.配置fail2ban并实现防暴力破解官方的文档写到:在配置时,我们应该避免修改由fail2b...
17th of December 2019 Linux Command 2623

centos7 设置复杂用户密码策略

密码有效期控制在文件/etc/login.defs中进行设置,如下参数PASS_MAX_DAYS180#密码最长过期天数PASS_MIN_DAYS30#密码最小过期天数PASS_MIN_LEN12#密码最小长度PASS_WARN_AGE20#密码过期警告天数设置最小密码长度:(不少于8个字符)authconfig--passminlen=8--update测试查看是否更新成功:grep"^minlen"/etc/...
17th of December 2019 Linux Command 2080

CentOS 7.3 允许或禁止root用户远程登录

vim/etc/ssh/sshd_config,将PermitRootLogin的值改成yes,并保存PermitRootLoginyesservicesshdrestart这样,就能用root直接ssh登录了将PermitRootLogin的值设成no,就不能用root直接ssh登录了
17th of December 2019 Linux Command 1781

userdel删除用户时候提示:userdel: user xx is currently log..

使用userdelxx删除,结果出现userdel:userxxiscurrentlyloggedin的提示,其结果是无法删除,其实在回去看一下用户已经被删除了可以使用sudouserdel-r-fxx加两个参数,给他强制删除,之后可能出现警告:userdel:warning:can'tremove/var/mail/www:Nosuchfileordirectoryuserdel:wxthomedirectory(/home/www)no...
19th of November 2019 Linux tensorflow 3307

启动Tensorboard时报错:AttributeError: module 'tensorflow...

启动Tensorboard时报错:classBeholderHook(tf.estimator.SessionRunHook):AttributeError:module‘tensorflow.python.estimator.estimator_lib’hasnoattribute‘SessionRunHook’解决办法:是因为版本不对应首先,检查下tensorboard的安装版本:piplist--format=columnstensorboard(1.13.0)tensorflow(1.4....
15th of November 2019 Linux tensorflow 1792

解决:Your CPU supports instructions that this TensorFlow ..

在执行python程序的时候,报YourCPUsupportsinstructionsthatthisTensorFlowbinarywasnotcompiledtouse:AVX2FMA的警告。大概意思是:你的CPU支持AVX扩展,但是你安装的TensorFlow版本无法编译使用。解决方法:第一种屏蔽如果安装的是GPU版本如果你有一个GPU,你不应该关心AVX的支持,因为大多数昂贵的操作将被...
15th of November 2019 Linux tensorflow 1360

同步课程安装python一些用到的类库

1,安装pipinstallnumpyNumPy(NumericalPython)是Python语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。NumPy是一个运行速度非常快的数学库,主要用于数组计算,包含:一个强大的N维数组对象ndarray广播功能函数整合C/C++/Fortran代码的工具线性代数、傅里叶...
15th of November 2019 Linux tensorflow 2622

升级pip后报错:File /usr/bin/pip line 9

#需要最新的pip来安装tensorflow2pipinstall--upgradepipCollectingpipUsingcachedhttps://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whlInstallingcollectedpackages:pipFoundexistinginstallation:pip9.0.1Notuni...
15th of November 2019 Linux tensorflow 1488

ubuntu 16.04 64位 虚拟环境与本地安装tensorflow

一,虚拟环境安装tensorflow1,更新源apt-getupdate2,安装python3或python2.7和pipdevpython3安装:sudoaptinstallpython3sudoaptinstallpython3-pipsudoaptinstallpython3-devsudoaptinstallpython3-tk#图形化库python2安装:sudoaptinstallpythonsudoaptinstallpython-pipsudoaptinstallpython-devsudoapt...
24th of September 2019 Linux Nginx 1563

lnmp环境开启opcache提高性能

开启opcache性能提高10倍已lnmp.org站点下载的lnmp包为例:#开启opcache进入lnmp解压后的目录cd/home/lnmp1.4执行sudo./addons.shinstallopcache#配置opcache/usr/local/php/etc/php.ini#按照服务器性能配置如下参数[opcache];开关打开opcache.enable=1;开启CLIopcache.enable_cli=1;可用内存,酌情而定,单位...
13th of June 2019 Linux Nginx 1850

当linux服务器升级后nginx与php-fpm改配问题

服务器中前期开发使用的是2核4G的服务器,后面用户增加后需要升级为4核8G服务器,在升级服务器后需要对之前的2核4G安装的nginx和PHP做一个配置上的改变:nignx-worker进程改动:Nginx有Master和worker两种进程,Master进程用于管理worker进程,worker进程用于Nginx服务worker进程数应该设置为等于CPU的核数,...
12th of June 2019 Linux GIT 2196

Ubuntu搭建GitLab与汉化

简介GitLab社区版可以提供许多与GitHub相同的功能,且部署在属于自己的机器上,我们会因为网络及其他一些问题而不便使用GitHub,这时部署一个GitLab是最好的选择。下载GitLab并安装我的环境是Ubuntu16.04下进行部署操作。GitLab下载地址:https://about.gitlab.com/downloads/#ubuntu1604其他版本请自行选择...
25th of April 2019 Linux Nginx 1697

nginx的http和https 301跳转

HTTP301跳转到带www域名方法server{listen80;server_nameexample.org;return301http://www.example.org$request_uri;}server{listen80;server_namewww.example.org;...}HTTPS301跳转到带www域名方法server{listen80;server_namewww.domain.com;//$schemewillgetthehttpprotocol//and301isbestpracticefortabl...
03th of April 2019 Linux GIT 2017

CentOS下升级Git1.7.1升级到Git2.2.1

卸载CentOS自带的Git通过git–-version查看系统带的版本,Cento6.5自带的是git版本是1.7.1yumremovegit安装前环境配置$yuminstall-ycurl-develexpat-develgettext-developenssl-develzlib-develasciidocxmltoperl-develperl-CPANautoconf*下载git2.2.1并将git添加到环境变量中>#wgethttps://github.com/git/g...
03th of April 2019 Linux Command 6142

electron安装运行打包且打安装包

1,当然是安装node.js,这个不多说,在node.js中文官网下载安装即可2,安装cnpm,众所周知,你需要一个cnpm代替npm#npminstall-gcnpm--registry=https://registry.npm.taobao.org全局安装并切换源为taobao3,安装Electron#cnpminstall-gelectron4,安装electron-packager,后面打包用的#cnpminstall-gelectro...
09th of January 2019 Linux GIT 1831

GIT创建、合并、使用分支

Git分支十分强大,在团队开发中应该充分应用。master分支应该是非常稳定的,也就是仅用来发布新版本,平时不能在上面干活。那在哪干活呢?干活都在dev分支上,也就是说,dev分支是不稳定的,到某个时候,比如1.0版本发布时,再把dev分支合并到master上,在master分支发布1.0版本;你和你的小伙伴们每个人都在...
28th of December 2018 Linux Command 1839

screen命令的常见用法

GNUScreen是一款由GNU计划开发的用于命令行终端切换的自由软件。用户可以通过该软件同时连接多个本地或远程的命令行会话,并在其间自由切换。GNUScreen可以看作是窗口管理器的命令行界面版本。它提供了统一的管理多个会话的界面和相应的功能。可以使用Linux下的screen命令,即使网络连接中断,用户也不会失去...
28th of December 2018 Linux Command 1935

elasticsearch安装与遇到到问题

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTfulweb接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。0,安装java的JDK...
28th of December 2018 Linux Command 2011

linux中ulimit限制打开的文件数量

以限制打开文件数为例。ulimit-Hn查看硬限制。ulimit-Sn查看软限制。ulimit-n查看两个中更小的限制(软限制始终比硬限制低,所以查看的是软限制)设定规则1、软限制不能超过硬限制2、硬限制只能减少,不能增加。而软限制可以增加任何不满足上述两条设定规则的设定都会报错。最初的限制在/etc/security/limits.c...
21th of December 2018 Linux Command 2020

supervisor的安装与使用

简介supervisor是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具。可以很方便的监听、启动、停止、重启一个或多个进程。用supervisor管理的进程,当一个进程意外被杀死,supervisor监听到进程死后,会自动将它重启,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来...
22th of November 2018 Linux Command 10104

ubuntu中搭建USDT钱包同步节点说明

usdt是基于omni发的token,omni是比特币的侧链,所有omni实际上跟BTC是同一条链,可以吧omni上面的币理解为BTC的token,usdt就是众多token种的一个。那么,我们要测试usdt转账,就需要BTC资产,因为token转账是消耗BTC的。USDT的转账实际上是代号为31的OmniCore令牌转账。Omnicore提供了多套api实现令牌转账功...
22th of November 2018 Linux Command 4052

apt-get update Reading package lists... Done

apt-getupdate说“读取包列表......完成”,然后结束该过程我在我的笔记本电脑(32位)中重新安装了Ubuntu14.04,因为我无法更新系统,不幸的是问题仍然存在。基本上当我输入时sudoapt-getupdate,系统搜索源并在获取它们之后只是说:“读取包列表......完成”然后结束该过程。我曾经看到不同的消息,如“建...