-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
秦宏有
committed
Jun 10, 2024
1 parent
c82b372
commit ff02051
Showing
10 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,16 @@ https://discordpy.readthedocs.io/en/stable/api.html?highlight=on_message#discord | |
https://github.com/discord/discord-api-docs/blob/main/docs/interactions/Application_Commands.md | ||
|
||
## 导出环境包 | ||
|
||
pip freeze > requirements.txt | ||
|
||
## nsq 教程 | ||
|
||
https://www.cnblogs.com/yezigege/p/13791476.html | ||
|
||
## 远程端口映射 | ||
ssh -R 9914:47.101.161.124:9914 [email protected] | ||
|
||
ssh -L 9914:47.101.161.124:9914 [email protected] | ||
|
||
## ChatGPT&Midjounery 第三方技术文章 | ||
|
||
|
@@ -43,15 +45,14 @@ https://zhuanlan.zhihu.com/p/643189533 | |
git config --global --unset http.proxy | ||
git config --global --unset https.proxy | ||
|
||
## docker安装(centor) | ||
## docker 安装(centor) | ||
|
||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 | ||
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
sudo yum install docker-ce docker-ce-cli containerd.io | ||
sudo systemctl start docker | ||
sudo systemctl enable docker | ||
|
||
## 安装制定的docker-compose版本 | ||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
|
||
|
||
## 安装制定的 docker-compose 版本 | ||
|
||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from config.toml import load_cfg | ||
from config.config_manager import ConfigManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class ConfigManager: | ||
_instance = None | ||
cfg = None | ||
|
||
def __new__(cls, *args, **kwargs): | ||
if not cls._instance: | ||
cls._instance = super(ConfigManager, cls).__new__(cls, *args, **kwargs) | ||
return cls._instance | ||
|
||
@classmethod | ||
def set_cfg(cls, cfg): | ||
cls.cfg = cfg | ||
|
||
@classmethod | ||
def get_cfg(cls): | ||
return cls.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import nsq | ||
import tornado.ioloop | ||
import time | ||
|
||
|
||
def pub_message(): | ||
message = time.strftime("%H:%M:%S").encode("utf-8") # Encode the message to bytes | ||
writer.pub("test", message, finish_pub) | ||
|
||
|
||
def finish_pub(conn, data): | ||
print(data) | ||
|
||
|
||
writer = nsq.Writer(["47.101.161.124:9912"]) | ||
tornado.ioloop.PeriodicCallback(pub_message, 1000).start() | ||
nsq.run() |