eve

EVE-NG硬盘扩容,存储海量镜像

生来就可爱ヽ(ⅴ<●) 提交于 2020-03-18 17:04:20
EVE-NG硬盘扩容,存储海量镜像 一、查看当前磁盘使用情况 技术分享 /dev/mapper/eve--ng--vg-root,所以我们只要把这个LV容量扩大即可 技术分享 二、给EVE-NG硬盘扩大容量,对于EVE-NG来说,相当于加大物理磁盘容量 把EVE-NG关机后编辑EVE-NG虚拟机 注意:无法扩展具有快照的虚拟机中的磁盘,必须删除快照。 技术分享 点击扩展 技术分享 填写磁盘大小,点扩展 技术分享 等待完成扩展 技术分享 三、EVE-NG系统层面增大VG容量 1、加电开机EVE-NG,确认硬盘容量为500G root@eve-ng:~# fdisk -l …… …… …… Disk /dev/sda: 500 GiB, 536870912000 bytes, 1048576000 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x6d98196e Device Boot Start End Sectors Size Id Type(硬盘分区情况)

如何使用 Serverless 实现一个图书查询 App

做~自己de王妃 提交于 2020-03-16 17:19:22
某厂面试归来,发现自己落伍了!>>> 我有一个朋友(这朋友不是我),朋友的单位里有一个小型图书室,图书室中存放了不少书。 尽管每本书都在相应的区域里进行了编号,但是毕竟没有图书馆的管理系统,大家找起来还是要花点时间的。为了让大家更容易地找到这些书,朋友联系我,打算让我帮他做一个简单的图书查询系统(<del>完整的图书馆管理系统</del>)。 Easier said than done,考虑到这还是有一定复杂度的项目,我打算使用腾讯云云函数 SCF,把整个应用部署到 Serverless 架构上。 ▎整体效果 左边是图书检索系统的首页;右边是检索演示,比方说我们搜索「精神」,App 就会依据返回相关的书籍。看起来还不赖。 ▎功能设计 将包含书籍信息的 Excel 表存放至腾讯云对象存储 COS 中; 使用腾讯云云函数读取并解析表格; 根据词语相似性检索对应的图书; 通过 MUI 制作前端页面,页面也存放在 COS 中。 ▎具体实现 Excel 样式(包含书名和编号) 分类 tab: 核心代码实现: import jieba import openpyxl from gensim import corpora, models, similarities from collections import defaultdict import urllib.request with

突破传统 OJ 瓶颈,“判题姬”接入云函数

故事扮演 提交于 2020-03-06 15:54:17
Online Judge 系统(简称 OJ)是一个在线的判题系统。用户可以在线提交多种程序(如C、C++、Pascal)源代码,系统对源代码进行编译和执行,并通过预先设计的测试数据来检验程序源代码的正确性。 随着时代的发展,OJ 已经真正地成为了测评工具,其作用不再局限为 ACM 备战,还有老师检测学生能力、学生入学考试、能力评测(例如 ZJU 的 PAT)、找工作刷题和面试(例如牛客)等,而目前 OJ 的开源框架也越来越多,但是很多 OJ 都是基于 HUSTOJ 进行定制或者二次开发。 无论是什么方法,在关于 OJ 的众多问题中,有一个就是:性能问题。 说实话,一些 OJ 群里,总会有人问:1 核 1G 的机器,可以同时判多少题目?可以有多少人同时用?如果比赛,大约有多少人需要多高性能的机器?那么『判题姬』是否只能存在传统的宿主机中,能否通过其他方式焕发新的生命力? 其中一种方法,就是和现有的云函数进行结合。 ▎简单思路 通过云函数实现在线编程的思路基本有两个: 每个用户的代码建立一个函数,用后删除; 每个语言建立一个函数,用户传递代码,每次执行; 这两种方法,第一种相对简单的,但是目前对于很多云函数服务商来说,函数数量有一定限制,而且每次执行这个操作相对比较繁琐。 所以,本文采用第二种策略,建立一个函数,每次执行,用户传入代码,系统执行,返回结果。 代码写入系统: def

How to reference an endpoint in another one?

送分小仙女□ 提交于 2020-01-06 01:44:48
问题 In Eve demo, a people collection as endpoint is set up, however there is no id created for it. So if I want to create a endpoint a level up to reference 'people', it seems not easy. What I want to do for example: The structure: company->dept(people)->person So if I visit www.example.com/company, I get a organized list of people, grouped with dept. So far I can create person, create different dept(people) endpoints, but how to put all these in a company endpoint? Thanks 回答1: You probably want

Python eve - how to get the current user after successful authentication?

天大地大妈咪最大 提交于 2020-01-04 09:13:13
问题 I created an auth token class like the below, and I use self.set_request_auth_value(user['_id']) to set the user of this request, in some hooks I want to access this user, how can I get it ? I tried app.get_request_auth_value() , but that is not it. Token Auth class: class TokenAuth(TokenAuth): def check_auth(self, token, allowed_roles, resource, method): """ Token authentication using itsdangerous """ # TODO: revoked access can be checked here # without even parsing the token s = Serilizer

Python Eve : No 'Access-Control-Allow-Origin' header is present on the requested resource

旧街凉风 提交于 2020-01-04 04:11:25
问题 I have written an API using Python EVE framework. While trying to access the API from an AngularJS app it shows an error as shown below : XMLHttpRequest cannot load http://127.0.0.1:5000/user/jay3dec. Request header field Authorization is not allowed by Access-Control-Allow-Headers. In order to correct the above error I added the following to the settings.py X_DOMAINS = '*' X_HEADERS = 'Authorization' Now the above error disappears and a new error shows in the console : XMLHttpRequest cannot

How to have eve write to different databases based on various URL parameters and request values?

心已入冬 提交于 2020-01-03 20:16:13
问题 I'm attempting to create a REST API that selects the appropriate mongo database to write to along with the correct collection. How do I have eve select the database with the same name as a parameter as well as the collection? 回答1: With upcoming v0.6 Eve will natively support multiple Mongo instances. New: Support for multiple MongoDB databases and/or servers. You can have individual API endpoints served by different Mongo instances: mongo_prefix resource setting allows overriding of the

How to have eve write to different databases based on various URL parameters and request values?

会有一股神秘感。 提交于 2020-01-03 20:15:47
问题 I'm attempting to create a REST API that selects the appropriate mongo database to write to along with the correct collection. How do I have eve select the database with the same name as a parameter as well as the collection? 回答1: With upcoming v0.6 Eve will natively support multiple Mongo instances. New: Support for multiple MongoDB databases and/or servers. You can have individual API endpoints served by different Mongo instances: mongo_prefix resource setting allows overriding of the

Writing tests for Python Eve RESTful APIs against a real MongoDB

匆匆过客 提交于 2020-01-02 07:26:12
问题 I am developing my API server with Python-eve, and would like to know how to test the API endpoints. A few things that I would like to test specifically: Validation of POST/PATCH requests Authentication of different endpoints Before_ and after_ hooks working property Returning correct JSON response Currently I am testing the app against a real MongoDB, and I can imagine the testing will take a long time to run once I have hundreds or thousands of tests to run. Mocking up stuff is another

Using Eve's DB layer without HTTP

心不动则不痛 提交于 2020-01-01 10:48:12
问题 In my application, the MongoDB collections need to be updated by a server-side script job (IE: a cron job that scrapes/pulls from other APIs every 30minutes). What I really want to do is make updates to the MongoDB collections, but have the data be validated against the schema and include metadata (updated, created, etc). The two ways that come to mind to solve this is: Have a fake client to do HTTP POST/PUT/PATCHES. However, this means this fake client would have to deal with things like