Abel'Blog

我干了什么?究竟拿了时间换了什么?

0%

概述

go-zero 包含极简的 API 定义和生成工具 goctl,可以根据定义的 api 文件一键生成 Go, iOS, Android, Kotlin, Dart, TypeScript, JavaScript 代码,并可直接运行。

使用 go-zero 的好处:

  • 轻松获得支撑千万日活服务的稳定性
  • 内建级联超时控制、限流、自适应熔断、自适应降载等微服务治理能力,无需配置和额外代码
  • 微服务治理中间件可无缝集成到其它现有框架使用
  • 极简的 API 描述,一键生成各端代码
  • 自动校验客户端请求参数合法性
  • 大量微服务治理和并发工具包
阅读全文 »

概述

皮肤湿疹

糠酸莫米松软膏+莫匹罗星软膏 1:1

认知障碍

石杉碱甲片

概述

vcpkg 是一个 C++ 包管理器,用于 Windows、Linux 和 macOS。它由 Microsoft 维护,并支持大量的 C++ 库。使用 vcpkg,你可以轻松地安装、升级和管理 C++ 依赖库。

实践

安装 vcpkg

git clone https://github.com/microsoft/vcpkg

./bootstrap-vcpkg.sh
./vcpkg —version
vcpkg package management program version 2024-04-23-d6945642ee5c3076addd1a42c331bbf4cfc97457

See LICENSE.txt for license information.

vcpkg integrate bash
Adding vcpkg completion entry to /home/abel/.bashrc.

将目录增加到 PATH 里面方便运行。

尝试基本操作

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

vcpkg search boost

vcpkg
usage: vcpkg <command> [--switches] [--options=values] [arguments] @response_file
@response_file Contains one argument per line expanded at that location

Package Installation:
export Creates a standalone deployment of installed ports
install Installs a package
remove Uninstalls a package
x-set-installed Installs, upgrades, or removes packages such that that installed matches
exactly those supplied
upgrade Rebuilds all outdated packages

Package Discovery:
x-check-support Tests whether a port is supported without building it
depend-info Displays a list of dependencies for ports
list Lists installed libraries
owns Searches for the owner of a file in installed packages
x-package-info Display detailed information on packages
portsdiff Diffs changes in port versions between commits
search Searches for packages available to be built
update Lists packages that can be upgraded

Package Manipulation:
add Adds dependency to manifest
x-add-version Adds a version to the version database
create Creates a new port
edit Edits a port, optionally with $EDITOR, defaults to "code"
env Creates a clean shell environment for development or compiling
format-manifest Prettyfies vcpkg.json
hash Gets a file's SHA256 or SHA512
x-init-registry Creates a blank git registry
new Creates a new manifest
x-update-baseline Updates baselines of git registries in a manifest to those registries' HEAD
commit

Other:
ci Tries building all ports for CI testing
x-ci-verify-versions Checks integrity of the version database
contact Displays contact information to send feedback
fetch Fetches something from the system or the internet
integrate Integrates vcpkg with machines, projects, or shells

For More Help:
help topics Displays full list of help topics
help <topic> Displays specific help topic
help commands Displays full list of commands, including rare ones not listed here
help <command> Displays help detail for <command>

For more help (including examples) see https://learn.microsoft.com/vcpkg

build

1
2
3
4
# 设置好 VCPKG_ROOT 环境变量
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
# 当找不到 cmake 文件的时候,可以直接去目录里面搜索一下 *.cmake ,就能解决问题了
${VCPKG_ROOT}/packages/boost-test_xxx/

不要去使用,因为没有用。

1
2
set(CMAKE_TOOLCHAIN_FILE "/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")

引用

简介

golang在处理网络数据的时候,有天然的优势,这里记录一下如何使用golang来实现网络编程。

阅读全文 »

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import (
"bytes"
"crypto/des"
"errors"
)

// DESedeECBEncrypt ...
func DESedeECBEncrypt(origData, key []byte) ([]byte, error) {
tkey := make([]byte, 24, 24)
copy(tkey, key)
k1 := tkey[:8]
k2 := tkey[8:16]
k3 := tkey[16:]

buf1, err := encrypt(origData, k1)
if err != nil {
return nil, err
}
buf2, err := decrypt(buf1, k2)
if err != nil {
return nil, err
}
out, err := encrypt(buf2, k3)
if err != nil {
return nil, err
}
return out, nil
}

// DESedeECBDecrypt ...
func DESedeECBDecrypt(crypted, key []byte) ([]byte, error) {
tkey := make([]byte, 24, 24)
copy(tkey, key)
k1 := tkey[:8]
k2 := tkey[8:16]
k3 := tkey[16:]
buf1, err := decrypt(crypted, k3)
if err != nil {
return nil, err
}
buf2, err := encrypt(buf1, k2)
if err != nil {
return nil, err
}
out, err := decrypt(buf2, k1)
if err != nil {
return nil, err
}
return out, nil
}

func encrypt(origData, key []byte) ([]byte, error) {
if len(origData) < 1 || len(key) < 1 {
return nil, errors.New("wrong data or key")
}
block, err := des.NewCipher(key)
if err != nil {
return nil, err
}
bs := block.BlockSize()
if len(origData)%bs != 0 {
return nil, errors.New("wrong padding")
}
out := make([]byte, len(origData))
dst := out
for len(origData) > 0 {
block.Encrypt(dst, origData[:bs])
origData = origData[bs:]
dst = dst[bs:]
}
return out, nil
}

func decrypt(crypted, key []byte) ([]byte, error) {
if len(crypted) < 1 || len(key) < 1 {
return nil, errors.New("wrong data or key")
}
block, err := des.NewCipher(key)
if err != nil {
return nil, err
}
out := make([]byte, len(crypted))
dst := out
bs := block.BlockSize()
if len(crypted)%bs != 0 {
return nil, errors.New("wrong crypted size")
}

for len(crypted) > 0 {
block.Decrypt(dst, crypted[:bs])
crypted = crypted[bs:]
dst = dst[bs:]
}

return out, nil
}

引用