Skip to content

Commit 6f3ea87

Browse files
committed
worker: CF worker
Signed-off-by: LetMeFly666 <[email protected]>
1 parent 9f3a286 commit 6f3ea87

16 files changed

+364
-10
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* @Author: LetMeFly
3+
* @Date: 2024-12-09 16:57:48
4+
* @LastEditors: LetMeFly.xyz
5+
* @LastEditTime: 2024-12-09 16:58:00
6+
*/
7+
#ifdef _WIN32
8+
#include "_[1,2]toVector.h"
9+
#endif
10+
11+
class Solution {
12+
public:
13+
bool squareIsWhite(string coordinates) {
14+
return coordinates[0] % 2 != coordinates[1] % 2;
15+
}
16+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* @Author: LetMeFly
3+
* @Date: 2024-12-09 17:12:46
4+
* @LastEditors: LetMeFly.xyz
5+
* @LastEditTime: 2024-12-09 17:14:32
6+
*/
7+
package main
8+
9+
func squareIsWhite(coordinates string) bool {
10+
return coordinates[0] % 2 != coordinates[1] % 2
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* @Author: LetMeFly
3+
* @Date: 2024-12-09 17:07:49
4+
* @LastEditors: LetMeFly.xyz
5+
* @LastEditTime: 2024-12-09 17:08:09
6+
*/
7+
class Solution {
8+
public boolean squareIsWhite(String coordinates) {
9+
return coordinates.charAt(0) % 2 != coordinates.charAt(1) % 2;
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'''
2+
Author: LetMeFly
3+
Date: 2024-12-09 17:06:45
4+
LastEditors: LetMeFly.xyz
5+
LastEditTime: 2024-12-09 17:07:19
6+
'''
7+
class Solution:
8+
def squareIsWhite(self, coordinates: str) -> bool:
9+
return ord(coordinates[0]) % 2 != ord(coordinates[1]) % 2

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: LetMeFly
33
* @Date: 2022-05-19 18:48:53
44
* @LastEditors: LetMeFly.xyz
5-
* @LastEditTime: 2024-11-22 23:06:07
5+
* @LastEditTime: 2024-12-09 13:43:26
66
-->
77
# LetLeet Blog
88

@@ -799,6 +799,7 @@
799799
|AboutMyself - 个人吐槽 - 微信的密码找回机制|<a href="https://blog.letmefly.xyz/2023/10/13/Other-AboutMyself-Bullshit-WechatPasswordFindback">本平台博客</a>||
800800
|日积月累 - 一些小知识 - 杂乱 - 啥都有|<a href="https://blog.letmefly.xyz/2023/10/19/Other-Accumulation-Messy/">本平台博客</a>||
801801
|日积月累 - 一些小知识|<a href="https://blog.letmefly.xyz/2023/02/21/Other-Accumulation-SomeTips/">本平台博客</a>||
802+
|人工智能 - 联邦学习(安全性) - 自用(ProjectDoing) - 开题报告-针对视觉大模型联邦学习训练过程中的攻击防御安全及效率问题研究|<a href="https://blog.letmefly.xyz/2024/12/07/Other-AI-FL-FederatedLearning-KaiTiBaoGao/">本平台博客</a>||
802803
|人工智能 - 联邦学习(安全性) - 自用(ProjectDoing)|<a href="https://blog.letmefly.xyz/2024/01/06/Other-AI-FL-FederatedLearning-ProjectWritingIn1month/">本平台博客</a>||
803804
|人工智能 - 跟李沐学AI|<a href="https://blog.letmefly.xyz/2023/03/15/Other-AI-LearnAIWithLiMu/">本平台博客</a>|暂无|
804805
|人工智能 - 强化学习 - 探索和利用|<a href="https://blog.letmefly.xyz/2023/04/03/Other-AI-ReinforcementLearning-ExplorationAndExploitation/">本平台博客</a>||

Solutions/LeetCode 1812.判断国际象棋棋盘中一个格子的颜色.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,34 @@ public:
103103
};
104104
```
105105

106+
#### Python
107+
108+
```python
109+
class Solution:
110+
def squareIsWhite(self, coordinates: str) -> bool:
111+
return ord(coordinates[0]) % 2 != ord(coordinates[1]) % 2
112+
```
113+
114+
#### Java
115+
116+
```java
117+
class Solution {
118+
public boolean squareIsWhite(String coordinates) {
119+
return coordinates.charAt(0) % 2 != coordinates.charAt(1) % 2;
120+
}
121+
}
122+
```
123+
124+
#### Go
125+
126+
```go
127+
package main
128+
129+
func squareIsWhite(coordinates string) bool {
130+
return coordinates[0] % 2 != coordinates[1] % 2
131+
}
132+
```
133+
106134
方法二相比于方法一少了两次减法运算。
107135

108136
> 同步发文于CSDN,原创不易,转载请附上[原文链接](https://blog.letmefly.xyz/2022/12/08/LeetCode%201812.%E5%88%A4%E6%96%AD%E5%9B%BD%E9%99%85%E8%B1%A1%E6%A3%8B%E6%A3%8B%E7%9B%98%E4%B8%AD%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%AD%90%E7%9A%84%E9%A2%9C%E8%89%B2/)哦~

开题.md renamed to Solutions/Other-AI-FL-FederatedLearning-KaiTiBaoGao.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<!--
2-
* @Author: LetMeFly
3-
* @Date: 2024-12-07 11:08:29
4-
* @LastEditors: LetMeFly.xyz
5-
* @LastEditTime: 2024-12-09 02:20:50
6-
-->
1+
---
2+
title: 人工智能 - 联邦学习(安全性) - 自用(ProjectDoing) - 开题报告-针对视觉大模型联邦学习训练过程中的攻击防御安全及效率问题研究
3+
date: 2024-12-07 11:08:29
4+
tags: [其他, AI, DL, 人工智能, 深度学习, 联邦学习]
5+
---
6+
77
# 针对视觉大模型联邦学习训练过程中的攻击防御安全及效率问题研究
88

99
## 一、包括研究目的、意义、国内外研究现状和发展趋势,需结合科学研究发展趋势来论述科学意义;或结合国民经济和社会发展中迫切需要解决的关键科技问题来论述其应用前景。附主要参考文献目录(字数不少于:800)
@@ -172,4 +172,26 @@
172172

173173
### 5.2 工作条件
174174

175-
该课题依托于北京邮电大学网络与交换技术国家重点实验室,该实验室以网络安全、软硬件安全、信息传输安全等作为研究方向,并且先后承担国家“863”项目、“973”项目、“173”项目、国家自然科学基金等各类科研项目500余项,科研经费充足,科研力量雄厚。该实验室具有良好的科研环境和科研条件,为该课题研究的开展提供了完备的理论和硬件支持。实验室内配备了先进的实验设备和高效能的计算资源,能够满足大规模数据处理、模型训练以及复杂实验的需求。此外,实验室的多学科交叉合作环境为课题的研究提供了丰富的学术支持和技术指导,研究团队成员在网络安全、人工智能、深度学习等领域积累了深厚的研究经验,为课题的顺利推进奠定了坚实基础。
175+
该课题依托于北京邮电大学网络与交换技术国家重点实验室,该实验室以网络安全、软硬件安全、信息传输安全等作为研究方向,并且先后承担国家“863”项目、“973”项目、“173”项目、国家自然科学基金等各类科研项目500余项,科研经费充足,科研力量雄厚。该实验室具有良好的科研环境和科研条件,为该课题研究的开展提供了完备的理论和硬件支持。实验室内配备了先进的实验设备和高效能的计算资源,能够满足大规模数据处理、模型训练以及复杂实验的需求。此外,实验室的多学科交叉合作环境为课题的研究提供了丰富的学术支持和技术指导,研究团队成员在网络安全、人工智能、深度学习等领域积累了深厚的研究经验,为课题的顺利推进奠定了坚实基础。
176+
177+
## 工作计划
178+
179+
| 时间 | 研究内容 | 预期效果 |
180+
|--------------------|-------------------------------------------|--------------------------------------------------------|
181+
| 2024.09-2024.11 | 联邦学习攻防相关调研工作 | 调研现有解决方案和不足,初步确定实验内容 |
182+
| 2024.11-2024.12 | 论文开题 | 撰写开题报告,完成开题答辩 |
183+
| 2024.12-2025.05 | 视觉大模型攻击检测效率准确率冲突问题 | 设计并实现视觉大模型攻击检测效率和准确率不冲突算法 |
184+
| 2025.05-2025.10 | LVLM隐蔽后门攻击防御问题 | 通过意图点的构建有效识别和检测LVLM的联邦学习训练过程中隐蔽后门攻击防御问题 |
185+
| 2025.10-2026.02 | 部署系统及实验对比 | 系统稳定运行、实验效果符合预期 |
186+
| 2026.02-2026.05 | 大论文撰写 | 完成论文撰写和答辩 |
187+
188+
## 导师意见
189+
190+
该研究聚焦于视觉大模型在联邦学习中攻击防御的效率准确率问题,具有较高的学术价值和实际意义。随着数据隐私问题日益严峻,联邦学习成为解决这一问题的有效框架,但在面对恶意客户端攻击时,现有防御机制仍存在效率和健壮性不足的问题。因此,研究如何提升这些防御机制,特别是在视觉大模型中的应用,能够推动联邦学习安全相关技术的发展,并未实际应用提供有效的安全保障。该课题切合当前技术发展趋势,具有广泛的应用前景,值得深入研究。
191+
192+
综上,同意开题。
193+
194+
# End
195+
196+
> 原创不易,自用硕士开题报告[原文链接](https://blog.letmefly.xyz/2024/12/07/Other-AI-FL-FederatedLearning-KaiTiBaoGao/)~
197+
> [https://blog.letmefly.xyz/2024/12/07/Other-AI-FL-FederatedLearning-KaiTiBaoGao/](https://blog.letmefly.xyz/2024/12/07/Other-AI-FL-FederatedLearning-KaiTiBaoGao/)
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
title: Cloudflare workers - 如何使用
3+
date: 2024-12-09 13:45:04
4+
tags: [其他, Cloudflare]
5+
---
6+
7+
# Cloudflare workers - 如何使用
8+
9+
是的,我了解 Cloudflare Workers。Cloudflare Workers 是一种基于 JavaScript 的无服务器计算平台,允许你在 Cloudflare 的边缘网络上运行代码,而无需管理传统的服务器基础设施。它能在全球范围内的 Cloudflare 数据中心上执行代码,以提供快速、低延迟的服务。
10+
11+
## 创建Cloudflare workers应用
12+
13+
1. 安装`wrangler`
14+
15+
1. 确保机器上安装了[Node.js](https://nodejs.org/zh-cn)
16+
2. 使用`npm`安装`wrangler`
17+
18+
```bash
19+
npm install -g wrangler
20+
```
21+
22+
或者使用`yarn`安装:
23+
24+
```bash
25+
yarn global add wrangler
26+
```
27+
28+
2. 登录Cloudflare账号
29+
30+
1. 执行命令:
31+
32+
```bash
33+
wrangler login
34+
```
35+
36+
2. 在弹出的浏览器窗口中登录Cloudflare账户(这里可能需要一下特殊网络环境)
37+
38+
3. 如果你使用`powershell`运行且提示:
39+
40+
```
41+
wrangler : 无法加载文件 F:\OtherApps\Program\Node\node-v16.13.1-win-x64\wrangler.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
42+
所在位置 行:1 字符: 1
43+
+ wrangler
44+
+ ~~~~~~~~
45+
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
46+
+ FullyQualifiedErrorId : UnauthorizedAccess
47+
```
48+
49+
那么可以使用如下命令允许本地脚本运行,并要求从互联网下载的脚本必须有有效的签名:
50+
51+
```powershell
52+
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
53+
```
54+
55+
如果希望恢复禁止所有脚本运行,可以使用如下命令恢复:
56+
57+
```powershell
58+
Set-ExecutionPolicy Restricted -Scope CurrentUser
59+
```
60+
61+
3. 创建Worker项目
62+
63+
创建一个名为`api`的项目:
64+
65+
```bash
66+
wrangler generate api
67+
```
68+
69+
这将会在当前目录下生成一个`api`文件夹,文件中中包含一个`wrangler.toml`文件:
70+
71+
```toml
72+
name = "api"
73+
compatibility_date = "2024-12-09"
74+
```
75+
76+
4. 编写Worker代码
77+
78+
在生成的`api`文件夹下,创建`index.js`文件并写入以下内容:
79+
80+
```javascript
81+
addEventListener('fetch', event => {
82+
event.respondWith(handleRequest(event.request))
83+
})
84+
85+
async function handleRequest(request) {
86+
return new Response('Hello, world!', {
87+
headers: { 'content-type': 'text/plain' },
88+
})
89+
}
90+
```
91+
92+
编辑`wrangler.toml`,添加如下一行(设置入口点为`index.js`
93+
94+
```toml
95+
main = "index.js"
96+
```
97+
98+
5. 开发和测试
99+
100+
使用以下命令在本地开发和测试:
101+
102+
```bash
103+
cd api
104+
wrangler dev
105+
```
106+
107+
如果出现以下报错,请安装[vc_redist](https://learn.microsoft.com/zh-cn/cpp/windows/latest-supported-vc-redist)最新版
108+
109+
```
110+
X [ERROR] There was an access violation in the runtime.
111+
112+
On Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.
113+
Check that you have the latest version installed.
114+
See https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.
115+
116+
117+
118+
X [ERROR] The Workers runtime failed to start. There is likely additional logging output above.
119+
```
120+
121+
6. 部署到Cloudflare
122+
123+
```bash
124+
wrangler deploy
125+
```
126+
127+
7. 拉取代码到本地
128+
129+
如果在Cloudflare dashboard(网页端)对内容进行了修改,可执行以下命令将内容拉取到本地:
130+
131+
```
132+
emm,似乎只能手动复制文件的到本地。。
133+
```
134+
135+
<!-- 参考django设计一个简单的worker框架,要求:
136+
137+
1. 每个模块是一个子文件夹,子文件夹中可以实现相关的各种功能
138+
2. main.js中可以导入不同的模块,每个模块对应一个子URL
139+
3. 每个模块中有一个url.js,对应这个子模块中的各种功能。
140+
141+
例如:
142+
143+
其中一个模块是`img`,main.js中导入`img`模块,并设置子URL`img`对应模块`img`
144+
`img`模块中,有两个`url`
145+
146+
1. `a.png`显示`svg hello world`
147+
2. `svg`显示`svg nihao`
148+
149+
最终效果:
150+
151+
1. 访问`/img/a.png`显示`a.png`
152+
2. 访问`/img/svg`显示`svg` -->
153+
154+
155+
<!-- 进行如下修改:
156+
157+
1. 我想要设计的是一个框架,在`main.js`中或`img/url.js`中如果使用过多的`if-else`则将会不便于开发,最好参考django写一个列表 -->
158+
159+
<!-- 很棒,进行如下修复:
160+
161+
`const routeHandler = moduleRoutes[path.replace(modulePath, '')]`这段代码中,如果url地址中还有下一级子路径,则会匹配失败。修改为path.replace().第一级url -->
162+
163+
164+
165+
# End
166+
167+
<center><font size="6px" face="Ink Free">The End, thanks!</font></center>
168+
169+
> 原创不易,转载请附上[原文链接](https://blog.letmefly.xyz/2024/12/09/Other-CloudflareWorkers-How2use/)哦~
170+
> [https://blog.letmefly.xyz/2024/12/09/Other-CloudflareWorkers-How2use/](https://blog.letmefly.xyz/2024/12/09/Other-CloudflareWorkers-How2use/)
171+
172+
TODO: CSDN

Solutions/Other-English-LearningNotes-SomeWords.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,9 @@ tags: [其他, 知识, 英语, Notes]
843843
|zebra|n. 斑马,如斑蝶<br/>adj. 有斑马般斑纹的,有条纹的|
844844
|surmise|v. 〈正式〉猜测,估计,认为<br/>n. 〈正式〉推测,臆测,揣度,猜度|
845845
|hindrance|n. 妨碍,障碍,形成阻碍的人/物|
846+
|||
847+
|idleness|n. 懒惰,懒怠,闲置,失业|
848+
|vowel|n. 元音,元音字母<br/>adj. 母音的<br/>v. v. 加母音(符号)于|
846849

847850
<p class="wordCounts">单词收录总数</p>
848851

Solutions/Other-Japanese-LearningNotes.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ xx型
113113
|冊(さつ)||
114114
|枚(まい)||
115115
|ヶ月(かげつ)|个月|
116+
|メートル||
116117
|||
117118
|色(いろ)||
118119
|ピンク色(ピンクいろ)|粉色|
@@ -440,7 +441,7 @@ xx型
440441
|がっこう|学校|
441442
|教室(きょうしつ)|教室|
442443
|公園(こうえん)|公园|
443-
|へや|部屋|
444+
|部屋(へや)|房间|
444445
|家(いえ)||
445446
|ぎんこう|银行|
446447
|レストラン|餐馆|
@@ -582,7 +583,7 @@ xx型
582583
|雪(ゆき)||
583584
|||
584585
|とり||
585-
|ねこ||
586+
|猫(ねこ)||
586587
|犬(いぬ)||
587588
|ペット|宠物|
588589
|||
@@ -1094,6 +1095,7 @@ xx型
10941095
|パンをナイフで切ってください。<br/>请用刀切面包。|
10951096
|友たちと映画を見たり、公園へ行ったりします。<br/>和朋友看看电影,逛逛公园|
10961097
|せっけんで顔を洗います。<br/>用香皂洗脸。|
1098+
|50メートル北に歩きます。<br/>向北方步行50米。|
10971099

10981100
[单词添加时间](https://github.com/LetMeFly666/LeetCode/blame/master/Solutions/Other-Japanese-LearningNotes.md)
10991101

0 commit comments

Comments
 (0)