Skip to content

Instantly share code, notes, and snippets.

div[placeholder~="Heading"]::after {
margin-left: 0.5em;
font-size: 0.6em;
vertical-align: middle;
opacity: 0.7;
}
div[placeholder="Heading 1"]::after {
content: "h1";
}
@ImSingee
ImSingee / build-all.sh
Created November 11, 2020 02:24
Go 程序编译脚本,在编译过程中自动加入 Git Tag、Git Commit ID、利用 Git Tag 提取出来的版本信息、编译环境信息、编译时间
#!/bin/bash
set -e
echo Build All
echo Build for linux
(CGO_ENABLED=0 GOOS=linux ./build.sh)
echo Build for windows
(CGO_ENABLED=0 GOOS=windows ./build.sh)
"""
Example:
Input: {
"format": "short",
"label": "Mbps",
"logBase": 1,
"max": null,
"min": null,
"show": true
#!/bin/sh
set -e
is_wsl() {
case "$(uname -r)" in
*microsoft* ) true ;; # WSL 2
*Microsoft* ) true ;; # WSL 1
* ) false;;
esac
}
#!/bin/bash
# install docker (with aliyun yum repo)
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
@ImSingee
ImSingee / save_with_encoding.py
Created July 14, 2020 08:20
以指定编码保存文件
target_encoding = "utf-16"
text = '''
# coding: utf-16
print("你好,世界")
'''
with open("/tmp/utf-16", "w", encoding="utf-16") as f:
f.write(text)
"""
Varint encoder/decoder
varints are a common encoding for variable length integer data, used in
libraries such as sqlite, protobuf, v8, and more.
Here's a quick and dirty module to help avoid reimplementing the same thing
over and over again.
For both python 2 and 3
"""
@ImSingee
ImSingee / README.md
Last active July 2, 2020 07:41 — forked from Ivlyth/README.md
zookeeper / kafka cluster 搭建及 kafka 集群加密认证, 客户端加密认证设置方法

zookeeper 与 kafka 集群设置教程, 作为教程, 下文描述的步骤是在 1台 服务器上部署 启动三个 zookeeper 和 kafka 服务以组成模拟集群, 多机上的注意事项会在相关位置说明

⚠️: 该教程完成于内网 10.0.81.9 这台 sensor 机器, 因此以下步骤中提到的 IP 10.0.81.9, 请在自己实验中更换为自己实验用机器的 IP 地址.
⚠️: 标记 FIXME 的均为在实际环境中需要注意的值(比如 ip, 端口, 文件路径), 其余值新增内容均为固定值

1. 创建必要的测试目录

mkdir -p /data/kafka-cluster-test/{kafka,zookeeper}-data-{1,2,3}

Keybase proof

I hereby claim:

  • I am imsingee on github.
  • I am singee (https://keybase.io/singee) on keybase.
  • I have a public key ASBguY9l2BZrkJ6wjo4vFkzx3dXxAa2VKROLs_e5RTiecAo

To claim this, I am signing this object:

@ImSingee
ImSingee / OmniFocus-计算任务时间.scpt
Created August 26, 2019 13:14
OmniFocus-计算任务时间,计算选中的一个或多个动作/项目的预估时间,如果选中的项目没有设定预估时间则会遍历求和未完成的子项的预估时间
on run {}
tell application "OmniFocus"
tell content of first document window of front document
set validSelectedItemsList to value of (selected trees where class of its value is not item and class of its value is not folder)
-- 未选择
if (count of validSelectedItemsList) is 0 then
display alert "未选择任何项" message "请选择一个或多个动作/项目后重试" as critical
return
end if