golang在windows下读取clipboard截取图片信息

golang二进制处理 使用’encoding/binary’包,和bytes.Buffer配置。 import "encoding/binary" data := new(bytes.Buffer) binary.Write(data, binary.LittleEndian, uint16('B')|(uint16('M')<<8)) golang从windows下的clipboard中抓取图片 windows下的clipboard保存的图片信息是dib结构,保存有bmpinfoheader信息头和pixel图片信息。 其中bmpinfoheader信息格式如下: type infoHeader struct { iSize uint32 // infoheader 长度,40 iWidth uint32 // 图片宽度 iHeight uint32 // 图片高度 iPLanes uint16 iBitCount uint16 // 每个像素颜色占用空间 iCompression uint32 // 图片压缩格式,dib中一般为0或者为3 iSizeImage uint32 // 图片pixel占用大小 iXPelsPerMeter uint32 iYPelsPerMeter uint32 iClrUsed uint32 iClrImportant uint32 } 需要根据bmpinfoheader计算出bmp图片的fileheader,并放在bmp图片的头部。fileheader格式如下: type fileHeader struct { bfType uint16 // 恒定为'BM' bfSize uint32 // bmp整个文件大小 bfReserved1 uint16 bfReserved2 uint16 bfOffBits uint32 // pixel信息开始的偏移量 } 读取clipboard中图片信息,需要用到win32的api,如下:

hugo setup

hugo initial

hugo new site mysite

hugo new post

cd /path/to/mysite
hugo new post/hugo_setup.md

hugo publish

hugo 
# it would produce static pages in public directory

使用fabric工具配置ssh免密码登录

must setup the localhost keygen generate keys for localhost ssh-keygen -t rsa setup passwdless in remote servers the script set_pass.py is like below: from fabric.api import * from fabric.contrib.files import * user = 'user' env.password = 'password' env.hosts=[] for ip in range(232, 240): env.hosts.append('%s@192.146.156.%d' % (user, ip)) def setpass(): local("rm -rf passwd_set/authorized_keys") home = os.getenv("HOME") with open("%s/.ssh/id_rsa.pub" % home, "r") as fr: key = fr.read() get("~/.ssh/*", "passwd_set/.") local("touch passwd_set/authorized_keys") exists1 = False with open("passwd_set/authorized_keys", "r") as fr: if key in fr.

Categories

Hugos

Posts

Pythons

Tags