Docker PHP7.4 安装 Intl 扩展
执行下列命令在Docker的命令行中即可完成安装。
RUN set -xe \
&& apk add --update \
icu \
&& apk add --no-cache --virtual .php-deps \
make \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
zlib-dev \
icu-dev \
g++ \
&& docker-php-ext-configure intl \
&& docker-php-ext-install \
intl \
&& docker-php-ext-enable intl \
&& { find /usr/local/lib -type f -print0 | xargs -0r strip --strip-all -p 2>/dev/null || true; } \
&& apk del .build-deps \
&& rm -rf /tmp/* /usr/local/lib/php/doc/* /var/cache/apk/*
Pyinstaller 窗口模式下 subprocess.check_output 运行出错
在窗口模式下调用子进程时需要定义 stdin 和 stderr。这是因为如果这些句柄未设置为 null,Windows 会尝试复制它们。
hsbs = \
subprocess.check_output('cd %SystemRoot%\System32\Wbem\ && wmic csproduct get uuid', shell=True, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL).decode().split('\n')[
1].strip()
MongoDB 去重复数据 大量数据
去除 datas
表中 $leaf_cert.fingerprint
字段出现重复的文档记录, 并且开启了磁盘占用,避免遇到内存16MB限制
db.getCollection("datas").aggregate([
{
$group:{_id:{fingerprint:'$leaf_cert.fingerprint'},count:{$sum:1},dups:{$addToSet:'$_id'}}
},
{
$match:{count:{$gt:1}}
}
], { allowDiskUse: true }).forEach(function(it){
it.dups.shift();
db.getCollection("datas").remove({_id: {$in: it.dups}});
})
Mongodb 删除指定数量的特定条件记录
每次删除10000条记录
db.certificate.find({update_person: 'Baidu'}).limit(10000).forEach(doc=>{
db.certificate.remove({_id: doc._id})
})