Abel'Blog

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

0%

概述

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

引用

简介

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
}

引用

简介

SQLite 是一种轻量级的嵌入式数据库管理系统。以下是一些关于 SQLite 的简单介绍:

  1. 类型: SQLite 是一种关系型数据库,支持 SQL 查询语言。

  2. 嵌入式: SQLite 是嵌入式数据库,意味着它以库的形式直接嵌入到应用程序中,而不需要单独的数据库服务器。

  3. 轻量级: SQLite 的设计目标之一是轻量级,适用于资源受限的环境,如嵌入式系统和移动设备。

  4. 零配置: 不需要独立的配置过程或管理者。创建数据库并开始使用非常简单。

  5. 自包含文件: 数据库以单一的文件形式存在,方便传输、备份和分享。

  6. 事务支持: 支持事务,可以确保数据的完整性和一致性。

  7. 跨平台: 支持多种操作系统,包括 Windows、Linux、macOS 等。

  8. 开源: SQLite 是开源的,遵循公共领域协议,可以免费用于商业和个人项目。

  9. 适用场景: 由于其轻量级和嵌入式特性,SQLite 在移动应用、嵌入式系统、桌面应用等场景中广泛应用。

SQLite 是一个简单、易用且功能齐全的数据库系统,非常适合需要一个轻量级、嵌入式数据库的应用场景。

阅读全文 »

概述

Automatically generate RESTful API documentation with Swagger 2.0 for Go.

swag.io

阅读全文 »

概述

Prometheus:负责采集和存储监控数据,支持多维度查询和告警规则。

Grafana:提供数据可视化和仪表板功能,与多种数据源集成,用于创建自定义监控视图。

Alertmanager:处理来自 Prometheus 的告警通知,执行用户定义的操作,帮助及时响应和解决异常情况。

阅读全文 »

Kibana 是一个用于数据可视化和交互的开源工具,它与 Elasticsearch 一起构成了 Elastic Stack(ELK Stack)的一部分。ELK Stack 是一套用于搜索、分析和可视化大规模数据的解决方案。

Elasticsearch 是一个分布式、开源的搜索和分析引擎,构建在 Apache Lucene 基础之上。它提供了一个强大的全文搜索引擎,可以处理大规模数据集,支持实时搜索和分析。Elasticsearch 属于 Elastic Stack(ELK Stack)的一部分,与 Logstash 和 Kibana 一起构成了一个完整的解决方案,用于处理、分析和可视化大量数据。