Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| #!/bin/bash | |
| # ============================================================================== | |
| # Script Name: check_models.sh | |
| # Description: Checks the availability of models from an OpenAI-compatible API | |
| # endpoint. It iterates through all available models, sends a | |
| # test completion request, and reports the status (OK/FAIL). | |
| # It generates a summary grouped by model prefix, a comma-separated | |
| # list of successful models, and logs detailed invocation results | |
| # to a timestamped log file. |
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "testing" | |
| "time" | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| _ "play/app" | |
| "play/tool" | |
| ) | |
| func init() { | |
| fmt.Println("-- in main.init(), my package:", tool.GetCallerPackageName(2)) |
| alias rand_objectid="openssl rand -hex 12" | |
| alias rand_objectid_now='printf "%x%s" $(date +%s) $(openssl rand -hex 8)' | |
| # nifty trick for 3m old objectid | |
| # refernce: https://hashnode.com/post/how-to-generate-a-mongodb-objectid-from-a-date-in-bash-cju8r0ur3001zbns1rx9mvsnw | |
| # note this date command work on mac shell | |
| alias objectid_3m_old='printf "%x0000000000000000" $(date -v -3m +%s)' |
| package main | |
| import ( | |
| "crypto" | |
| "crypto/ecdsa" | |
| "crypto/rsa" | |
| "crypto/sha256" | |
| "crypto/x509" | |
| "encoding/asn1" | |
| "encoding/pem" |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "log" | |
| "net" | |
| "net/http" | |
| "os" |
| package main | |
| import ( | |
| "crypto/ecdsa" | |
| "crypto/elliptic" | |
| crand "crypto/rand" | |
| "crypto/x509" | |
| "encoding/hex" | |
| "fmt" | |
| "math/big" |
| // example at : https://go.dev/play/p/HTDZlSDg1AC | |
| package main | |
| import ( | |
| "bytes" | |
| "crypto/cipher" | |
| "encoding/hex" | |
| "fmt" | |
| "log" |
| // howto run: | |
| // GOARCH=wasm GOOS=js go build -o web/app.wasm && go run . | |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" |