Skip to content

Instantly share code, notes, and snippets.

@js2854
js2854 / update-vscode-server.sh
Last active December 20, 2019 01:34
Manually download updates to resolve stuck problem on the step of downloading vscode-server-linux-x64.tar.gz with wget
#!/bin/bash
# Reference https://github.com/microsoft/vscode-remote-release/issues/680
if [ $# -lt 1 ]; then
echo "Usage: $0 sha"
echo "Demo: $0 26076a4de974ead31f97692a0d32f90d735645c0"
exit 0
fi
sha=$1
@js2854
js2854 / binlog.txt
Last active April 7, 2021 07:27
查看mysql是否开启binlog,log_bin为ON表示开启了binlog,binlog_format为ROW表示是ROW模式,binlog_row_image为FULL
MariaDB [phone_property]> show variables like '%log_bin%';
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| forbid_remote_change_sql_log_bin | ON |
| log_bin | ON |
| log_bin_trust_function_creators | ON |
| sql_log_bin | ON |
+----------------------------------+-------+
4 rows in set (0.00 sec)
@js2854
js2854 / compress_test.go
Last active January 5, 2022 06:34
compress/uncompress protobuf benchmark test
package main
import (
"bytes"
"compress/flate"
"compress/gzip"
"compress/zlib"
"io/ioutil"
"math/rand"
"testing"
@js2854
js2854 / jsoniter_ext.go
Last active June 28, 2022 12:00
jsoniter ignore omitempty
import jsoniter "github.com/json-iterator/go"
type NotOmitemptyValEncoder struct {
encoder jsoniter.ValEncoder
}
func (codec *NotOmitemptyValEncoder) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) {
codec.encoder.Encode(ptr, stream)
}