This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Execution sequence: | |
1) main | |
2) writeExcel | |
3) writeWheet | |
4) iteration write row | |
*/ | |
package main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func merge[T any, C chan T](cs ...C) C { | |
out := make(C) | |
var wg sync.WaitGroup | |
wg.Add(len(cs)) | |
for i := range cs { | |
go func(c C) { | |
defer wg.Done() | |
for value := range c { | |
out <- value | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func NewBufferPool(bufsize int) BufferPool { | |
if bufsize <= 0 { | |
bufsize = bytes.MinRead | |
} | |
return BufferPool{pool: &sync.Pool{New: func() any { | |
return bytes.NewBuffer(make([]byte, 0, bufsize)) | |
}}} | |
} | |
type BufferPool struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"encoding/pem" | |
"fmt" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DateTime time.Time | |
const iso8601 = "2006-01-02 15:04:05Z07:00" | |
func (dt DateTime) AsTime() time.Time { | |
return time.Time(dt) | |
} | |
func (dt DateTime) Format(layout string) string { | |
return dt.AsTime().Format(layout) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/hmac" | |
"crypto/rand" | |
"crypto/sha512" | |
"encoding/base64" | |
"errors" | |
"hash/fnv" | |
"io" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"time" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workers = 2; | |
devices: ( | |
{ | |
name: "Wireless Mobile Mouse MX Anywhere 2S"; | |
smartshift: | |
{ | |
on: true; | |
threshold: 0; | |
default_threshold: 0; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
set -e | |
# llvm-profdata is required for a --enable-optimizations build but could not be found. | |
export PATH="$PATH:/usr/lib/llvm-18/bin/" | |
export CC="clang" | |
export CXX="clang++" | |
export LD="lld" | |
export LLVM=1 | |
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y build-essential gdb lcov pkg-config \ | |
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \ |
OlderNewer