安装ubuntu docker完整版

安装ubuntu docker完整版 困扰了很久怎么安装ubuntu docker的完整版,后来发现从ssh登陆进docker镜像的时候有提示,可以用一条命令完美安装ubuntu的完整版。 命令 unminimize 执行效果 ➜ ~ unminimize This system has been minimized by removing packages and content that are not required on a system that users do not log into. This script restores content and packages that are found on a default Ubuntu server system in order to make this system more suitable for interactive use. Reinstallation of packages may fail due to changes to the system configuration, the presence of third-party packages, or for other reasons. This operation may take some time. Would you like to continue? 大功告成! ...

2020年3月16日 · 3 分钟 · M2kar

SSH访问内网/内网穿透的几种情景详解

SSH访问内网/内网穿透的几种情景详解 @[TOC] 0x01 背景 疫情期间远程办公,自然少不了需要连接到公司内网的服务器跑程序。SSH是一种常用的连接到内网的方式,几乎能做到所有连接内网的操作。下面作者将对几种常用或者不常用的连接到内网的使用情况做一些示例。 0x02 网络拓扑 下面将对网络中的几台机器的网络拓扑做说明。 IP均作匿名化处理 个人笔记本1 主机名:PC1 位置: 公网 IP:不重要 跳板机 主机名:proxy.test.com ssh: 端口: 5022 用户名: user IP/域名 公网: proxy.test.com 内网: 192.168.8.10 服务器1 主机名: srv1 ssh 端口: 818 用户名: user IP 内网:192.168.8.18 0x03 基础知识 ssh ssh 端口转发 ssh config文件配置 ssh 密钥设置 代理服务器 0x04 工具列表 0x041 本地PC 如果是windows 安装git-bash并使用它提供的ssh功能 如果是MacOS或者是Linux 使用本地自带的ssh 0x042 企业服务器 需要配置好SSH服务器 0x05 ssh端口转发的基本操作以及通过企业网络访问网站 0x051 适用情况 本方法可以适用于访问 企业内部搭建的网站 必须企业IP授权才能访问的网站(如论文检索网站) 0x052 步骤 1. 执行ssh动态转发命令 # 在PC1上执行 ssh -D 10824 [email protected] -p 5022 上面的命令是在PC1本地开放端口10824,该端口作为一个Sock代理服务器,使用此代理可以通过企业内网访问网络 ...

2020年3月14日 · 3 分钟 · M2kar

ES遍历所有搜索结果(Python实现)

ES遍历所有搜索结果(Python实现) ES的搜索是有数量限制的,因此利用官方提供是scroll API实现了一个对全量数据处理的函数。 def travel_es(es,process_func, **kwargs): """ 遍历es的搜索结果,并使用process_func处理返回的item process_func: function to process item. kwargs: arguments same as elasticsearch search api. """ kwargs.setdefault("scroll","2m") kwargs.setdefault("size",1000) res = es.search(**kwargs) sid = res['_scroll_id'] scroll_size = len(res['hits']['hits']) total_size=scroll_size while scroll_size > 0: "Scrolling..." # Before scroll, process current batch of hits process_func(res['hits']['hits']) data = es.scroll(scroll_id=sid, scroll='4m') # Update the scroll ID sid = data['_scroll_id'] # Get the number of results that returned in the last scroll scroll_size = len(data['hits']['hits']) total_size+=scroll_size print(total_size) return scroll_size 示例用法 下面是把所有的结果存到item_list中 ...

2020年3月13日 · 1 分钟 · M2kar

Tmux快速使用

背景 很多时候我们需要通过SSH连接服务器进行一些操作,费了好长时间调好了程序,一顿饭的功夫SSH超时了(broken pipe),重新连上去正在运行的程序也都没了,一切又得从头再来。这个时候你就非常需要用到tmux了,用tmux在服务器上创建一个会话(Session),在该会话中进行操作,你可以随时随地断开和重新连接会话(Session),即便是SSH中断了你在远程服务器上的工作状态也可以持久化地保存。 安装 ubuntu 操作系统 sudo apt-get install tmux # 同时安装Oh My Tmux组件包 cd git clone https://github.com/gpakosz/.tmux.git ln -s -f .tmux/.tmux.conf cp .tmux/.tmux.conf.local . 快捷键和常用命令 创建和重新连接 tmux new -s <session> tmux a -t <session> 全局键 Tmux 官方默认时C-b. .tmux 额外添加了C-a 下面用<prefix>代指示全局键 <prefix> 然后:可以输入指令。 会话操作(session) 快捷键 操作 指令 <preix> s session 列表 <preix> d 退出并在后台执行 <preix> D 选择并退出所有其他的session <preix> m 鼠标操作 窗口操作(window) 快捷键 操作 指令 <preix> c 创建新窗口 <preix> 0...9 切换 <preix> & 关闭当前窗口 <preix> , 重命名 面板操作(Panes) 快捷键 操作 指令 <preix> % 纵向分割 <preix> “ 水平分割 <preix> ←↑↓→ 切换 参考 Oh My Tmux 参考: gpakosz/.tmux(github) 更多快捷方式参考:Tmux Cheat Sheet & Quick Reference 文章链接 Tmux快速使用 版权声明:本文为 m2kar 的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 作者: m2kar 打赏链接: 欢迎打赏m2kar 邮箱: m2kar.cn#gmail.com 主页: m2kar.cn Github: github.com/m2kar CSDN: M2kar的专栏

2020年3月13日 · 1 分钟 · M2kar

windows7安装低版本Flash

版权声明:本文为 m2kar 的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 作者: m2kar 打赏链接: 欢迎打赏m2kar 邮箱: m2kar.cn#gmail.com 主页: m2kar.cn Github: github.com/m2kar CSDN: M2kar的专栏

2020年3月13日 · 1 分钟 · M2kar

批量迁移Gitee仓库到Github

背景 虽然Gitee仓库蓬勃发展,趋势很好,但是客观来讲,和Github的易用性还是有一定差距的。 当初由于Github私有仓库数量的限制,所以把很多私有的小项目的仓库都放到了gitee。 最近随着Github的免费仓库不再限制数量,所以把私有仓库和公有仓库都挪到一起放到github挪上了日程。 由于建的仓库有些多,所以手动逐个挪比较费时间,而且学习一下GitHub的API操作,对以后的工作可能会有帮助,所以我采取了脚本的方式完成这个事情。 下面分享我做这个事情的几个步骤。 步骤 获取项目列表 克隆 github创建项目API 上传 归档 获取Gitee项目列表: 没有找到gitee的API,所以采取手动浏览器解析网页的方式获得仓库列表,这里主要获得了仓库名和仓库的描述。 在gitee网站执行JS脚本 l=[] $.each($("#search-projects-ulist div.list-warpper"),function(i,v){ dl=$(".description",v); console.log(dl); des=dl.length>0?dl[0].textContent:""; j={ "path":v.attributes["data-path"].value, "des":des+" https://gitee.com/"+v.attributes['data-path'].value }; l.push(j); }) 其中除了l=[],需要手动翻页,每次翻页都要执行一次。 得到的l是所有项目列表。 JSON.stringfy(l); 输出所有。 然后导入到python。 import json j=json.loads(s) l=[] for i,v in enumerate(j): l.append({ "name":os.path.split(v["path"])[1], "path":v["path"], "des":v["des"], }) 处理后示例 [{'name': 'repo1', 'path': 'username/repo1', 'des': ' https://gitee.com/username/repo1'}, {'name': 'repo2', 'path': 'username/repo2', 'des': ' https://gitee.com/username/repo2'}] 克隆项目 这里使用python调用linux 下 git客户端完成 for i,v in enumerate(l): os.system(f"git clone [email protected]:{v['path']}.git {v['name']}") 创建Github项目列表 这里采用了PyGithub库。 $ pip install PyGithub 需要设置Github的token,申请token参看 https://github.com/settings/tokens ...

2019年12月6日 · 2 分钟 · M2kar

[编程]ipython后台任务多线程执行

背景 jupyter notebook是以ipython为内核的,在编写程序的时候,经常遇到有些高IO的函数在后台运行半天,但是又需要在它运行的时候执行别的任务,因此这就用到了多线程。 其实ipython 已经封装好了多线程工具,只需要调用即可执行 简单使用 from IPython.lib import backgroundjobs as bg from time import sleep jobs = bg.BackgroundJobManager() def func1(): sleep(1000000) return 1 # 创建任务 jobs.new(func1) # 任务状态 jobs.status() # Running jobs: # 0 : <function func1 at 0x7fae1b670c80> # 执行结果 result=jobs.result(0) 官方代码 版权声明:本文为 m2kar 的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 作者: m2kar 打赏链接: 欢迎打赏m2kar 邮箱: m2kar.cn#gmail.com 主页: m2kar.cn Github: github.com/m2kar CSDN: M2kar的专栏

C语言中常用的调试宏

背景 在C语言编写中,经常想因为调试的原因,插入一些临时输出的变量,或者执行一些不必要的指令。 写完之后频繁注释和反注释很耗时间,而且可能会造成不必要的错误。 因此作者采用了宏命令的方式,插入一些调试输出。 代码 // File: debug.c // some debug Macro // #define DEBUG #ifndef DEBUG_PRINT #ifdef DEBUG #define DEBUG_PRINT(fmt, args...) fprintf(stderr, fmt, ## args) #else #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */ #endif #endif //DEBUG_PRINT #ifndef DEBUG_RUN #ifdef DEBUG #define DEBUG_RUN(args) {args ; } #else #define DEBUG_RUN(args...) #endif #endif //DEBUG_RUN 使用方式 将上述代码加入到头文件中。 Gcc编译时加入-DDEBUG定义DEBUG宏 gcc -DDEBUG -o ./a.out 对于DEBUG_PRINT,在代码中像正常printf一样使用。 对于DEBUG_RUN,在括号中的语句只有在DEBUG模式下才会执行。 //File: main.c #include <stdio.h> #include "debug.c" int a=10; DEBUG_PRINT("%d\n",a); char c[]="123123l123"; DEBUG_RUN( printf("%s",c); ) Gis URL: https://gist.github.com/m2kar/6c9acef7a7cbf6540f40f74f5756be35 ...

2019年11月19日 · 1 分钟 · M2kar

【论文笔记】Beyond credential stuffing: Password similarity models using neural networks

论文主题 同一用户在不同网站的密码相似度模型。 摘要 英文 Attackers increasingly use passwords leaked from one website to compromise associated accounts on other websites. Such targeted attacks work because users reuse, or pick similar, passwords for different websites. We recast one of the core technical challenges underlying targeted attacks as the task of modeling similarity of human-chosen passwords. We show how to learn good password similarity models using a compilation of 1.4 billion leaked email, password pairs. Using our trained models of password similarity, we exhibit the most damaging targeted attack to date. Simulations indicate that our attack compromises more than 16% of user accounts in less than a thousand guesses, should one of their other passwords be known to the attacker and despite the use of state-of-the art countermeasures. We show via a case study involving a large university authentication service that the attacks are also effective in practice. We go on to propose the first-ever defense against such targeted attacks, by way of personalized password strength meters (PPSMs). These are password strength meters that can warn users when they are picking passwords that are vulnerable to attacks, including targeted ones that take advantage of the user’s previously compromised passwords. We design and build a PPSM that can be compressed to less than 3 MB, making it easy to deploy in order to accurately estimate the strength of a password against all known guessing attacks. ...

2019年11月15日 · 4 分钟 · M2kar

【论文笔记】Birthday, Name and Bifacial-security Understanding Passwords of Chinese Web Users

论文主题 对中文密码进行实证分析,发现中文密码中有趣的结构和特征,揭示了中文密码的双相安全性(Bifacial-security)。 摘要 英文 Much attention has been paid to passwords chosen by English speaking users, yet only a few studies have examined how non-English speaking users select passwords. In this paper, we perform an extensive, empirical analysis of 73.1 million real-world Chinese web passwords in comparison with 33.2 million English counterparts. We highlight a number of interesting structural and semantic characteristics in Chinese passwords. We further evaluate the security of these passwords by employing two state-of-the-art cracking techniques. In particular, our cracking results reveal the bifacial-security nature of Chinese passwords. They are weaker against online guessing attacks (i.e., when the allowed guess number is small, 1∼104) than English passwords. But out of the remaining Chinese passwords, they are stronger against offline guessing attacks (i.e., when the guess number is large, >105) than their English counterparts. This reconciles two conflicting claims about the strength of Chinese passwords made by Bonneau (IEEE S&P'12) and Li et al. (Usenix Security'14 and IEEE TIFS'16). At 107 guesses, the success rate of our improved PCFG-based attack against the Chinese datasets is 33.2%~49.8%, indicating that our attack can crack 92% to 188% more passwords than the state of the art. We also discuss the implications of our findings for password policies, strength meters and cracking. ...

2019年10月24日 · 2 分钟 · M2kar