首页 文章 精选 留言 我的

精选列表

搜索[向量库],共10000篇文章
优秀的个人博客,低调大师

那些有趣/用的Python库

图片处理 pipinstallpillow fromPILimportImage importnumpyasnp a=np.array(Image.open('test.jpg')) b=[255,255,255]-a im=Image.fromarray(b.astype('uint8')) im.save('new.jpg') youtube-dl下载国外视频 pipinstallyoutube-dl#直接安装youtube-dl pipinstall-Uyoutube-dl#安装youtube-dl并更新 youtube-dl"http://www.youtube.com/watch?v=-wNyEUrxzFU" 查看对象的全部属性和方法 pipinstallpdir2 >>>importpdir,requests >>>pdir(requests) moduleattribute: __cached__,__file__,__loader__,__name__,__package__,__path__,__spec__ other: __author__,__build__,__builtins__,__copyright__,__license__,__title__, __version__,_internal_utils,adapters,api,auth,certs,codes,compat,cookies ,exceptions,hooks,logging,models,packages,pyopenssl,sessions,status_code s,structures,utils,warnings specialattribute: __doc__ class: NullHandler:Thishandlerdoesnothing.It'sintendedtobeusedtoavoidth e PreparedRequest:Thefullymutable:class:`PreparedRequest<PreparedRequest> `object, Request:Auser-created:class:`Request<Request>`object. Response:The:class:`Response<Response>`object,whichcontainsa Session:ARequestssession. exception: ConnectTimeout:Therequesttimedoutwhiletryingtoconnecttotheremote server. ConnectionError:AConnectionerroroccurred. DependencyWarning:Warnedwhenanattemptismadetoimportamodulewithmi ssingoptional FileModeWarning:Afilewasopenedintextmode,butRequestsdeterminedits binarylength. HTTPError:AnHTTPerroroccurred. ReadTimeout:Theserverdidnotsendanydataintheallottedamountoftime . RequestException:Therewasanambiguousexceptionthatoccurredwhilehandl ingyour Timeout:Therequesttimedout. TooManyRedirects:Toomanyredirects. URLRequired:AvalidURLisrequiredtomakearequest. function: delete:SendsaDELETErequest. get:SendsaGETrequest. head:SendsaHEADrequest. options:SendsaOPTIONSrequest. patch:SendsaPATCHrequest. post:SendsaPOSTrequest. put:SendsaPUTrequest. request:Constructsandsendsa:class:`Request<Request>`. session:Returnsa:class:`Session`forcontext-management. Python 玩转网易云音乐 pipinstallncmbot importncmbot #登录 bot=ncmbot.login(phone='xxx',password='yyy') bot.content#bot.json() #获取用户歌单 ncmbot.user_play_list(uid='36554272') 下载视频字幕 pipinstallgetsub Python 财经数据接口包 pipinstalltushare importtushareasts #一次性获取最近一个日交易日所有股票的交易数据 ts.get_today_all() 代码,名称,涨跌幅,现价,开盘价,最高价,最低价,最日收盘价,成交量,换手率 codenamechangepercenttradeopenhighlowsettlement\ 0002738中矿资源10.02319.3219.3219.3219.3217.56 1300410正业科技10.02225.0325.0325.0325.0322.75 2002736国信证券10.01316.3716.3716.3716.3714.88 3300412迦南科技10.01031.5431.5431.5431.5428.67 4300411金盾股份10.00729.6829.6829.6829.6826.98 5603636南威软件10.00638.1538.1538.1538.1534.68 6002664信质电机10.00430.6829.0030.6828.3027.89 7300367东方网力10.00486.7678.0086.7677.8778.87 8601299中国北车10.00011.4411.4411.4411.2910.40 9601880大连港10.0005.725.345.725.225.20 10000856冀东装备10.0008.918.188.918.188.10 开源漏洞靶场 #安装pip curl-shttps://bootstrap.pypa.io/get-pip.py|python3 #安装docker apt-getupdate&&apt-getinstalldocker.io #启动docker服务 servicedockerstart #安装compose pipinstalldocker-compose #拉取项目 gitclonegit@github.com:phith0n/vulhub.git cdvulhub #进入某一个漏洞/环境的目录 cdnginx_php5_mysql #自动化编译环境 docker-composebuild #启动整个环境 docker-composeup-d #测试完成后,删除整个环境 docker-composedown 北京实时公交 pipinstall-rrequirements.txt安装依赖 pythonmanage.pybuild_cache获取离线数据,建立本地缓存 #项目自带了一个终端中的查询工具作为例子,运行:pythonmanage.pycli >>>frombeijing_busimportBeijingBus >>>lines=BeijingBus.get_all_lines() >>>lines [<Line:运通122(农业展览馆-华纺易城公交场站)>,<Line:运通101(广顺南大街北口-蓝龙家园)>,...] >>>lines=BeijingBus.search_lines('847') >>>lines [<Line:847(马甸桥西-雷庄村)>,<Line:847(雷庄村-马甸桥西)>] >>>line=lines[0] >>>printline.id,line.name 541847(马甸桥西-雷庄村) >>>line.stations [<Station马甸桥西>,<Station马甸桥东>,<Station安华桥西>,...] >>>station=line.stations[0] >>>printstation.name,station.lat,station.lon 马甸桥西39.967721116.372921 >>>line.get_realtime_data(1)#参数为站点的序号,从1开始 [ { 'id':公交车id, 'lat':公交车的位置, 'lon':公交车位置, 'next_station_name':下一站的名字, 'next_station_num':下一站的序号, 'next_station_distance':离下一站的距离, 'next_station_arriving_time':预计到达下一站的时间, 'station_distance':离本站的距离, 'station_arriving_time':预计到达本站的时间, }, ... ] 文章提取器 gitclonehttps://github.com/grangier/python-goose.git cdpython-goose pipinstall-rrequirements.txt pythonsetup.pyinstall >>>fromgooseimportGoose >>>fromgoose.textimportStopWordsChinese >>>url='http://www.bbc.co.uk/zhongwen/simp/chinese_news/2012/12/121210_hongkong_politics.shtml' >>>g=Goose({'stopwords_class':StopWordsChinese}) >>>article=g.extract(url=url) >>>printarticle.cleaned_text[:150] 香港行政长官梁振英在各方压力下就其大宅的违章建筑(僭建)问题到立法会接受质询,并向香港民众道歉。 梁振英在星期二(12月10日)的答问大会开始之际在其演说中道歉,但强调他在违章建筑问题上没有隐瞒的意图和动机。 一些亲北京阵营议员欢迎梁振英道歉,且认为应能获得香港民众接受,但这些议员也质问梁振英有 Python 艺术二维码生成器 pipinstallMyQR myqrhttps://github.com myqrhttps://github.com-v10-lQ 伪装浏览器身份 pipinstallfake-useragent fromfake_useragentimportUserAgent ua=UserAgent() ua.ie #Mozilla/5.0(Windows;U;MSIE9.0;WindowsNT9.0;en-US); ua.msie #Mozilla/5.0(compatible;MSIE10.0;Macintosh;IntelMacOSX10_7_3;Trident/6.0)' ua['InternetExplorer'] #Mozilla/5.0(compatible;MSIE8.0;WindowsNT6.1;Trident/4.0;GTB7.4;InfoPath.2;SV1;.NETCLR3.3.69573;WOW64;en-US) ua.opera #Opera/9.80(X11;Linuxi686;U;ru)Presto/2.8.131Version/11.11 ua.chrome #Mozilla/5.0(WindowsNT6.1)AppleWebKit/537.2(KHTML,likeGecko)Chrome/22.0.1216.0Safari/537.2' 美化 curl pipinstallhttpstat httpstathttpbin.org/get pythonshell pipinstallsh fromshimportifconfig printifconfig("eth0") 处理中文文本内容 pipinstall-Utextblob#英文文本的情感分析 pipinstallsnownlp#中文文本的情感分析 fromsnownlpimportSnowNLP text="Iamhappytoday.Ifeelsadtoday." fromtextblobimportTextBlob blob=TextBlob(text) TextBlob("Iamhappytoday.Ifeelsadtoday.") blob.sentiment Sentiment(polarity=0.15000000000000002,subjectivity=1.0) s=SnowNLP(u'这个东西真心很赞') s.words#[u'这个',u'东西',u'真心', #u'很',u'赞'] s.tags#[(u'这个',u'r'),(u'东西',u'n'), #(u'真心',u'd'),(u'很',u'd'), #(u'赞',u'Vg')] s.sentiments#0.9769663402895832positive的概率 s.pinyin#[u'zhe',u'ge',u'dong',u'xi', #u'zhen',u'xin',u'hen',u'zan'] s=SnowNLP(u'「繁體字」「繁體中文」的叫法在臺灣亦很常見。') s.han#u'「繁体字」「繁体中文」的叫法 #在台湾亦很常见。 抓取发放代理 pipinstall-Ugetproxy ~getproxy--help Usage:getproxy[OPTIONS] Options: --in-proxyTEXTInputproxyfile --out-proxyTEXTOutputproxyfile --helpShowthismessageandexit. --in-proxy 可选参数,待验证的 proxies 列表文件 --out-proxy 可选参数,输出已验证的 proxies 列表文件,如果为空,则直接输出到终端 --in-proxy 文件格式和 --out-proxy 文件格式一致 zhihu api pipinstallgit+git://github.com/lzjun567/zhihu-api--upgrade fromzhihuimportZhihu zhihu=Zhihu() zhihu.user(user_slug="xiaoxiaodouzi") {'avatar_url_template':'https://pic1.zhimg.com/v2-ca13758626bd7367febde704c66249ec_{size}.jpg', 'badge':[], 'name':'我是小号', 'headline':'程序员', 'gender':-1, 'user_type':'people', 'is_advertiser':False, 'avatar_url':'https://pic1.zhimg.com/v2-ca13758626bd7367febde704c66249ec_is.jpg', 'url':'http://www.zhihu.com/api/v4/people/1da75b85900e00adb072e91c56fd9149','type':'people', 'url_token':'xiaoxiaodouzi', 'id':'1da75b85900e00adb072e91c56fd9149', 'is_org':False} 解析 nginx 访问日志并格式化输出 pipinstallngxtop $ngxtop runningfor411seconds,64332recordsprocessed:156.60req/sec Summary: |count|avg_bytes_sent|2xx|3xx|4xx|5xx| |---------+------------------+-------+-------+-------+-------| |64332|2775.251|61262|2994|71|5| Detailed: |request_path|count|avg_bytes_sent|2xx|3xx|4xx|5xx| |------------------------------------------+---------+------------------+-------+-------+-------+-------| |/abc/xyz/xxxx|20946|434.693|20935|0|11|0| |/xxxxx.json|5633|1483.723|5633|0|0|0| |/xxxxx/xxx/xxxxxxxxxxxxx|3629|6835.499|3626|0|3|0| |/xxxxx/xxx/xxxxxxxx|3627|15971.885|3623|0|4|0| |/xxxxx/xxx/xxxxxxx|3624|7830.236|3621|0|3|0| |/static/js/minified/utils.min.js|3031|1781.155|2104|927|0|0| |/static/js/minified/xxxxxxx.min.v1.js|2889|2210.235|2068|821|0|0| |/static/tracking/js/xxxxxxxx.js|2594|1325.681|1927|667|0|0| |/xxxxx/xxx.html|2521|573.597|2520|0|1|0| |/xxxxx/xxxx.json|1840|800.542|1839|0|1|0| 火车余票查询 pipinstalliquery Usage: iquery(-c|彩票) iquery(-m|电影) iquery-p<city> iquery-lsong[singer] iquery-p<city><hospital> iquery<city><show>[<days>] iquery[-dgktz]<from><to><date> Arguments: from出发站 to到达站 date查询日期 city查询城市 show演出的类型 days查询近(几)天内的演出,若省略,默认15 city城市名,加在-p后查询该城市所有莆田医院 hospital医院名,加在city后检查该医院是否是莆田系 Options: -h,--help显示该帮助菜单. -dgktz动车,高铁,快速,特快,直达 -m热映电影查询 -p莆田系医院查询 -l歌词查询 -c彩票查询 Show: 演唱会音乐会音乐剧歌舞剧儿童剧话剧 歌剧比赛舞蹈戏曲相声杂技马戏魔术 作者:佚名 来源:51CTO

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

Android数据库安全permission

android是基于 linux的 操作系统,linux本身就提供了强大的安全机制。 1. 应用程序沙箱,将你的代码、数据与其他app隔离 2. 应用框架层提供了“鲁棒”的加密、权限以及安全的进程间通信机制 3. ASLR, NX, ProPolice, safe_iop, OpenBSD dlmalloc, OpenBSD calloc, and Linux mmap_min_addr 来处理共享内存的风险 这片 文章主要讲的是大家不要乱用这个权限相关的东西 使用权限: 如果你的应用程序可以不使用任何权限当然是最好的,曾经安装一个单机游戏,看到不需要任何权限的的时候就感觉很舒服。 举例:做应用过程中需要建立一个唯一标识。有很多种方法,主要是通过访问设备信息,有获得imei的 有获得wifi的mac地址的等等,这就需要程序中获得电话操作(imei)或者是wifi操作的权限。比如写了一个应用,当用户看到你需要访问电话的权限的时候就会感觉很奇怪了,我安装一个游戏为啥需啊哟电话的权限啊?其实只是为了获得一个唯一标识。 定义权限: private void insertGroup() { // Internal storage where the DexClassLoader writes the optimized dex file to. final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE); // Initialize the class loader with the secondary dex file. DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(), optimizedDexOutputPath.getAbsolutePath(), null, getClassLoader()); Class libProviderClazz = null; try { // Load the library class from the class loader. // 载入从网络上下载的类的全类名 libProviderClazz = cl.loadClass("com.kunpeng.pim.GroupDao"); // Cast the return object to the library interface so that the // caller can directly invoke methods in the interface. // Alternatively, the caller can invoke methods through reflection, // which is more verbose and slow. Class<?>[] argTypes = {Context.class}; Constructor<?> constructor = libProviderClazz.getConstructor(argTypes); IGroupDao lib = (IGroupDao) constructor.newInstance(this); // Display the toast! lib.addGroup(" test"); } catch (Exception exception) { // Handle exception gracefully here. exception.printStackTrace(); } 最新内容请见作者的GitHub页:http://qaseven.github.io/

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

docker私有库搭建过程(Registry)

Registry实验环境:CentOS7Docker 1、安装并运行registry安装:[root@docker01 ~]# docker pull registryUsing default tag: latestTrying to pull repository docker.io/library/registry ... latest: Pulling from docker.io/library/registry79650cf9cc01: Pull complete 70ce42745103: Pull complete 77edd1a7fa4d: Pull complete 432773976ace: Pull complete 3234a47fe5a9: Pull complete Digest: sha256:a3551c422521617e86927c3ff57e05edf086f1648f4d8524633216ca363d06c2[root@docker01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/busybox latest c30178c5239f 6 days ago 1.106 MBdocker.io/registry latest 9d0c4eabab4d 6 weeks ago 33.17 MB[root@docker01 ~]# 运行:[root@docker01 ~]# docker run -d -p 5000:5000 -v /mnt/date/registry:/var/lib/registry registry75841a99e1fc882617bc37d088a8c80abae225cfe2842110f2049600df560a47[root@docker01 ~]# -d后台运行-p指定端口-v把registry的镜像路径/var/lib/registry映射到本机的/mnt/date/registry 检查5000端口netstat -an | grep 5000[root@docker01 ~]# netstat -an | grep 5000tcp6 0 0 :::5000 :::* LISTEN [root@docker01 ~]# telnet 127.0.0.1 5000成功。[root@docker01 ~]# telnet 127.0.0.1 5000Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is '^]'.qHTTP/1.1 400 Bad RequestContent-Type: text/plainConnection: close 400 Bad RequestConnection closed by foreign host.[root@docker01 ~]# 2、添加tag标记[root@registry ~]# docker tag busybox 10.100.50.120:5000/busybox[root@registry ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE10.100.50.122:5000/busybox latest c30178c5239f 6 days ago 1.106 MBdocker.io/busybox latest c30178c5239f 6 days ago 1.106 MBdocker.io/registry latest 9d0c4eabab4d 6 weeks ago 33.17 MB[root@registry ~]# 3、上传镜像报错[root@registry xinetd.d]# docker push 10.100.50.120:5000/busyboxThe push refers to a repository [10.100.50.122:5000/busybox]Get https://10.100.50.120:5000/v1/_ping: http: server gave HTTP response to HTTPS client[root@registry xinetd.d]# 解决方案:修改/etc/sysconfig/docker文件,并重新启动docker服务。ADD_REGISTRY='--add-registry 10.100.50.120:5000'INSECURE_REGISTRY='--insecure-registry 10.100.50.120:5000' 4、上传镜像[root@registry ~]# docker push 10.100.50.120:5000/busyboxThe push refers to a repository [10.100.50.120:5000/busybox]3a1dff9afffd: Pushed latest: digest: sha256:be3c11fdba7cfe299214e46edc642e09514dbb9bbefcd0d3836c05a1e0cd0642 size: 527[root@registry ~]# 其他坑:坑1:IPV4 forwording报错,但是容器运行正常。[root@registry mnt]# docker run -d -p 5000:5000 -v /mnt/date/registry registryWARNING: IPv4 forwarding is disabled. Networking will not work.970e18480c47661fd2cffab9f7e0410989e62ed9d229333cb32e5727a2e88b3b[root@registry mnt]# 解决方案:在/etc/sysctl.conf文件中加入net.ipv4.ip_forward=1并重启网络服务。 修改后正常:[root@registry mnt]# docker run -d -p 5000:5000 -v /mnt/date/registry registryabbec57e5dca734689cfd953f27564156ec24e32ae6e532043309f0332653650[root@registry mnt]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESabbec57e5dca registry "/entrypoint.sh /etc/" 31 seconds ago Up 30 seconds 0.0.0.0:5000->5000/tcp compassionate_mclean[root@registry mnt]# 坑2:查看镜像存放位置显示404 page not found网上很多教程都是下面这个命令[root@docker01 ~]# curl http://10.100.50.122:5000/v2/search404 page not found通过docker search registry发现安装的是2.0版本。 V2的命令格式如下:[root@docker01 ~]# curl -X GET http://10.100.50.122:5000/v2/_catalog{"repositories":["busybox","centos"]}[root@docker01 ~]# 文档:http://www.jianshu.com/p/fc36368b5c44

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

hadoop开发库webhdfs使用介绍

Hadoop1.0版本已经提供了对Web方式访问的全面支持,包括读写和文件管理,用户可以使用curl模拟Http消息进行测试,下面是WebHDFS提供的操作列表功能清单: HTTP GET• OPEN (see FileSystem.open)• GETFILESTATUS (see FileSystem.getFileStatus)• LISTSTATUS (see FileSystem.listStatus)• GETCONTENTSUMMARY (see FileSystem.getContentSummary)• GETFILECHECKSUM (see FileSystem.getFileChecksum)• GETHOMEDIRECTORY (see FileSystem.getHomeDirectory)• GETDELEGATIONTOKEN (see FileSystem.getDelegationToken)• HTTP PUT• CREATE (see FileSystem.create)• MKDIRS (see FileSystem.mkdirs)• RENAME (see FileSystem.rename)• SETREPLICATION (see FileSystem.setReplication)• SETOWNER (see FileSystem.setOwner)• SETPERMISSION (see FileSystem.setPermission)• SETTIMES (see FileSystem.setTimes)• RENEWDELEGATIONTOKEN (see DistributedFileSystem.renewDelegationToken)• CANCELDELEGATIONTOKEN (see DistributedFileSystem.cancelDelegationToken)• HTTP POST• APPEND (see FileSystem.append) 这里需要特别注意的是hadoop配置参数中界定了是否支持身份认证,并设定了默认的用户名webuser,用户可以自行修改是否启用和更改默认的用户,如果不作处理,有时候会出现,用户权限不够,无法执行某些操作的问题。 作者:张子良 出处:http://www.cnblogs.com/hadoopdev 本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

资源下载

更多资源
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部分的功能。

用户登录
用户注册