首页 文章 精选 留言 我的

精选列表

搜索[Bot管理],共10000篇文章
优秀的个人博客,低调大师

第 2 章 Python 包管理

目录 2.1. setup.py 2.2. distribute 2.3. pip - A tool for installing and managing Python packages 2.3.1. 安装 pip 2.3.1.1. 使用 easy_install 安装 pip 2.3.1.2. Ubuntu 安装 pip 2.3.1.3. Mac 2.3.2. pip 命令 2.1.setup.py http://docs.python.org/3/install/index.html http://docs.python.org/3/distutils/index.html 创建 setup.py 如下: # cat setup.py from distutils.core import setup setup ( name = 'firewall', version = '1.0.0', py_modules = ['firewall'], author = 'neo.chen', author_email = 'netkiller@msn.com', description = 'Module firewall', url='http://netkiller.github.io/', ) 注意:name和py_modules这两个参数一定要与firewall.py文件名相同,否则发布安装时会发出模块文件找不到的错误. 打包操作 # python setup.py sdist running sdist warning: sdist: missing required meta-data: url warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard file not found: should have one of README, README.txt writing manifest file 'MANIFEST' creating firewall-1.0.0 making hard links in firewall-1.0.0... hard linking firewall.py -> firewall-1.0.0 hard linking setup.py -> firewall-1.0.0 creating dist tar -cf dist/firewall-1.0.0.tar firewall-1.0.0 gzip -f9 dist/firewall-1.0.0.tar tar -cf dist/firewall-1.0.0.tar firewall-1.0.0 gzip -f9 dist/firewall-1.0.0.tar removing 'firewall-1.0.0' (and everything under it) sdist 生成的文件 # ll dist/ total 4 -rw-r--r--. 1 root root 2123 Aug 9 12:41 firewall-1.0.0.tar.gz 安装包 # python setup.py install running install running build running build_py creating build creating build/lib copying firewall.py -> build/lib running install_lib copying build/lib/firewall.py -> /usr/lib/python2.6/site-packages byte-compiling /usr/lib/python2.6/site-packages/firewall.py to firewall.pyc running install_egg_info Writing /usr/lib/python2.6/site-packages/firewall-1.0.0-py2.6.egg-info 安装后 # ll /usr/lib/python2.6/site-packages/firewall* -rw-r--r--. 1 root root 201 Aug 9 12:42 /usr/lib/python2.6/site-packages/firewall-1.0.0-py2.6.egg-info -rw-r--r--. 1 root root 6145 Aug 9 11:28 /usr/lib/python2.6/site-packages/firewall.py -rw-r--r--. 1 root root 11858 Aug 9 12:42 /usr/lib/python2.6/site-packages/firewall.pyc 原文出处:Netkiller 系列 手札 本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

优秀的个人博客,低调大师

Linux权限管理命令chown、chgrp

一、chown命令与chgrp命令的作用 有时你需要改变文件或目录的属主,比如有人离职或开发人员创建了一个在测试或生产环境中需要归属在系统账户下的应用。Linux提供了两个命令来实现这个功能:chown命令用来改变文件的属主,chgrp命令用来改变文件的默认属组。 二、chown命令与chgrp命令的语法 chown命令语法:chown owner file chgrp命令语法:chgrp group file owner:指定的所属者或UID,也就是新的所属者。 group:指定的所属组,也就是新的所属组。 file:指定的文件或目录。 三、效果演示 在temp目录下创建55555.txt文件,然后查看该文件的默认所属者和所属组,Linux命令如下,效果如图3-1所示。 1 touch 55555.txt 2 ls -l 55555.txt 图 3-1 从图3-1可以看出,55555.txt文件的默认所属者和所属组都是centos,接下来要改变55555.txt文件的所属者和所属组,但是当前登录用户必须要有权限改变 文件的所属者与所属组,所以切换root用户来改变。 首先改变55555.txt文件所属者,Linux命令如下,效果如图3-2所示。 1 chown jsg 55555.txt 图 3-2 再者改变55555.txt文件的所属组,Linux命令如下,效果如图3-3所示。 1 chgrp lj 55555.txt 图 3-3 最后,改变目录的所属者和所属组亦是如此。

优秀的个人博客,低调大师

中文分词插件管理

8.6.1.通过 elasticsearch-plugin 命令安装分词插件 root@netkiller ~ % /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.5.1/elasticsearch-analysis-ik-5.5.1.zip -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.5.1/elasticsearch-analysis-ik-5.5.1.zip [=================================================] 100% -> Installed analysis-ik 创建 mapping root@netkiller ~ % curl -XPUT http://localhost:9200/information root@netkiller ~ % curl -XPOST http://localhost:9200/information/article/_mapping -d' { "properties": { "content": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" }, "title": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } } }' root@netkiller ~ % curl "http://localhost:9200/information/article/_mapping?pretty" { "information" : { "mappings" : { "article" : { "properties" : { "content" : { "type" : "text", "analyzer" : "ik_max_word" }, "title" : { "type" : "text", "analyzer" : "ik_max_word" } } } } } } 8.6.2.手工安装插件 curl -s https://raw.githubusercontent.com/oscm/shell/master/search/elasticsearch/elasticsearch-analysis-ik-5.5.0.sh | bash 8.6.3.创建索引 curl -XPUT http://localhost:9200/information 8.6.4.删除索引 如果索引已经存在请删除后重新创建索引 curl -XDELETE http://localhost:9200/information/news/_mapping?pretty curl -XDELETE http://localhost:9200/information/?pretty 8.6.5.配置索引分词插件 curl -XPOST http://localhost:9200/information/news/_mapping?pretty -d' { "news": { "_all": { "analyzer": "ik_max_word", "search_analyzer": "ik_max_word", "term_vector": "no", "store": "false" }, "properties": { "content": { "type": "text", "store": "no", "term_vector": "with_positions_offsets", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word", "include_in_all": "true", "boost": 8 } } } }' 8.6.5.1.测试分词效果 curl -XPOST http://localhost:9200/information/news/ -d' {"title": "越南胡志明游记·教堂·管风琴的天籁之音","content":"这是我平生第一次去教堂,也是第一次完整的参加宗教仪式。当我驻足教堂外的时候,耳边传来天籁之音,是管风琴,确切的说是电子风琴。真正的管风琴造价昂贵,管风琴通常需要根据教堂尺寸定制,无法量产。我记得中国只有4座管风琴,深圳音乐厅有一座。"} ' curl -XPOST http://localhost:9200/information/news/ -d' {"title": "越南胡志明游记·信仰·法事","content":"佛经的形成过程是与佛教的发展相始终的,按照佛教发展的时间顺序,最早形成的是小乘佛教三藏,之后形成的是大乘佛教三藏,最后形成的是密宗三藏。"} ' curl -XPOST http://localhost:9200/information/news/_search -d' { "query" : { "term" : { "content" : "佛经" }}, "highlight" : { "pre_tags" : ["<strong>", "<strong>"], "post_tags" : ["</strong>", "</strong>"], "fields" : { "content" : {} } } }' curl -XPOST http://localhost:9200/information/news/_search -d' { "query" : { "term" : { "content" : "中国" }}, "highlight" : { "pre_tags" : ["<b>", "<i>"], "post_tags" : ["</b>", "</i>"], "fields" : { "content" : {} } } }' 原文出处:Netkiller 系列 手札 本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

优秀的个人博客,低调大师

docker管理神器—kubernetes—pod篇

前面介绍了pod是个容器组,那么现在就来创建一个pod,就像dockerfile一样。 vi nginx-pod.yaml(要十分注意空格,一般为两个空格) 添加: apiVersion: v1 kind: Pod metadata: name: nginx1 spec: containers: - name: nginx1 image: docker.io/nginx ports: - containerPort: 9001 启动Pod kubectl create -fnginx-pod.yaml 使用get pods查看 kubectl describe pods nginx 在minion端查看: docker ps(它会首先启动一个pod-infrastructure容器,然后在本机找是否有nginx镜像,没有就去下载) 更多具体的详细的关于pod与yaml的编写和创建建议去google上查阅资料。 本文转自 sykmiao 51CTO博客,原文链接:http://blog.51cto.com/syklinux/1860292,如需转载请自行联系原作者

优秀的个人博客,低调大师

Tomcat添加管理员role

最近朋友问我怎么在Tomcat里面使用 admin 登录,一般情况下登录后是提示xxx的,经过百度后,好不容易才找到答案: 原来添加一个role为admin:<role rolename="admin"/> 然后设置用户admin为admin role,当然你也可以设置用户是admin role: <?xmlversion='1.0'encoding='utf-8'?> <tomcat-users> <rolerolename="manager"/> <rolerolename="admin"/> <userusername="user"password="123456"roles="admin,manager"/> <userusername="admin"password="admin"roles="admin,manager"/> </tomcat-users> 本文转自 Icansoft 51CTO博客,原文链接: http://blog.51cto.com/android/56376

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册