如下内容来自wiki(https://en.wikipedia.org/wiki/OpenStack) Release name Release date Included Component code names[52] Austin 21 October 2010[120][121] Nova, Swift Bexar 3 February 2011[122] Nova, Glance, Sw […]
分类: ECW
to record the skills, experience and some other interesting things about the Computer World
git只获取仓库中的某一个文件或者文件夹
最近整理散乱在各处的文件时,想到这个问题,于是在知乎上看到一个方法,测试可行,所以整理在此: 此处以pull我的仓库中https://github.com/mayaobei/RaspBerryPi/tree/master/python/python-qrcode目录为例进行说明 1.创建一个空目录用于存放pull下来的文件 mkdir testSparse 2.初始化git,开启core.spar […]
raspberrypi的xware下载器docker镜像
经过一番折腾,终于将树莓派的xware docker镜像制作完成了,在本地测试可以正常和帐号绑定并下载。此镜像还集成了一份busybox,可以通过下面的方式进入shell sudo docker run -it -v /mnt:/TDDownload mayb/rpi-xware /bin/sh 不添加/bin/sh而使用默认命令的话会通过脚本启动xware,和hub上其他xware版本一样,通过 […]
raspberrypi下使用scratch创建一个简单的helloword镜像
1.在树莓派本地磁盘上新建一个名为rpi-hello的目录 2.创建一个hello.c的程序,然后通过 gcc -o hello -static hello.c 进行编译 3.创建Dockerfile文件,写入如下内容 FROM resin/scratch ADD hello / CMD ["/hello"] 4.通过docker build创建镜像 sudo docker build -t ma […]
Raspberrypi下的docker
在树莓派使用docker,和普通的linux上操作是一样的,因为官方提供armhf版本的docker,所以也可以通过添加源之后自动安装,步骤参考如下: 1.安装apt-transport-https和ca-certificates软件包,以便apt可以支持官方的https源 sudo apt-get install apt-transport-https ca-certificates 2.添加d […]
windows系统ntp更新失败问题
印象中,Windows默认的ntp服务器从来没有更新成功过,不知道是什么原因,通过wireshark抓包看到也不是不能访问服务器,难不成是因为系统的问题? 解析time.windows.com的地址: 在wireshark中抓包看服务器返回了信息,但为什么就是更新失败呢? 换用 cn.pool.ntp.org 进行更新,却可以正常同步时间: 解析cn.pool.ntp.org的地址: 用wires […]
Python在linux终端模式下的类似聊天消息对话框
首先看一下最终效果,在终端模式下实现类似于聊天的对话框 实现方式如下,通过两个list: iwords和swords分别缓存来自终端输入和socket收到的数据,然后再将数据通过屏幕输出并通过socket接口发送出去,通过四个独立的线程分别完成各自的工作: myinput:获取输入区域内的输入数据,并将数据append到iwords和swords myoutput:检测swords长度并通过swo […]
试用python的curses模块创建window
实现效果如下图,在console的上部分显示输入的内容,下部分用于输入: 虽然比较粗糙,但是一般的功能勉强可用了
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#!/usr/bin/env python import curses import curses.textpad stdscr = curses.initscr() #通过string来存储输入的内容,每次换行后显示 words = '' def mywin(): global words #创建两个win窗口,stdwin用来输入,stdwin2用来输出 #newwin(行数,列数,y坐标,x坐标) stdwin = curses.newwin(1,curses.COLS,curses.LINES-1,0) stdwin2 = curses.newwin(1000, curses.COLS, 0, 0) lines = 0 while True: stdwin.addstr('>') stdwin.refresh() while True: k = stdwin.getkey() if k != '\n': words += k else: stdwin2.addstr(words + '\n') stdwin2.refresh() lines += int(len(words) / curses.COLS) + 1 if lines >= curses.LINES-2: stdwin2.clear() lines = int(len(words) / curses.COLS) + 1 words='' stdwin.clear() break try: mywin() except Exception: raise Exception finally: curses.endwin() |
已知问题: 1.输入后不能使用backspace或者delete进行删除,方向键等功能键也会被直接识别为键值,而不是执行对应的功能(删除可以用Ctrl+Backspace,但是屏幕不会刷新被删除的内容) 2.输出窗口的行 […]