Go - Pad a number with zeros when printing
摘要:func main() { counter := 0 var str string for _, i := range []byte("foobar") { letterBin := fmt.Sprintf("%08b", i) fmt.Println(letterBin) str = str +
阅读全文
Redis Commands - GETRANGE SETRANGE
摘要:Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the curren
阅读全文
Redis - Why is Redis fast?
摘要:存储模式:基于内存实现,而非磁盘 数据结构:基于不同业务场景的高效数据结构 动态字符串(REDIS_STRING):整数(REDIS_ENCODING_INT)、字符串(REDIS_ENCODING_RAW) 双端列表(REDIS_ENCODING_LINKEDLIST) 压缩列表(REDIS_EN
阅读全文
RedisJSON
摘要:127.0.0.1:6379> JSON.GET store $..headphones[?(@price<70&&@wireless==true)] [{"id":12346,"name":"Wireless earbuds","description":"Wireless Bluetooth i
阅读全文
Docker - Clear Cache
摘要:A short refresher on Docker caching Docker uses layer caching to reuse previously computed build results. Each instruction in a Dockerfile is associat
阅读全文
Virtualbox - VM can't start after OS software update
摘要:Executing 'modprobe vboxdrv' didn't work: zzh@ZZHPC:~$ sudo modprobe vboxdrv modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/6.5.0
阅读全文
Go - struct instance
摘要:func TestLoadConfig(t *testing.T) { var config Config fmt.Printf("%+v", config) require.Nil(t, config) } RUN TestLoadConfig {Environment:} /zdata/Gith
阅读全文
Goenv
摘要:git clone https://github.com/go-nv/goenv.git ~/.goenv echo 'export GOENV_ROOT="
HOME/.goenv"′>> /.bashrcecho′exportPATH="GOENV_ROOT/bin:$PATH"'
阅读全文