终端上扫用户的付款码,肯定没清键盘缓冲。。。所以,微信的付款码36位72位什么的全来了。。偏偏终端的哥们兼职的,只星期天处理公事。
能怎么样,擦屁股呗。。

{"level":"DEBUG","time":"2024-04-02T15:32:39.662+0800","app_id":"xxxxxxxx","msg":"placeorder: cartdata:xxxxxxx,amount:2500,barcode:131014308497832446131014308497832446"}

    if len(barcode) > 18 && len(barcode)%18 == 0 {
        times18 := len(barcode) / 18
        log.Log.Debugf("[%s] Buggy! Barcode is %d times 18, cutting it to 18", orderno, times18)
        barcode = barcode[(times18-1)*18 : times18*18]
    }

太方便了,我以前居然不知道,还得让gpt教我

type Config struct {
    Database struct {
        User          string `yaml:"user"`
    } `yaml:"database"`
}
var GlobalConfig Config

executablePath, _ := os.Executable()
yamlPath := filepath.Join(filepath.Dir(executablePath), "xxxx.yaml")
yamlFile, _ := os.ReadFile(yamlPath)
yaml.Unmarshal(yamlFile, &GlobalConfig)
fmt.Printf("User: %s\n",GlobalConfig.Database.User)

平时很反感这个,不过受不住低价的诱惑啊。
以前一直用阿里香港轻量一个月的24的机器(2C1G)来做跳板访问国内机器。这罗永浩直播,168一年,2C4G,虽然带宽只有5M,不过我就ssh什么的,5M够了。等于1个月便宜了10块,内存还多了3G,1G装个lnmp都够呛,4G就妥妥的。价格绝对值不多,比例大啊。

168.jpg

在github copilot配合加成下,改得还蛮快的。
sqlx没啥不好,我只不过就想用用gorm,和前些年刚好想反,当时是不用gorm用sqlx。
闲,都是闲出来的。

gorm.jpg

CPU极其拉跨,也不排除是运行YABS高占用后自动限制了
其它都还可以。其实往往最不重要的就是CPU,运算能力过剩,所以,用起来感觉还好了。


# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2024-03-05                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Sun Mar 24 12:39:03 AM +08 2024

Basic System Information:
---------------------------------
Uptime     : 2 days, 10 hours, 15 minutes
Processor  : QEMU Virtual CPU version 2.5+
CPU cores  : 4 @ 2294.576 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ❌ Disabled
RAM        : 3.8 GiB
Swap       : 0.0 KiB
Disk       : 118.0 GiB
Distro     : Debian GNU/Linux 12 (bookworm)
Kernel     : 6.1.0-18-amd64
VM Type    : KVM
IPv4/IPv6  : ✔ Online / ❌ Offline

IPv4 Network Information:
---------------------------------
ISP        : netcup GmbH
ASN        : AS197540 netcup GmbH
Host       : netcup GmbH
Location   : Nuremberg, Bavaria (BY)
Country    : Germany

fio Disk Speed Tests (Mixed R/W 50/50) (Partition /dev/vda3):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 74.15 MB/s   (18.5k) | 1.24 GB/s    (19.4k)
Write      | 74.34 MB/s   (18.5k) | 1.25 GB/s    (19.5k)
Total      | 148.50 MB/s  (37.1k) | 2.49 GB/s    (39.0k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 1.67 GB/s     (3.2k) | 1.98 GB/s     (1.9k)
Write      | 1.76 GB/s     (3.4k) | 2.11 GB/s     (2.0k)
Total      | 3.44 GB/s     (6.7k) | 4.09 GB/s     (3.9k)

iperf3 Network Speed Tests (IPv4):
---------------------------------
Provider        | Location (Link)           | Send Speed      | Recv Speed      | Ping
-----           | -----                     | ----            | ----            | ----
Clouvider       | London, UK (10G)          | 1.08 Gbits/sec  | 928 Mbits/sec   | 22.6 ms
Eranium         | Amsterdam, NL (10G)       | 1.08 Gbits/sec  | 938 Mbits/sec   | 11.0 ms
Telia           | Helsinki, FI (10G)        | 1.07 Gbits/sec  | 935 Mbits/sec   | 32.2 ms
Uztelecom       | Tashkent, UZ (10G)        | 397 Mbits/sec   | 746 Mbits/sec   | 107 ms
Leaseweb        | Singapore, SG (10G)       | 831 Mbits/sec   | 733 Mbits/sec   | 257 ms
Clouvider       | Los Angeles, CA, US (10G) | 966 Mbits/sec   | 326 Mbits/sec   | 148 ms
Leaseweb        | NYC, NY, US (10G)         | 1.01 Gbits/sec  | 711 Mbits/sec   | 91.9 ms
Edgoo           | Sao Paulo, BR (1G)        | 908 Mbits/sec   | 202 Mbits/sec   | 178 ms

Running GB6 benchmark test... *cue elevator music*
Geekbench 6 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 416
Multi Core      | 875
Full Test       | https://browser.geekbench.com/v6/cpu/5436597