不会飞的章鱼

熟能生巧,勤能补拙;念念不忘,必有回响。

Docker安装Kafka服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
docker pull wurstmeister/zookeeper

docker run -d --name zookeeper -p 2181:2181 -e TZ="Asia/Shanghai" --restart always wurstmeister/zookeeper

docker pull wurstmeister/kafka


# docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=<这里换成你的zookeeper地址和端口> -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://<这里换成你的kafka地址和端口> -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 -e TZ="Asia/Shanghai" wurstmeister/kafka
docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 -e TZ="Asia/Shanghai" wurstmeister/kafka



docker run -d --name kafka -p 9092:9092 -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=172.17.0.3:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 wurstmeister/kafka


  • -e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181:指定 Zookeeper 的地址和端口,这里使用本地地址 127.0.0.1 和默认端口 2181。
  • -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092:将 Kafka 服务器的地址和端口设置为 127.0.0.1:9092。
  • -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092:指定 Kafka 监听的地址和端口为 0.0.0.0:9092,允许外部访问。
  • -p 9092:9092:将容器内部的 9092 端口映射到主机的 9092 端口,允许通过主机的 127.0.0.1:9092 访问 Kafka 服务器。

安装Kafka客户端

1
2
3
docker pull nickzurich/efak:latest

docker run -d --name kafka-eagle -p 8048:8048 -e EFAK_CLUSTER_ZK_LIST="172.17.0.3:2181" nickzurich/efak:latest
阅读全文 »

安装NiFi

1
brew install nifi

启动NiFi

第一次登录

1
nifi start
阅读全文 »

我们登上并非我们所选择的舞台,演出并非我们所选择的剧本。 ——古希腊哲学家艾比克泰德

坏小孩的剧本

上初一前,我想我拿到的都是一个叫做坏小孩的剧本,剧本上说,我很聪明,活泼好动,广交朋友,爱打游戏,
所以学校作业其实可以不用写的,第二天早上早点去抄就行了。于是,游戏厅和台球桌成了我放学后经常光顾的场所
因为我家对面就是游戏厅,所以进出很方便,但我知道我没有钱去消费,于是就开始了白嫖,只要脸皮厚一些,其他人
玩得还剩十几分钟到期时,我就会接上,同时也充当起了免费的CS1.6游戏和台球陪练,由于机动性强,服务态度好,
演技真实 ,广受玩家好评。

在学校时,我记得语数英外加班主任的课是不敢轻举妄动的,其他课随意,所以我当时非常期待的课程就是
副课和体育课了。

中午吃完饭,可以和班里同学打球打到午休结束,甚至第一节课上课前经常迟到,到时编造一个理由就行。
这样美好的一天就已经过半了,放学了还有游戏厅和台球桌在召唤我。

阅读全文 »

思路

代码

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
#include <ctype.h>
#include <cs50.h>
#include <stdio.h>
#include <string.h>

// Points assigned to each letter of the alphabet
int POINTS[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10};

int compute_score(string word);

int small_letters[] = {97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122};

int capital_letters[] = {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};

int temp_Points [] = {};

int main(void)
{
// Get input words from both players
string word1 = get_string("Player 1: ");
string word2 = get_string("Player 2: ");

// Score both words
int score1 = compute_score(word1);
int score2 = compute_score(word2);

// TODO: Print the winner
if (score1 > score2)
{
printf("Player 1 wins!");
}
else if (score1 == score2)
{
printf("Tie!");
}
else
{
printf("Player 2 wins!");
}
}

int compute_score(string word)
{
// TODO: Compute and return score for string
int score = 0;
for (int i = 0; i < strlen(word); i++)
{
if (isupper(word[i]))
{
for (int f = 0; f < sizeof(capital_letters); f++)
{
if (word[i] == capital_letters[f])
{
temp_Points[i] = POINTS[f];
score += temp_Points[i];
}
}
}
else if (islower(word[i]))
{
for (int f = 0; f < sizeof(small_letters); f++)
{
if (word[i] == small_letters[f])
{
temp_Points[i] = POINTS[f];
score += temp_Points[i];
}
}
}
else
{
i += 1;
}
}

return score;
}

思路

  • 获取startSizeendSize
  • 使用do while做好范围限制
1
2
3
4
5
6
int n;
do
{
n = get_int("Positive Integer: ");
}
while (n < 1);
  • 使用if语句判断startSizeendSize是否相等
  • 如果相等,输出Years为0
  • 如果不相等,根据出生人数➗3,死亡人数➗4,每计算一次Years加1

代码

阅读全文 »

安装MQTT服务器

1
2
3
4
5
6
7
8
9
10
11
# 安装 Mosquitto MQTT 服务器
brew install mosquitto

# 启动 Mosquitto 服务器
brew services start mosquitto
==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)

# 验证 Mosquitto 服务器是否正在运行
brew services list
Name Status User File
mosquitto started * *

安装MQTT客户端

访问github-MQTTX,找到MQTTX-1.9.6-arm64.pkg下载安装即可。

然后就可以看到有个MQTTX的图标,表示MQTT客户端安装成功。

阅读全文 »

运行 EdgeX

1
2
3
4
# ARM 架构
$ curl https://raw.githubusercontent.com/edgexfoundry/edgex-compose/v3.0/docker-compose-no-secty-arm64.yml -o docker-compose.yml; docker compose up -d
# x86 架构
$ curl https://raw.githubusercontent.com/edgexfoundry/edgex-compose/v3.0/docker-compose-no-secty.yml -o docker-compose.yml; docker compose up -d

访问localhost:4000

运行成功!

阅读全文 »

level 1

Send an HTTP request using curl

1
2
$ curl http://127.0.0.1:80
pwn.college{sc9zRb7KF1lZSGtDWOxSGGTAeYp.dhjNyMDL3ATN3MzW}

level 2

Send an HTTP request using nc

阅读全文 »