Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
build

clip binderclip

👨‍💻
build
  • Beijing
View GitHub Profile
View README.md

golang 结构体内部变量被引用实验

结论

struct 的某个 filed 被引用的时候 struct 本身就不会被垃圾回收器回收。

操作步骤

$ go run memtest.go -cpuprofile cpu.pprof -memprofile mem.pprof
View pre-commit
#!/bin/sh
exit_code=0
goimports_fix() {
hash goimports 2>&- || { echo >&2 "goimports not in PATH."; exit 1; }
for file in `git diff --cached --name-only --diff-filter=d | grep -v vendor | grep '\.go$'`
do
if [[ ! -z `git diff --name-only ${file} | grep '\.go$'` ]]
View decoded-binlog-sample.txt
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#190521 22:03:48 server id 1 end_log_pos 123 CRC32 0x9a9ea66e Start: binlog v 4, server v 5.7.25-28-log created 190521 22:03:48 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
# at 123
#190521 22:03:48 server id 1 end_log_pos 154 CRC32 0xc13e82af Previous-GTIDs
# [empty]
@binderclip
binderclip / pinyin-to-emoji.json
Created January 11, 2019 09:57
汉字 pinyin emoji
View pinyin-to-emoji.json
{"e":"🐊","ai":"❤️","er":"👂","ba":"🎱","bo":"🍍","bi":"🖋","bu":"🙅‍♂️","bai":"💯","bao":"🎒","ban":"🔧","bang":"🍭","bei":"🐚","ben":"📒","biao":"⌚️","bian":"🦇","bie":"🧷","bin":"🍾","bing":"🍧","pa":"👏","pi":"🍺","pu":"🍇","pai":"🏓","pao":"🏃‍♂️","pan":"🍽","pen":"⛲️","peng":"⛺️","piao":"🐞","pin":"🧩","ping":"🍎","ma":"🐴","mo":"🍄","mi":"🍯","mai":"🎙","mao":"🐈","man":"🈵","mang":"🥭","mei":"🍓","men":"🚪","meng":"🍋","miao":"🐱","mian":"🍜","mie":"🧯","fa":"👩‍⚖️","fu":"🗻","fan":"🍚","fang":"🏠","fei":"✈️","feng":"🐝","da":"🖨","de":"🉐","di":"🌎","du":"🦄","dai":"🦘","dao":"🔪","dan":"🥚","dong":"🕳","deng":"💡","diao":"🎣","dian":"⚡️","die":"🦋","ding":"🔝","dui":"✔️","dun":"🛡","ta":"🗼","tu":"🐇","tai":"☯️","tao":"🍑","tang":"🍬","tong":"🛢","tiao":"💃","tian":"😛","tie":"🛤","ting":"⏹","tuan":"🍙","tui":"🦵","tun":"🐬","tuo":"🐪","nv":"🚺","nai":"🍼","nao":"🧠","nan":"🚹","nang":"💊","nong":"👩‍🌾","nei":"👙","niao":"🐦","niu":"🐂","ning":"🍋","niang":"👰","la":"🌶","li":"🍐","lu":"🦌","lv":"💚","lao":"🧀","lan":"🏀","lang":"🐺","lou":"🏢","long":"🐉","lei":"⚡️","leng":"🥶","lian":
@binderclip
binderclip / reminder.md
Last active July 13, 2018 08:04
slackbot usage snippets
View reminder.md

check list

/remind list

“@channel to do something”

/remind # @channel Time to go eat lunch 12:15 every weekday 
@binderclip
binderclip / atfield.py
Created May 25, 2018 08:20 — forked from cadl/atfield.py
atfield
View atfield.py
# coding: utf-8
import functools
import time
from threading import local
from collections import deque
class ATFieldException(Exception):
pass
@binderclip
binderclip / weapp_msgs.txt
Created March 12, 2018 06:34
微信小程序客服消息格式
View weapp_msgs.txt
// 从小程序进入客服消息会话(明文 + 加密模式)
{
"ToUserName": "gh_eeeeeeeeeeee",
"FromUserName": "o222222222222222222222222222",
"CreateTime": 1520836271,
"MsgType": "event",
"Event": "user_enter_tempsession",
"SessionFrom": "...",
"Encrypt": "oMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM="
}
@binderclip
binderclip / xiaoe-miniapp-app-config.json
Created March 9, 2018 02:47
小鹅通小程序 app-config.json
View xiaoe-miniapp-app-config.json
{
"page": {
"page/home/home_index/home_index.html": {
"window": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": true
}
},
"page/home/message/message.html": {
"window": {
@binderclip
binderclip / wechat_mp_msgs.txt
Last active March 26, 2018 09:31
微信服务号请求消息格式
View wechat_mp_msgs.txt
// 本来的数据是 XML 的,手动转换成了 json 格式
// 文本消息
{
"ToUserName": "gh_555555555555",
"FromUserName": "o3QQQQQQQQQQQQQQQQQQQQQQQQQQ",
"CreateTime": "1520247736",
"MsgType": "text",
"Content": "红包",
"MsgId": "6529414308333333333"