Skip to content

Instantly share code, notes, and snippets.

@bowin
bowin / gist:7426980833dd8e98bdcee51c9b89e57b
Last active April 16, 2021 06:07
bitmap 索引 protobuf 数据结构

先用bitmap来标记哪些field存在,每个field只占1bit,按1000个field来算只需要125个字节的开销,然后存在的field记录偏移,每个偏移4个字节。还可以采用inline value的方式进一步优化空间,低于4字节的field可以将value直接记录在偏移字段,不需要额外的偏移存储。

按照现在的物料数据进行测试:===>新数据格式空间大小=>inline优化后的空间大小(inline优化比率) 从数据可以看出,能够将单条物料控制在5K大小,inline的能够平均优化5%空间,1000万物料大概50G内存。

package com.weibo.hotwb.inspect;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@bowin
bowin / x.md
Last active December 1, 2019 04:38
动作分类

动作分类

一共6个动作

train Loss: 0.5457 Acc: 0.8125 val Loss: 1.7839 Acc: 0.6552

kubeadm, kubelet kubectl 安装

  • kubeadm: the command to bootstrap the cluster.
  • kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers.
  • kubectl: the command line util to talk to your cluster.

离线安装

apt-get -d, --download-only 只下载

apt-get install -d kubeadm kubelet kubectl
@bowin
bowin / 自建docker registry.md
Last active October 28, 2017 07:42
自建docker registry

启动registry服务

docker run -d -p 5000:5000 --name registry registry

pull-tag-push到registry

docker pull ubuntu
docker tag ubuntu domain/ubuntu
docker push domain/ubuntu
@bowin
bowin / Node.js execute lua command.md
Last active October 18, 2017 07:30
Node.js execute lua command

clean keys

client.eval("return redis.call('del', unpack(redis.call('keys', KEYS[1])))", 1, 'sess:1*')

set key value

client.eval("return redis.call('set', KEYS[1], ARGV[1])", 1, 'key1', 'value1')
@bowin
bowin / node.js PassThrough stream.md
Last active November 15, 2022 00:02
Node.js Stream PassThrough Usage
const {PassThrough} = require('stream')
const fs = require('fs')

const d = new PassThrough()  

fs.createReadStream('tt2.js').pipe(d)  // can be piped from reaable stream

d.pipe(process.stdout)                 // can pipe to writable stream 
d.on('data', console.log) // also like readable
@bowin
bowin / 试戴第三方接口文档.md
Last active March 6, 2017 23:41
试戴第三方接口文档.md

试戴第三方接口文档

具有开发能力的试戴客户,可以将自有商品通过本文档提供的接口接入eglass试戴系统

保存试戴图片接口

  • url
    'https://epeijing.cn/api/save-try-images'
  • method
    'POST'
  • body为application/json,格式如下