Skip to content

Instantly share code, notes, and snippets.

View JackyCZJ's full-sized avatar
🎯
Focusing

Jacky Chan JackyCZJ

🎯
Focusing
View GitHub Profile
@JackyCZJ
JackyCZJ / main_test.go
Last active March 6, 2023 02:12
AT+QCFG Band Calculation
package test
import (
"math/big"
"reflect"
"strconv"
"testing"
)
//How to calculate the band mask greater than 64 for AT+QCFG="band"
@JackyCZJ
JackyCZJ / Makefile
Last active November 29, 2022 08:00
How to cross compile an openwrt CGO program
TARGET= GreatCGOProgram
OPENWRT_SDK=/home/user/openwrt
STAGING_DIR=$(OPENWRT_SDK)/staging_dir
CC=$(BUILD_DIR)/$(OPENWRT_SDK)/staging_dir/$(toolchain_dir)/bin/$(ARCH)-openwrt-linux-gcc
# example:
# toolchain-aarch64_cortex-a53+crypto_gcc-8.4.0_musl
# aarch64-openwrt-linux-gcc
@JackyCZJ
JackyCZJ / protobuf_enc.go
Created June 15, 2020 02:49
nats protobuf encoding
package protobuf_nats
import (
"errors"
"github.com/nats-io/nats.go"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
@JackyCZJ
JackyCZJ / publish.go
Last active July 2, 2020 10:17
looper
viper.SetDefault("push.frequency", 100)
d.timer = time.NewTicker(viper.GetDuration("push.frequency") * time.Millisecond)
//Make interface for netInterface we need to watch.
for bn := range bCache {
if d.InterfaceCache[bn] == nil {
inter, err := net.InterfaceByName(bn)
if err != nil {
return
}
d.InterfaceCache[bn] = inter