首页
About
友情链接
Search
1
V2ray配置文件翻译
1,357 阅读
2
draw.io(diagrams.net) - 免费开源全平台绘图软件
1,107 阅读
3
Android 11 中的软件包可见性
909 阅读
4
Windows常用软件
829 阅读
5
Android Studio单元测试的编码过程
657 阅读
Uncategorized
Software
Android
Linux
Communist Party of China
Docker
Windows
Tools
登录
Search
Leon
累计撰写
34
篇文章
累计收到
23
条评论
首页
栏目
Uncategorized
Software
Android
Linux
Communist Party of China
Docker
Windows
Tools
页面
About
友情链接
搜索到
34
篇与
Leon
的结果
2021-08-03
基于Django的内网互传服务器
https://github.com/fuhailong1998/djangoFileShareSite内网传输,千兆网速跑满。账号系统,安全保障。IP中间件屏蔽,进一步安全。 # !/usr/bin/env python3 # -*- coding:utf-8 -*- """ @file : middlewares.py @author : Leon(fxkxb.com) @date : 2021/8/3 03:21 @description : """ from django.shortcuts import render from django.utils.deprecation import MiddlewareMixin class IpMiddleware(MiddlewareMixin): def process_view(self, request, view_func, *view_args, **view_kwargs): EXCLUDE_IPS = ['*'] if 'HTTP_X_FORWARDED_FOR' in request.META: ip = request.META['HTTP_X_FORWARDED_FOR'] else: ip = request.META['REMOTE_ADDR'] if EXCLUDE_IPS[0] == '*': return if ip not in EXCLUDE_IPS: return render(request, 'sorry.html')
2021年08月03日
18 阅读
0 评论
0 点赞
2021-07-30
Docker
Docker简介Docker 采用Go语言编写,是一个开放源代码软件(源代码库:https://github.com/moby/moby),是一个用于开发应用、交付(shipping)应用、运行应用的开放平台。 Docker允许用户将基础设施(Infrastructure)中的应用单独分割出来,形成更小的颗粒(容器),从而提高交付软件的速度。Docker容器与虚拟机类似,但二者在原理上不同。容器是将操作系统层虚拟化,虚拟机则是虚拟化硬件,因此容器更具有便携性、高效地利用服务器。 容器更多的用于表示 软件的一个标准化单元。由于容器的标准化,因此它可以无视基础设施(Infrastructure)的差异,部署到任何一个地方。另外,Docker也为容器提供更强的业界的隔离兼容。[1]| | Docker容器 | 虚拟机(VM) | | ---------- | ----------------------- | --------------------------- | | 操作系统 | 与宿主机共享OS | 宿主机OS上运行宿主机OS | | 存储大小 | 镜像小,便于存储与传输 | 镜像庞大(vmdk等) | | 运行性能 | 几乎无额外性能损失 | 操作系统额外的cpu、内存消耗 | | 移植性 | 轻便、灵活、适用于Linux | 笨重、与虚拟化技术耦合度高 | | 硬件亲和性 | 面向软件开发者 | 面向硬件运维者 |可使用Play with Docker https://labs.play-with-docker.com/来练习docker指令。Hello World使用docker运行hello world[2]docker run hello-worldHello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/简单使用目标:建立一个“Hi ThunderSoft”Nginx网页服务器镜像。拉取nginx基本镜像docker pull nginxUsing default tag: latest latest: Pulling from library/nginx 33847f680f63: Pull complete dbb907d5159d: Pull complete 8a268f30c42a: Pull complete b10cf527a02d: Pull complete c90b090c213b: Pull complete 1f41b2f2bf94: Pull complete Digest: sha256:8f335768880da6baf72b70c701002b45f4932acae8d574dedfddaf967fc3ac90 Status: Downloaded newer image for nginx:latest docker.io/library/nginx:latest查看本地镜像docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 08b152afcfae 10 days ago 133MB运行镜像docker run -dp 80:80 nginx 运行后系统返回了一串sha256的容器id 查看容器 docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fc8162606fcf nginx "/docker-entrypoint.…" 34 seconds ago Up 33 seconds 0.0.0.0:80->80/tcp nifty_leavitt 同时暴露出80端口 ![image-20210801193628279.png][3] 点击(访问这个网址)即可看到nginx的默认页面。 # Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to [nginx.org](http://nginx.org/). Commercial support is available at [nginx.com](http://nginx.com/). *Thank you for using nginx.* 修改默认页面进入容器docker exec -it 容器名称或id(id前几位就行) /bin/bash root@fc8162606fcf:/# 2. 修改nginx默认文件内容 echo "<h1>Hi Thundersoft</h1>" > /usr/share/nginx/html/index.html 3. 刷新页面即可看到修改后的内容。 # Hi Thundersoft 从容器创建镜像commit -a "作者名" -m "说明" 容器名称或者id 镜像名称:镜像版本 成功则返回了一串sha256的镜像id 查看本地镜像 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ts latest 298133099b1e 37 seconds ago 133MB nginx latest 08b152afcfae 10 days ago 133MB保存镜像为tar归档文件docker save -o 压缩文件名 镜像名:标签 查看 $ ls -l total 134240 -rw------- 1 root root 137459712 Aug 1 11:49 ts.tar删除刚刚创建的镜像。$ docker rmi nginx:latest ts:latest [node1] (local) root@192.168.0.13 ~ $ docker rmi ts:latest Untagged: ts:latest Deleted: sha256:298133099b1ef66a0bd4ad0c04676118dcaef22e635928680692bcbf5cc56af5 Deleted: sha256:d111dc2677957b6e00fbb140fae7ac110d6d258a055d2bef33a88249ad9897f9 [node1] (local) root@192.168.0.13 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 08b152afcfae 10 days ago 133MBtar归档镜像的使用docker load < ts.tar ts已成功导入并且可以成功运行 bcf8600f8844: Loading layer [==================================================>] 14.85kB/14.85kB Loaded image: ts:latest [node1] (local) root@192.168.0.13 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ts latest 298133099b1e 7 minutes ago 133MB nginx latest 08b152afcfae 10 days ago 133MB [node1] (local) root@192.168.0.13 ~ $ docker run -dp 81:80 ts a4818859dc11a41f0a6d6f36cc130c7e0c8bfff317572114a88b6be037fc6915 ![image-20210801195619457.png][4] # Hi Thundersoft 远程镜像仓库的使用在docker hub注册https://hub.docker.com/signup终端登录docker loginLogin with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: fuhailong1998 Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded 3. 将自己的镜像改名 docker tag 镜像名或id docker hub用户名/镜像名:版本 For example: docker tag ts:latest fuhailong1998/ts:latest 4. 将镜像push到自己的远程库 docker push docker hub用户名/镜像名:版本 For example: docker push fuhailong1998/ts:latestThe push refers to repository [docker.io/fuhailong1998/ts] bcf8600f8844: Pushed e3135447ca3e: Mounted from library/nginx b85734705991: Mounted from library/nginx 988d9a3509bb: Mounted from library/nginx 59b01b87c9e7: Mounted from library/nginx 7c0b223167b9: Mounted from library/nginx 814bff734324: Mounted from library/nginx latest: digest: sha256:e538a178407d3cd1fe84ba48c84be1e4a59e7f16e19db2538f2e294fb0e3244b size: 1778 此时刷新自己的docker hub远程库即可看到自己的镜像。 ![image-20210801200636389.png][5] 5. 在另一台主机拉取镜像。 1. 在Play with Docker上新建节点(相当于新建一台主机)。 ![image-20210801200852986.png][6] 2. 此时这台新节点是没有任何镜像的 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE 3. 拉取远程镜像 $ docker pull fuhailong1998/ts Using default tag: latest latest: Pulling from fuhailong1998/ts 33847f680f63: Pull complete dbb907d5159d: Pull complete 8a268f30c42a: Pull complete b10cf527a02d: Pull complete c90b090c213b: Pull complete 1f41b2f2bf94: Pull complete 1db4419f88f4: Pull complete Digest: sha256:e538a178407d3cd1fe84ba48c84be1e4a59e7f16e19db2538f2e294fb0e3244b Status: Downloaded newer image for fuhailong1998/ts:latest docker.io/fuhailong1998/ts:latest $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE fuhailong1998/ts latest 298133099b1e 26 minutes ago 133MB 4. 将刚刚拉取的镜像运行为容器 $ docker run -dp 80:80 2981 703d229923940401f26a35ebf9b562305abe421460f14d6ddeeb06c2a3fe4c87 运行后此节点显示“80”,代表暴露了80端口。 ![image-20210801201436234.png][7] 点击访问就是刚刚在第一个节点创建的镜像。 # Hi Thundersoft 基本命令[3]##### 容器生命周期管理| 命令 | 说明 | | | :------------: | :------------------------------: | --------------------------------------- | | docker run | 创建一个新的容器并运行一个命令。 | | | docker start | 启动一个或多个已经被停止的容器。 | | | docker stop | 停止一个运行中的容器。 | | | docker restart | 重启容器docker。 | | | docker kill | 终止一个运行中的容器。 | | | docker rm | 删除容器。 | | | docker pause | 暂停容器中所有的进程。 | | | docker unpause | 恢复容器中所有的进程。 | | | docker create | 创建一个新的容器但不启动它。 | | | docker exec | 在运行的容器中执行命令。 | docker exec -i -t dockername /bin/bash |##### 容器操作| 命令 | 说明 | | | :------------: | :----------------------------------------------------------: | ------------------------------------------ | | docker ps | 查看容器。 | | | docker inspect | 获取容器/镜像的元数据。 | | | docker top | 查看容器中运行的进程信息,支持 ps 命令参数。 | | | docker attach | 连接到正在运行中的容器。 | docker attach --sig-proxy=false dockername | | docker events | 从服务器获取实时事件。 | | | docker logs | 获取容器的日志。 | | | docker wait | 阻塞运行直到容器停止,然后打印出它的退出代码。 | | | docker export | 将文件系统作为一个tar归档文件导出到输出流。 | | | docker port | 列出指定的容器的端口映射,或者查找将PRIVATE_PORT NAT到面向公众的端口。 | |##### 容器rootfs命令| 命令 | 说明 | | :------------: | :----------------------------: | | ddocker commit | 从容器创建一个新的镜像。 | | docker cp | 用于容器与主机之间的数据拷贝。 | | docker diff | 检查容器里文件结构的更改。 |##### 镜像仓库| 命令 | 说明 | | :-----------: | :----------------------------------------------------------: | | docker login | 登陆到一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub | | docker logout | 登出一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub | | docker pull | 从镜像仓库中拉取或者更新指定镜像。 | | docker push | 将本地的镜像上传到镜像仓库,要先登陆到镜像仓库。 | | docker search | 从Docker Hub查找镜像 |##### 本地镜像管理| 命令 | 说明 | | :------------: | :---------------------------------: | | docker images | 列出本地镜像。 | | docker rmi | 删除本地镜像。 | | docker tag | 标记本地镜像,将其归入某一仓库。 | | docker build | 使用 Dockerfile 创建镜像。 | | docker history | 查看镜像的创建历史。 | | docker save | 将指定镜像保存成 tar 归档文件。 | | docker load | 导入使用docker save命令导出的镜像。 | | docker import | 从归档文件中创建镜像。 |##### info|version命令说明docker info显示 Docker 系统信息,包括镜像和容器数。docker version显示 Docker 版本信息。参考文献
2021年07月30日
245 阅读
0 评论
0 点赞
2021-07-19
Docker安装
官方文档:https://docs.docker.com/engine/install/ubuntu/安装新版本前需要卸载旧版本。sudo apt-get remove docker docker-engine docker.io containerd runc允许apt使用https。 sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release导入GPG密钥。 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg添加docker源。echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null更新apt源,并安装docker。 sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io(可选)使用阿里云的容器镜像服务-镜像加速器提升获取Docker官方镜像的速度。https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors通过修改daemon配置文件/etc/docker/daemon.json来使用加速器sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://每个人的阿里云账号不同.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker运行docker的hello-worldsudo docker run hello-worldUnable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8dfde127a29: Pull complete Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
2021年07月19日
238 阅读
0 评论
0 点赞
2021-07-18
Windows常用软件
Xshell Plus 6 XFTP 整合版飞秋360断网急救箱独立版360驱动大师腾讯软件管家独立版迅雷精简版OfficeBandicam录屏鲁大师(查看PC信息)透明化窗口keycastow电子印章生成器移动鼠标ClickShow批量重命名KMSIDM
2021年07月18日
829 阅读
3 评论
1 点赞
2021-07-08
蔡元培:就任北大校长之演说
五年前,严几道先生为本校校长时,余方服务教育部,开学日曾有所贡献于同校。诸君多自预科毕业而来,想必闻知。士别三日,刮目相见,况时阅数载,诸君较昔当必为长足之进步矣。余今长斯校,请更以三事为诸君告。一曰抱定宗旨。诸君来此求学,必有一定宗旨,欲求宗旨之正大与否,必先知大学之性质。今人肄业专门学校,学成任事,此固势所必然。而在大学则不然,大学者,研究高深学问者也。外人每指摘本校之腐败,以求学于此者,皆有做官发财思想,故毕业预科者,多入法科,入文科者甚少,入理科者尤少,盖以法科为干禄之终南捷径也。因做官心热,对于教员,则不问其学问之浅深,惟问其官阶之大小。官阶大者,特别欢迎,盖为将来毕业有人提携也。现在我国精于政法者,多入政界,专任教授者甚少,故聘请教员,不得不聘请兼职之人,亦属不得已之举。究之外人指摘之当否,姑不具论。然弭谤莫如自修,人讥我腐败,而我不腐败,问心无愧,于我何损?果欲达其做官发财之目的,则北京不少专门学校,入法科者尽可肄业法律学堂,入商科者亦可投考商业学校,又何必来此大学?所以诸君须抱定宗旨,为求学而来。入法科者,非为做官;入商科者,非为致富。宗旨既定,自趋正轨。诸君肄业于此,或三年,或四年,时间不为不多,苟能爱惜分阴,孜孜求学,则其造诣,容有底止。若徒志在做官发财,宗旨既乖,趋向自异。平时则放荡治游,考试则熟读讲义,不问学问之有无,惟争分数之多寡;试验既终,书籍束之高阁,毫不过问,敷衍三四年,潦草塞责,文凭到手,即可借此活动于社会,岂非与求学初衷大相背驰乎?光阴虚度,学问毫无,是自误也。且辛亥之役,吾人之所以革命,因清廷官吏之腐败。既在今日,吾人对于当轴多不满意,亦以其道德沦丧。今诸君苟不于此时植其基,勤其学,则将来万一因生计所迫,出而任事,担任讲席,则必贻误学生;置身政界,则必贻误国家。是误人也。误己误人,又岂本心所愿乎?故宗旨不可以不正大。此余所希望于诸君者一也。二曰砥砺德行。方今风俗日偷,道德沦丧,北京社会,尤为恶劣,败德毁行之事,触目皆是,非根基深固,鲜不为流俗所染。诸君肄业大学,当能束身自爱。然国家之兴替,视风俗之厚薄。流俗如此,前途何堪设想。故必有卓绝之士,以身作则,力矫颓俗。诸君为大学学生,地位甚高,肩此重任,责无旁贷,故诸君不惟思所以感己,更必有以励人。苟德之不修,学之不讲,同乎流俗,合乎污世,己且为人轻侮,更何足以感人。然诸君终日伏首案前,芸芸攻苦,毫无娱乐之事,必感身体上之苦痛,为诸君计,莫如以正当之娱乐,易不正当之娱乐,庶于道德无亏,而于身体有益。诸君入分科时,曾填写愿书,遵守本校规则,苟中道而违之,岂非与原始之意相反乎?故品行不可以不谨严。此余所希望于诸君者二也。三曰敬爱师友。教员之教授,职员之任务,皆以图诸君求学便利,诸君能无动于衷乎?自应以诚相待,敬礼有加。至于同学共处一堂,尤应互相亲爱,庶可收切磋之效。不惟开诚布公,更宜道义相勖,盖同处此校,毁誉共之。同学中苟道德有亏,行有不正,为社会所訾詈,己虽规行矩步,亦莫能辩,可以观察未周而为悬断也。余在德国,每至店肆购买物品,店主殷勤款待,付价接物,互相称谢,此虽小节,然亦交际所必需,常人如此,况堂堂大学生乎?对于师友之敬爱,此余所希望于诸君者三也。余到校视事仅数日,校事多未详悉,兹所计划者二事:一曰改良讲义。诸君既研究高深学问,自与中学、高等不同,不惟恃教员讲授,尤赖一己潜修。以后所印讲义,只列纲要,细微末节,以及精旨奥义,或讲师口授,或自行参考,以期学有心得,能裨实用;二曰添购书籍。本校图书馆书籍虽多,新出者甚少,苟不广为购办,必不足供学生之参考。刻拟筹集款项,多购新书,将来典籍满架,自可旁稽博采,无虞缺乏矣。今日所与诸君陈说者只此,以后会晤日长,随时再为商榷可也。
2021年07月08日
192 阅读
0 评论
0 点赞
1
...
5
6
7