svg to png or pdf

将svg转化成png或者pdf.不过性能不好.如果svg有几十M,会很慢. # ! encoding:UTF-8 import cairosvg import os def svg_to_png(from_dir, target_dir): “”” very slow :param from_dir: :param target_dir: :return: “”” return _export(from_dir, target_dir, “png”) def _export(from_dir, target_dir, export_type): files = os.listdir(from_dir) for fileName in files: path = os.path.join(from_dir, fileName) if os.path.isfile(path) and fileName[-3:] == “svg”: file_handle = open(path) svg = file_handle.read() file_handle.close() export_path = os.path.join(target_dir,… Continue reading svg to png or pdf

Published
Categorized as language, py

写一段c++,碰到5个问题

创建子线程的时候,在for循环里面,在栈中初始化子线程的变量,结果变量地址被覆盖。需要用new,在堆里分配。 使用除法,结果变量没有初始化。 结构体中使用到的引用,全部使用指针。 给函数传参数的时候,将指针的值传过去,结果参数被默认在栈里新分配一个。 以前取巧的用法,导致程序无法正常关闭

Published
Categorized as language

shadowsocks与nginx

正向代理 平常通过shadowsocks使用谷歌。 反向代理 利用nginx实现负载均衡

Published
Categorized as web

使用lvm

创建pv pvcreate /dev/sda3 pvcreate /dev/sda7 创建vg vgcreate dbf2_vg /dev/sda3 /dev/sda7 创建lv -i 指定跨PV的个数为2 -I 指定条带单元的大小,对应于I/O中数据单元块的大小;数值必须为2的幂,单位KB -n 制定卷的名称 -L 卷的大小 #指定大小 lvcreate -n var_lv -L 10G dbf2_vg #使用剩余所有空间 lvcreate -l +100%FREE -n meta_lv dbf2_vg #创建条带卷 lvcreate -L 2G -i2 -I 64 -n meta_lv dbf2_vg

Published
Categorized as linux

what is the difference getContentMd5() and getETag() of aws s3 PutObjectResult

An MD5 hash consists of 16 bytes, but they are not all printable characters. The ETag is the md5 hash, hex-encoded (not base64, as the question suggests) — hex encoding uses 32 characters to encode 16 bytes. Meanwhile, Content-MD5 is the md5 hash, base64 encoded, which uses 24 characters to encode 16 bytes. 答案来源-stackoverflow

Published
Categorized as storage