-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
616 lines (293 loc) · 268 KB
/
search.xml
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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>win10上快捷键使用Copilot-开启你的AI生活</title>
<link href="/2024/08/26/win10%E4%B8%8A%E5%BF%AB%E6%8D%B7%E4%BD%BF%E7%94%A8Copilot-%E5%BC%80%E5%90%AF%E4%BD%A0%E7%9A%84AI%E7%94%9F%E6%B4%BB/"/>
<url>/2024/08/26/win10%E4%B8%8A%E5%BF%AB%E6%8D%B7%E4%BD%BF%E7%94%A8Copilot-%E5%BC%80%E5%90%AF%E4%BD%A0%E7%9A%84AI%E7%94%9F%E6%B4%BB/</url>
<content type="html"><![CDATA[<p>AI 的到来极大地方便了我们的生活。还记得很久之前,ChatGPT 刚刚推出时,我尝鲜玩了一段时间。那段时间,我对这个新奇的技术充满了好奇和期待。然而,由于需要架梯子访问特定网站,使用起来非常麻烦,渐渐地我就放弃了。<br>今天,我偶然看到了一篇文章,介绍了如何在 Windows 10 上通过简单设置开启 Copilot。这让我重新燃起了对 AI 的兴趣。其实之前我也用过 Copilot,但那时通过访问它的官网:Copilot。<br>使用官网有两个主要问题:</p><ol><li>需要先打开浏览器并访问该网站。这一步骤虽然不复杂,但每次都要重复,确实有些麻烦。</li><li>无法按回车键发送消息。这一点对我来说尤其不便,因为我习惯了用回车键快速发送消息,这个限制让我感到非常不适应。<br>尤其是第二个问题,真是让人抓狂,简直逼死强迫症。不过今天不同了,有了新的解决方案。通过在 Windows 10 上进行简单的设置,就可以直接在桌面上使用 Copilot。这不仅省去了打开浏览器的步骤,还解决了无法按回车键发送消息的问题。<br>总的来说,这个新方法让使用 Copilot 变得更加便捷和高效。我非常期待在日常生活中更多地使用它,享受 AI 带来的便利和乐趣。</li></ol><h3 id="效果展示"><a href="#效果展示" class="headerlink" title="效果展示"></a>效果展示</h3><p>电脑桌面右下角Copilot图标展示,点击后随问随答。<br>可以聊天、可以生成图片、可以生成文件、可以上传文件、分析文件。<br>除此之外,还可以润色文章、提供视频脚本。<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20240830154937.png"/><br>不得不说,效果很不错。</p><h3 id="开启教程"><a href="#开启教程" class="headerlink" title="开启教程"></a>开启教程</h3><ul><li><strong>地区限制</strong>:目前 Windows Copilot 仅限于美国、北美、英国,以及部分亚洲,南美国家的用户可正常使用(国内目前<strong>无法直接使用</strong></li><li><strong>硬件限制</strong>:微软已确认 Windows Copilot 只能在内存为 4GB及以上 ,屏幕分辨率为 720P以上。</li><li><strong>网络限制:</strong> 能够访问相关网站</li></ul><h3 id="开启-Copilot-入口"><a href="#开启-Copilot-入口" class="headerlink" title="开启 Copilot 入口"></a>开启 Copilot 入口</h3><ol><li><strong>“设置” > “系统” > “关于”</strong>,确保操作系统内部版本号为 Build 19045.3754 (KB5032278) 或更高<br> 若有需要亦可手动下载 <a href="https://www.catalog.update.microsoft.com/Search.aspx?q=KB5032278">KB5032278</a> 这个包,实测版本大于即可,没这个 KB 也可以成功。</li><li>Github下载 <a href="https://github.com/thebookisclosed/ViVe/releases">ViveTool</a> 并将其解压,用于开启 Windows 设备上启用隐藏的实验性功能。<br> 进入下载目录,管理员执行如下: <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vivetool /enable /id:46686174,47530616,44755019</span><br></pre></td></tr></table></figure> 执行成功提示如下<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20240830210353.png"/></li><li>重启系统后。观察 Windows Copilot 出现于右下角通知处?若未出现,也可右键任务栏,看是否有Windows Copilot相关的字样,启用即可。</li><li>若是步骤 3 失败,则打开注册表,进入 <code>Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat</code> 后,将 IsUserEligible 数值修改为 1,再重复步骤3,即可看到 Copilot 图标<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20240830210416.png"/></li><li>开启成功<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20240830210433.png"/></li></ol><h3 id="启用-Copilot-功能"><a href="#启用-Copilot-功能" class="headerlink" title="启用 Copilot 功能"></a>启用 Copilot 功能</h3><ol><li>“Settings - Data & time - Region”,将 “Country or region” 设置为 US;最后本机 “ Language” 设置如下.语言应该不是必须的。<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20240830210454.png"/><br>实测,只需要设置 “Country or region” ,其他都不用设置。</li></ol><h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><p>实测效果非常好,我更喜欢直接点击桌面右下角的图标,然后就可以开始对话。这样使用起来非常方便和直观。不过请注意,<font color="#ff0000">所有功能都需要挂梯子使用</font>,否则会显示“您所在的地区不支持”。唉,怎么说呢,一切尽在不言中吧。希望未来能够更方便地使用这些功能。<br>最后说明一下,桌面版的 Copilot 可以通过 <code>Win + C</code> 快速呼叫和隐藏。这使得操作更加快捷和高效。😉</p><h3 id="后续问题"><a href="#后续问题" class="headerlink" title="后续问题"></a>后续问题</h3><h4 id="1-该服务在你所在的地区不可用"><a href="#1-该服务在你所在的地区不可用" class="headerlink" title="1-该服务在你所在的地区不可用"></a>1-该服务在你所在的地区不可用</h4><p>这里可以检测你的IP地址: <a href="https://iplark.com/">IPLark - 查看本机IP地址 - 我的IP归属地</a><br>解决方法:</p><ol><li><a href="https://blog.csdn.net/m0_62744746/article/details/136429738">如何解决必应自带的copilot不能用的问题</a></li><li><a href="https://blog.csdn.net/creouser/article/details/139549582">Gmail谷歌邮箱账号注册手机号无法验证的解决方法</a><br>新的Gmail: <code>[email protected]</code> pw: <code>xxxxxx</code><br>测试结果:无效、很麻烦。我重新登录 <code>[email protected]</code> 之后,又有可以右下角的 <code>Copilot</code>了。<br><strong>最终解法</strong>:关机重启,设置注册表,开启copilot,挂梯子在美国,又恢复了。</li></ol><h4 id="2-开启自动修改注册表开启copilot"><a href="#2-开启自动修改注册表开启copilot" class="headerlink" title="2-开启自动修改注册表开启copilot"></a>2-开启自动修改注册表开启copilot</h4><p>参考教程:<a href="https://wenku.csdn.net/answer/5jo7zujmsk">bat脚本修改注册表 - CSDN文库</a><br>新建文件: <code>Enable_Copilot.bat</code>, 内容如下:<br><code>reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat" /v IsUserEligible /t REG_DWORD /d 1 /f</code><br>解释如下:</p><ul><li><code>"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat"</code> 是要修改的注册表键路径。</li><li><code>/v IsUserEligible</code> 是要修改的键值名称。</li><li><code>/t REG_DWORD</code> 是指定键值的数据类型为DWORD。</li><li><code>/d 1</code> 是要设置的键值数据,这里设置为1。</li><li><code>/f</code> 是表示前置执行的操作,不显示确认提示。</li></ul><p>开机自启动,将上面的脚本<code>Enable_Copilot.bat</code> 放到如下路径:<br><code>C:\Users\xxxxxxxxxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup</code></p><p><strong>重启测试结果</strong>:<br>任务栏右键,可以看到开启copilot的设置按钮,点击后桌面右下角可以出现copilot按钮。<br>挂上美国的梯子后,可以正常使用,不错,nice。🤟</p><hr><p>参考文章:<a href="https://ifmet.cn/posts/d591d39e/">为 Windows10 22H2 启用 Microsoft Copilot 功能</a></p>]]></content>
<tags>
<tag> 每日文章 </tag>
<tag> AI </tag>
</tags>
</entry>
<entry>
<title>2024年夏天</title>
<link href="/2024/08/18/2024%E5%B9%B4%E7%9A%84%E5%A4%8F%E5%A4%A9/"/>
<url>/2024/08/18/2024%E5%B9%B4%E7%9A%84%E5%A4%8F%E5%A4%A9/</url>
<content type="html"><![CDATA[<blockquote><p>夏天快要结束了,是吗?</p></blockquote><span id="more"></span><p>hello:</p><iframe src="//player.bilibili.com/player.html?isOutside=true&aid=1556353901&bvid=BV1Z14214729&cid=1647648630&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>]]></content>
<tags>
<tag> 日常 </tag>
</tags>
</entry>
<entry>
<title>写在chatGPT免费额度用完之后</title>
<link href="/2023/06/01/%E5%86%99%E5%9C%A8chatGPT%E5%85%8D%E8%B4%B9%E9%A2%9D%E5%BA%A6%E7%94%A8%E5%AE%8C%E4%B9%8B%E5%90%8E/"/>
<url>/2023/06/01/%E5%86%99%E5%9C%A8chatGPT%E5%85%8D%E8%B4%B9%E9%A2%9D%E5%BA%A6%E7%94%A8%E5%AE%8C%E4%B9%8B%E5%90%8E/</url>
<content type="html"><![CDATA[<blockquote><p>今天在用python调用chatGPT API的时候出现了这个错误,<code>openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.</code> 唉,这可咋整?</p></blockquote><span id="more"></span><h3 id="问题分析"><a href="#问题分析" class="headerlink" title="问题分析"></a>问题分析</h3><p>第一时间想到去官网查看下余额,因为之前听说过key泄漏,余额哗哗流掉的情况。所我第一时间以为是key泄漏了。<br>到<a href="https://platform.openai.com/account/usage">官网上查了下余额</a>得到的结果如下:</p><div style="display:inline-block;"><img width="80%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230601111434.png" alt="20230601111434"></div>好消息是:余额还有很多没用完,key没有泄漏。坏消息是:余额过期了。此时,我真想对openAI唱一句:听我说谢谢你,温暖了四季。。。<h3 id="原因"><a href="#原因" class="headerlink" title="原因"></a>原因</h3><p>查了下<a href="https://opencat.app/docs/zh-CN/faq">openAI官网说明</a>:</p><div style="display:inline-block;"><img width="80%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230601112013.png" alt="20230601112013"></div>看来必须要绑定信用卡才能继续使用chatGPT API.<h3 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h3><h4 id="1-绑定信用卡"><a href="#1-绑定信用卡" class="headerlink" title="1- 绑定信用卡"></a>1- 绑定信用卡</h4><p><font color="#ff0000">过于繁琐、不安全,暂时不搞了。</font></p><h4 id="2-使用chatGPT官网"><a href="#2-使用chatGPT官网" class="headerlink" title="2- 使用chatGPT官网"></a>2- 使用chatGPT官网</h4><p><a href="https://chat.openai.com/">chatGPT官网</a>还是可以继续使用的。<br>相较于种类繁多的各种chatGPT 二次开发,官网最大的劣势就在于没有<code>提示词</code>,有没有edge浏览器提示词插件呢?<br>答案是:有</p><h5 id="⚡️ChatGPT-Shortcut"><a href="#⚡️ChatGPT-Shortcut" class="headerlink" title="⚡️ChatGPT Shortcut"></a>⚡️ChatGPT Shortcut</h5><p><strong>资源</strong>: <a href="https://github.com/rockbenben/ChatGPT-Shortcut">github地址</a> <a href="https://microsoftedge.microsoft.com/addons/detail/chatgpt-shortcut/hnggpalhfjmdhhmgfjpmhlfilnbmjoin">edge插件地址</a><br>(<em>顺便说一句,<a href="https://newzone.top/blog.html">作者的博客</a>真是宝藏博客,是我喜欢的style,再看看<a href="https://weicun.gitee.io/">我的博客</a>,唉,努力想强者学习。</em>)<br><strong>使用感受</strong>:的确不错,虽然不能直接调出命令,需要复制粘贴到chatGPT,但是很干净、清爽。<br><strong>优点</strong>:干净清爽、支持中文、免费<br><strong>缺点</strong>:不支持一键嵌入,需要自己复制粘贴</p><h5 id="AIPRM-for-ChatGPT"><a href="#AIPRM-for-ChatGPT" class="headerlink" title="AIPRM for ChatGPT"></a>AIPRM for ChatGPT</h5><p><strong>资源</strong>: <a href="https://chrome.google.com/webstore/detail/aiprm-for-chatgpt/ojnbohmppadfgpejeebfnmnknjdlckgj">edge插件地址</a><br><strong>使用感受</strong>:纯英文,没有实际使用意义<br><strong>优点</strong>:可以一键嵌入命令<br><strong>缺点</strong>:界面繁琐、收费、不支持中文。</p><p><strong>最终结论</strong>:使用⚡️<strong>ChatGPT Shortcut</strong></p><p><strong>顺便说一句:</strong> <font color="#ff0000">Goodbye 各类好用的chatGPT二次开发应用,由于API过期,我将回归chatGPT官网。</font><br>hi~<br>hi~<br>hi123321阿道夫<br>尺寸</p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://zhuanlan.zhihu.com/p/620257174">还在为chatgpt的prompt发愁?试试这些插件,让提问变得更有效、更简单~ - 知乎</a></li></ol>]]></content>
<tags>
<tag> 每日文章 </tag>
<tag> AI </tag>
<tag> chatGPT </tag>
</tags>
</entry>
<entry>
<title>博客评论区开放国内评论功能</title>
<link href="/2023/05/29/%E5%8D%9A%E5%AE%A2%E8%AF%84%E8%AE%BA%E5%8C%BA%E5%BC%80%E6%94%BE%E5%9B%BD%E5%86%85%E8%AF%84%E8%AE%BA%E5%8A%9F%E8%83%BD/"/>
<url>/2023/05/29/%E5%8D%9A%E5%AE%A2%E8%AF%84%E8%AE%BA%E5%8C%BA%E5%BC%80%E6%94%BE%E5%9B%BD%E5%86%85%E8%AF%84%E8%AE%BA%E5%8A%9F%E8%83%BD/</url>
<content type="html"><![CDATA[<blockquote><p>域名已经重新申请了,目前也可以支持大陆地区用户使用了。</p></blockquote><span id="more"></span><p>欢迎下面评论留言,会第一时间回复您的。</p>]]></content>
<tags>
<tag> hexo </tag>
</tags>
</entry>
<entry>
<title>【快乐游戏】-荒野吃鸡</title>
<link href="/2023/05/26/%E3%80%90%E5%BF%AB%E4%B9%90%E6%B8%B8%E6%88%8F%E3%80%91-%E8%8D%92%E9%87%8E%E5%90%83%E9%B8%A1/"/>
<url>/2023/05/26/%E3%80%90%E5%BF%AB%E4%B9%90%E6%B8%B8%E6%88%8F%E3%80%91-%E8%8D%92%E9%87%8E%E5%90%83%E9%B8%A1/</url>
<content type="html"><![CDATA[<blockquote><p>今天中午休息时候打了一局荒野行动,7杀吃鸡,记录下精彩瞬间。</p></blockquote><span id="more"></span><iframe src="//player.bilibili.com/player.html?aid=741613700&bvid=BV1Kk4y1W76k&cid=1142458449&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe><h3 id="经验总结"><a href="#经验总结" class="headerlink" title="经验总结"></a>经验总结</h3><ol><li>苟一苟进前九。</li><li>好的兵器,不要节省子弹。</li><li>任何时候都要找好掩体。</li><li>最重要的是搞清楚敌人的方向。</li></ol>]]></content>
<tags>
<tag> 游戏 </tag>
</tags>
</entry>
<entry>
<title>博客评论暂停大陆地区使用公告</title>
<link href="/2023/05/26/%E5%8D%9A%E5%AE%A2%E8%AF%84%E8%AE%BA%E6%9A%82%E5%81%9C%E5%A4%A7%E9%99%86%E5%9C%B0%E5%8C%BA%E4%BD%BF%E7%94%A8%E5%85%AC%E5%91%8A/"/>
<url>/2023/05/26/%E5%8D%9A%E5%AE%A2%E8%AF%84%E8%AE%BA%E6%9A%82%E5%81%9C%E5%A4%A7%E9%99%86%E5%9C%B0%E5%8C%BA%E4%BD%BF%E7%94%A8%E5%85%AC%E5%91%8A/</url>
<content type="html"><![CDATA[<blockquote><p>由于域名到期,暂时不在支持大陆地区用户使用本博客的评论功能,如果你有魔法or梯子,将不会影响你的使用。</p></blockquote><span id="more"></span><p>目前的使用的博客系统是waline,挂载在vercel服务器上,但是vercel域名被挡住了,所以之前有购买一个域名,DNS解析到vercel上,因此国内用户才可以正常评论。<br>但是现在域名到期了,所以将使用vercel自带的域名,因此请大家八仙过海、各显神通,把魔法用起来。<br>欢迎评论你对the great wall的看法?</p><ul><li><input disabled="" type="checkbox"> 支持?外面世界太乱了,ZF是在保护我们。</li><li><input disabled="" type="checkbox"> 反对?阻碍交流</li></ul>]]></content>
</entry>
<entry>
<title>OpenAI ChatGPT3.5-turbo实际解决问题能力评测</title>
<link href="/2023/05/22/OpenAI%20ChatGPT3.5-turbo%E5%AE%9E%E9%99%85%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98%E8%83%BD%E5%8A%9B%E8%AF%84%E6%B5%8B/"/>
<url>/2023/05/22/OpenAI%20ChatGPT3.5-turbo%E5%AE%9E%E9%99%85%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98%E8%83%BD%E5%8A%9B%E8%AF%84%E6%B5%8B/</url>
<content type="html"><![CDATA[<blockquote><p>程序员在coding的时候会经常遇到需要查阅资料的情况,最好的结果是直接能拿到一份好用的demo版本code,本次我们来评测:bing搜索和chatGPT3.5,解决实际问题:“html 图片靠左”的效果。</p></blockquote><span id="more"></span><div style="display:inline-block;"><img width="80%" style="float:center;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522152417.png" alt="20230522152417"></div> <h3 id="bing搜索的表现"><a href="#bing搜索的表现" class="headerlink" title="bing搜索的表现"></a>bing搜索的表现</h3><ul><li>搜索关键字:<font color="#ff0000">html 图片靠左</font></li><li>得到的结果如下: <div style="display:inline-block;"><img width="100%" style="float:left;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522152828.png" alt="20230522152828"></div></li><li>每个结果我都点击进去看了,并没有我想要的demo code。</li><li>每个搜索结果,demo code也无法运行,有的可以,有的不可以。</li></ul><h3 id="chatGPT3-5的表现"><a href="#chatGPT3-5的表现" class="headerlink" title="chatGPT3.5的表现"></a>chatGPT3.5的表现</h3><p>第一次询问:<font color="#ff0000">html中img如何靠左显示</font><br>答:</p><div style="display:inline-block;"><img width="60%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522153101.png" alt="20230522153101"></div><p>第二次询问:<font color="#ff0000">如何在当行语句中设置图片靠左</font><br><font color="#00b0f0">注意看,我还写了一个错别字,chatGPT完美的理解了我的意思。</font><br>答:</p><div style="display:inline-block;"><img width="60%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522153221.png" alt="20230522153221"></div><p>第三次询问:<font color="#ff0000">看上去他是悬浮在段落里了,如何能让他不是悬浮在段落里?</font><br>答:</p><div style="display:inline-block;"><img width="60%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522153449.png" alt="20230522153449"></div><p>经过三次询问,我得到了想要的答案:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">img</span> <span class="attr">src</span>=<span class="string">"your-image.jpg"</span> <span class="attr">alt</span>=<span class="string">"Your Image"</span> <span class="attr">style</span>=<span class="string">"vertical-align: middle; margin-right: 10px;"</span>></span></span><br></pre></td></tr></table></figure><h3 id="总结:"><a href="#总结:" class="headerlink" title="总结:"></a>总结:</h3><p>chatGPT明显强于bing搜索,其<font color="#ff0000">最大的亮点就是上下午语境联系能力</font>,我仅仅通过三个问题就得到了答案,而且还解决了一个问题。<br>所以,chatGPT在解决问题上的确给人眼前一亮的感觉,如果你能好好利用它,它一定能给你助力不少。<br>对于搜索行业来说,chatGPT绝对是颠覆性的。</p><hr><p>对了,如果大家对AI、新技术、软件评测感兴趣,可以关注我的微信公众号:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a></p>]]></content>
<tags>
<tag> 每日文章 </tag>
<tag> AI </tag>
</tags>
</entry>
<entry>
<title>Hexo博客查图片并调整位置&大小</title>
<link href="/2023/05/22/Hexo%E5%8D%9A%E5%AE%A2%E6%9F%A5%E5%9B%BE%E7%89%87%E5%B9%B6%E8%B0%83%E6%95%B4%E4%BD%8D%E7%BD%AE&%E5%A4%A7%E5%B0%8F/"/>
<url>/2023/05/22/Hexo%E5%8D%9A%E5%AE%A2%E6%9F%A5%E5%9B%BE%E7%89%87%E5%B9%B6%E8%B0%83%E6%95%B4%E4%BD%8D%E7%BD%AE&%E5%A4%A7%E5%B0%8F/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>Markdown写文章插入图片,<font color="#ff0000">在hexo博客中,图片的大小似乎没有按照个markdown的语法生效</font>,本文将解决此问题。</p></blockquote><span id="more"></span><div style="display:inline-block;"><img width="50%" style="float:center " src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522141323.png" alt="20230522144603"></div><h3 id="现有问题描述"><a href="#现有问题描述" class="headerlink" title="现有问题描述"></a><font color="#ff0000">现有问题描述</font></h3><p>obsidian中插入图片的语法:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">![20230522135434|left](https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522135434.png)</span><br></pre></td></tr></table></figure><p>优点:</p><ul><li>默认靠左显示。</li><li>可以利用ob的插件快速调整大小:alt + 鼠标滚轮调整大小。<br>缺点:</li><li>ob中调整的大小,在hexo博客中无法正确显示。</li></ul><h3 id="Hexo博客插入图片的方法"><a href="#Hexo博客插入图片的方法" class="headerlink" title="Hexo博客插入图片的方法"></a>Hexo博客插入图片的方法</h3><p>首先说下hexo插入图片的方式有哪些,hexo默认集成了markdown语法,这里我们就markdown里显示图片的方式引入html方法,两种方法有优有劣,关键看自己的习惯了</p><ul><li>第一种是直接引用markdown插入</li><li>第二种是使用html来引用插入</li></ul><h4 id="1-直接引用markdown插入"><a href="#1-直接引用markdown插入" class="headerlink" title="1-直接引用markdown插入"></a>1-直接引用markdown插入</h4><p>首先是直接引用的方法需要在images目录里放入需要引入的图片<br><code>![lena](https://alexcld.com/images/pengyuyan.jpg)</code><br>我这里就直接引用之前的图片了,图片链接自己可以在网上找,<br>本地图片的话可以直接使用路径来引用<br>这种方法可以是可以,有点小缺点:图片就会靠在左侧,大小也不由自己决定</p><h4 id="2-使用html方法引入"><a href="#2-使用html方法引入" class="headerlink" title="2-使用html方法引入"></a>2-使用html方法引入</h4><p>第二种就是使用html来引用插入的图片<br><code><img src="https://alexcld.com/images/pengyuyan.jpg" width=256 height=256 /></code><br>固定图片大小:width=256,height=256设置的是显示图像的尺寸,src后面接的就是图像对象<br>还可以使用百分比的方式来给width,height传参<br><code><img src="https://alexcld.com/images/pengyuyan.jpg" width="50%" height="50%" /></code><br>其中width和height后面的50%就是根据窗口的大小以一定的比例显示图片。值得一说的是,这种按照百分比显示方法,是以width方向为准,并保持纵横比的,换句话说,把设置width的部分去掉,height的值改为任<br>意百分比,显示的图像都是原图大小(个人觉得这根博客窗口有关,毕竟现实截面的宽度相对是固定的,而高度/长度却是变化着的)。因此用此方法的时候,可以把height设置缺省</p><h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a><font color="#ff0000">总结</font></h3><p>最后使用的hexo插入图片语法:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">img</span> <span class="attr">style</span>=<span class="string">"float: left; margin-right: 10px;"</span> <span class="attr">src</span>=<span class="string">"https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522141323.png"</span> <span class="attr">width</span>=<span class="string">"50%"</span> /></span></span><br></pre></td></tr></table></figure><p>这种方法虽然有效果,但是会使图片处在悬浮状态,影响体验,解决方法是:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">div</span> <span class="attr">style</span>=<span class="string">"display:inline-block;"</span>></span> <span class="tag"><<span class="name">img</span> <span class="attr">width</span>=<span class="string">"10%"</span> <span class="attr">src</span>=<span class="string">"https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522141323.png"</span> <span class="attr">alt</span>=<span class="string">"Your Image"</span> <span class="attr">style</span>=<span class="string">"float: left; margin-right: 10px;"</span>></span> <span class="tag"></<span class="name">div</span>></span></span><br></pre></td></tr></table></figure><p>实际效果:</p><div style="display: inline-block;"> <img width="10%" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522141323.png" alt="Your Image" style="float: left; margin-right: 10px;"> </div>PS: 原本的语法:<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">![20230522141323|left|400](https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522141323.png)</span><br></pre></td></tr></table></figure><p>效果对比(左边是原本的,右边是修改后的):</p><div style="display:inline-block;"><img width="100%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522151213.png" alt="20230522151213"></div><h3 id="如何实际使用"><a href="#如何实际使用" class="headerlink" title="如何实际使用"></a><font color="#ff0000">如何实际使用</font></h3><p>需要修改Picgo图床的自定义链接格式,原本的自定义链接格式:<br><code>![$fileName|left]($url)</code><br>修改后的自定义链接格式:<br><code><div style="display:inline-block;"><img width="100%" style="float:left; margin-right: 10px;" src="$url" alt="$fileName"></div></code><br>实际效果: </p><ul><li>靠左显示:<div style="display:inline-block;"><img width="15%" style="float:left; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522144603.png" alt="20230522144603"></div></li><li>居中显示:<div style="display:inline-block;"><img width="15%" style="float:center; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522144603.png" alt="20230522144603"></div></li><li>靠右显示:<div style="display:inline-block;"><img width="15%" style="float:right; margin-right: 10px;" src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230522144603.png" alt="20230522144603"></div></li></ul><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://blog.csdn.net/weixin_45509582/article/details/108582689">hexo插入图片及控制大小_AlexClownfish的博客-CSDN博客</a></li></ol>]]></content>
<tags>
<tag> hexo </tag>
<tag> 每日文章 </tag>
</tags>
</entry>
<entry>
<title>Hexo博客next主题添加点击特效</title>
<link href="/2023/05/06/Hexo%E5%8D%9A%E5%AE%A2next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E7%82%B9%E5%87%BB%E7%89%B9%E6%95%88/"/>
<url>/2023/05/06/Hexo%E5%8D%9A%E5%AE%A2next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E7%82%B9%E5%87%BB%E7%89%B9%E6%95%88/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>博客折腾的差不多了,开始整一些花活了,这次就给博客添加下点击特效,基本效果如下:</p></blockquote><span id="more"></span><div style="display:inline-block;"><img width="40%" style="float:center " src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230506100148.png" alt="20230522144603"></div><p>好了闲言少叙,直接上干货:</p><ol><li><p>在<code>E:\2_Git\Hexo_Blog\node_modules\hexo-theme-next\source\js</code>下新建文件<code>fireworks.js</code>并写入以下内容:</p><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">"use strict"</span>;<span class="keyword">function</span> <span class="title function_">updateCoords</span>(<span class="params">e</span>){pointerX=(e.<span class="property">clientX</span>||e.<span class="property">touches</span>[<span class="number">0</span>].<span class="property">clientX</span>)-canvasEl.<span class="title function_">getBoundingClientRect</span>().<span class="property">left</span>,pointerY=e.<span class="property">clientY</span>||e.<span class="property">touches</span>[<span class="number">0</span>].<span class="property">clientY</span>-canvasEl.<span class="title function_">getBoundingClientRect</span>().<span class="property">top</span>}<span class="keyword">function</span> <span class="title function_">setParticuleDirection</span>(<span class="params">e</span>){<span class="keyword">var</span> t=anime.<span class="title function_">random</span>(<span class="number">0</span>,<span class="number">360</span>)*<span class="title class_">Math</span>.<span class="property">PI</span>/<span class="number">180</span>,a=anime.<span class="title function_">random</span>(<span class="number">50</span>,<span class="number">180</span>),n=[-<span class="number">1</span>,<span class="number">1</span>][anime.<span class="title function_">random</span>(<span class="number">0</span>,<span class="number">1</span>)]*a;<span class="keyword">return</span>{<span class="attr">x</span>:e.<span class="property">x</span>+n*<span class="title class_">Math</span>.<span class="title function_">cos</span>(t),<span class="attr">y</span>:e.<span class="property">y</span>+n*<span class="title class_">Math</span>.<span class="title function_">sin</span>(t)}}<span class="keyword">function</span> <span class="title function_">createParticule</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a={};<span class="keyword">return</span> a.<span class="property">x</span>=e,a.<span class="property">y</span>=t,a.<span class="property">color</span>=colors[anime.<span class="title function_">random</span>(<span class="number">0</span>,colors.<span class="property">length</span>-<span class="number">1</span>)],a.<span class="property">radius</span>=anime.<span class="title function_">random</span>(<span class="number">16</span>,<span class="number">32</span>),a.<span class="property">endPos</span>=<span class="title function_">setParticuleDirection</span>(a),a.<span class="property">draw</span>=<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="title function_">beginPath</span>(),ctx.<span class="title function_">arc</span>(a.<span class="property">x</span>,a.<span class="property">y</span>,a.<span class="property">radius</span>,<span class="number">0</span>,<span class="number">2</span>*<span class="title class_">Math</span>.<span class="property">PI</span>,!<span class="number">0</span>),ctx.<span class="property">fillStyle</span>=a.<span class="property">color</span>,ctx.<span class="title function_">fill</span>()},a}<span class="keyword">function</span> <span class="title function_">createCircle</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a={};<span class="keyword">return</span> a.<span class="property">x</span>=e,a.<span class="property">y</span>=t,a.<span class="property">color</span>=<span class="string">"#F00"</span>,a.<span class="property">radius</span>=<span class="number">0.1</span>,a.<span class="property">alpha</span>=<span class="number">0.5</span>,a.<span class="property">lineWidth</span>=<span class="number">6</span>,a.<span class="property">draw</span>=<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="property">globalAlpha</span>=a.<span class="property">alpha</span>,ctx.<span class="title function_">beginPath</span>(),ctx.<span class="title function_">arc</span>(a.<span class="property">x</span>,a.<span class="property">y</span>,a.<span class="property">radius</span>,<span class="number">0</span>,<span class="number">2</span>*<span class="title class_">Math</span>.<span class="property">PI</span>,!<span class="number">0</span>),ctx.<span class="property">lineWidth</span>=a.<span class="property">lineWidth</span>,ctx.<span class="property">strokeStyle</span>=a.<span class="property">color</span>,ctx.<span class="title function_">stroke</span>(),ctx.<span class="property">globalAlpha</span>=<span class="number">1</span>},a}<span class="keyword">function</span> <span class="title function_">renderParticule</span>(<span class="params">e</span>){<span class="keyword">for</span>(<span class="keyword">var</span> t=<span class="number">0</span>;t<e.<span class="property">animatables</span>.<span class="property">length</span>;t++){e.<span class="property">animatables</span>[t].<span class="property">target</span>.<span class="title function_">draw</span>()}}<span class="keyword">function</span> <span class="title function_">animateParticules</span>(<span class="params">e,t</span>){<span class="keyword">for</span>(<span class="keyword">var</span> a=<span class="title function_">createCircle</span>(e,t),n=[],i=<span class="number">0</span>;i<numberOfParticules;i++){n.<span class="title function_">push</span>(<span class="title function_">createParticule</span>(e,t))}anime.<span class="title function_">timeline</span>().<span class="title function_">add</span>({<span class="attr">targets</span>:n,<span class="attr">x</span>:<span class="keyword">function</span>(<span class="params">e</span>){<span class="keyword">return</span> e.<span class="property">endPos</span>.<span class="property">x</span>},<span class="attr">y</span>:<span class="keyword">function</span>(<span class="params">e</span>){<span class="keyword">return</span> e.<span class="property">endPos</span>.<span class="property">y</span>},<span class="attr">radius</span>:<span class="number">0.1</span>,<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">1200</span>,<span class="number">1800</span>),<span class="attr">easing</span>:<span class="string">"easeOutExpo"</span>,<span class="attr">update</span>:renderParticule}).<span class="title function_">add</span>({<span class="attr">targets</span>:a,<span class="attr">radius</span>:anime.<span class="title function_">random</span>(<span class="number">80</span>,<span class="number">160</span>),<span class="attr">lineWidth</span>:<span class="number">0</span>,<span class="attr">alpha</span>:{<span class="attr">value</span>:<span class="number">0</span>,<span class="attr">easing</span>:<span class="string">"linear"</span>,<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">600</span>,<span class="number">800</span>)},<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">1200</span>,<span class="number">1800</span>),<span class="attr">easing</span>:<span class="string">"easeOutExpo"</span>,<span class="attr">update</span>:renderParticule,<span class="attr">offset</span>:<span class="number">0</span>})}<span class="keyword">function</span> <span class="title function_">debounce</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a;<span class="keyword">return</span> <span class="keyword">function</span>(<span class="params"></span>){<span class="keyword">var</span> n=<span class="variable language_">this</span>,i=<span class="variable language_">arguments</span>;<span class="built_in">clearTimeout</span>(a),a=<span class="built_in">setTimeout</span>(<span class="keyword">function</span>(<span class="params"></span>){e.<span class="title function_">apply</span>(n,i)},t)}}<span class="keyword">var</span> canvasEl=<span class="variable language_">document</span>.<span class="title function_">querySelector</span>(<span class="string">".fireworks"</span>);<span class="keyword">if</span>(canvasEl){<span class="keyword">var</span> ctx=canvasEl.<span class="title function_">getContext</span>(<span class="string">"2d"</span>),numberOfParticules=<span class="number">30</span>,pointerX=<span class="number">0</span>,pointerY=<span class="number">0</span>,tap=<span class="string">"mousedown"</span>,colors=[<span class="string">"#FF1461"</span>,<span class="string">"#18FF92"</span>,<span class="string">"#5A87FF"</span>,<span class="string">"#FBF38C"</span>],setCanvasSize=<span class="title function_">debounce</span>(<span class="keyword">function</span>(<span class="params"></span>){canvasEl.<span class="property">width</span>=<span class="number">2</span>*<span class="variable language_">window</span>.<span class="property">innerWidth</span>,canvasEl.<span class="property">height</span>=<span class="number">2</span>*<span class="variable language_">window</span>.<span class="property">innerHeight</span>,canvasEl.<span class="property">style</span>.<span class="property">width</span>=<span class="variable language_">window</span>.<span class="property">innerWidth</span>+<span class="string">"px"</span>,canvasEl.<span class="property">style</span>.<span class="property">height</span>=<span class="variable language_">window</span>.<span class="property">innerHeight</span>+<span class="string">"px"</span>,canvasEl.<span class="title function_">getContext</span>(<span class="string">"2d"</span>).<span class="title function_">scale</span>(<span class="number">2</span>,<span class="number">2</span>)},<span class="number">500</span>),render=<span class="title function_">anime</span>({<span class="attr">duration</span>:<span class="number">1</span>/<span class="number">0</span>,<span class="attr">update</span>:<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="title function_">clearRect</span>(<span class="number">0</span>,<span class="number">0</span>,canvasEl.<span class="property">width</span>,canvasEl.<span class="property">height</span>)}});<span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(tap,<span class="keyword">function</span>(<span class="params">e</span>){<span class="string">"sidebar"</span>!==e.<span class="property">target</span>.<span class="property">id</span>&&<span class="string">"toggle-sidebar"</span>!==e.<span class="property">target</span>.<span class="property">id</span>&&<span class="string">"A"</span>!==e.<span class="property">target</span>.<span class="property">nodeName</span>&&<span class="string">"IMG"</span>!==e.<span class="property">target</span>.<span class="property">nodeName</span>&&(render.<span class="title function_">play</span>(),<span class="title function_">updateCoords</span>(e),<span class="title function_">animateParticules</span>(pointerX,pointerY))},!<span class="number">1</span>),<span class="title function_">setCanvasSize</span>(),<span class="variable language_">window</span>.<span class="title function_">addEventListener</span>(<span class="string">"resize"</span>,setCanvasSize,!<span class="number">1</span>)}<span class="string">"use strict"</span>;<span class="keyword">function</span> <span class="title function_">updateCoords</span>(<span class="params">e</span>){pointerX=(e.<span class="property">clientX</span>||e.<span class="property">touches</span>[<span class="number">0</span>].<span class="property">clientX</span>)-canvasEl.<span class="title function_">getBoundingClientRect</span>().<span class="property">left</span>,pointerY=e.<span class="property">clientY</span>||e.<span class="property">touches</span>[<span class="number">0</span>].<span class="property">clientY</span>-canvasEl.<span class="title function_">getBoundingClientRect</span>().<span class="property">top</span>}<span class="keyword">function</span> <span class="title function_">setParticuleDirection</span>(<span class="params">e</span>){<span class="keyword">var</span> t=anime.<span class="title function_">random</span>(<span class="number">0</span>,<span class="number">360</span>)*<span class="title class_">Math</span>.<span class="property">PI</span>/<span class="number">180</span>,a=anime.<span class="title function_">random</span>(<span class="number">50</span>,<span class="number">180</span>),n=[-<span class="number">1</span>,<span class="number">1</span>][anime.<span class="title function_">random</span>(<span class="number">0</span>,<span class="number">1</span>)]*a;<span class="keyword">return</span>{<span class="attr">x</span>:e.<span class="property">x</span>+n*<span class="title class_">Math</span>.<span class="title function_">cos</span>(t),<span class="attr">y</span>:e.<span class="property">y</span>+n*<span class="title class_">Math</span>.<span class="title function_">sin</span>(t)}}<span class="keyword">function</span> <span class="title function_">createParticule</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a={};<span class="keyword">return</span> a.<span class="property">x</span>=e,a.<span class="property">y</span>=t,a.<span class="property">color</span>=colors[anime.<span class="title function_">random</span>(<span class="number">0</span>,colors.<span class="property">length</span>-<span class="number">1</span>)],a.<span class="property">radius</span>=anime.<span class="title function_">random</span>(<span class="number">16</span>,<span class="number">32</span>),a.<span class="property">endPos</span>=<span class="title function_">setParticuleDirection</span>(a),a.<span class="property">draw</span>=<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="title function_">beginPath</span>(),ctx.<span class="title function_">arc</span>(a.<span class="property">x</span>,a.<span class="property">y</span>,a.<span class="property">radius</span>,<span class="number">0</span>,<span class="number">2</span>*<span class="title class_">Math</span>.<span class="property">PI</span>,!<span class="number">0</span>),ctx.<span class="property">fillStyle</span>=a.<span class="property">color</span>,ctx.<span class="title function_">fill</span>()},a}<span class="keyword">function</span> <span class="title function_">createCircle</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a={};<span class="keyword">return</span> a.<span class="property">x</span>=e,a.<span class="property">y</span>=t,a.<span class="property">color</span>=<span class="string">"#F00"</span>,a.<span class="property">radius</span>=<span class="number">0.1</span>,a.<span class="property">alpha</span>=<span class="number">0.5</span>,a.<span class="property">lineWidth</span>=<span class="number">6</span>,a.<span class="property">draw</span>=<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="property">globalAlpha</span>=a.<span class="property">alpha</span>,ctx.<span class="title function_">beginPath</span>(),ctx.<span class="title function_">arc</span>(a.<span class="property">x</span>,a.<span class="property">y</span>,a.<span class="property">radius</span>,<span class="number">0</span>,<span class="number">2</span>*<span class="title class_">Math</span>.<span class="property">PI</span>,!<span class="number">0</span>),ctx.<span class="property">lineWidth</span>=a.<span class="property">lineWidth</span>,ctx.<span class="property">strokeStyle</span>=a.<span class="property">color</span>,ctx.<span class="title function_">stroke</span>(),ctx.<span class="property">globalAlpha</span>=<span class="number">1</span>},a}<span class="keyword">function</span> <span class="title function_">renderParticule</span>(<span class="params">e</span>){<span class="keyword">for</span>(<span class="keyword">var</span> t=<span class="number">0</span>;t<e.<span class="property">animatables</span>.<span class="property">length</span>;t++){e.<span class="property">animatables</span>[t].<span class="property">target</span>.<span class="title function_">draw</span>()}}<span class="keyword">function</span> <span class="title function_">animateParticules</span>(<span class="params">e,t</span>){<span class="keyword">for</span>(<span class="keyword">var</span> a=<span class="title function_">createCircle</span>(e,t),n=[],i=<span class="number">0</span>;i<numberOfParticules;i++){n.<span class="title function_">push</span>(<span class="title function_">createParticule</span>(e,t))}anime.<span class="title function_">timeline</span>().<span class="title function_">add</span>({<span class="attr">targets</span>:n,<span class="attr">x</span>:<span class="keyword">function</span>(<span class="params">e</span>){<span class="keyword">return</span> e.<span class="property">endPos</span>.<span class="property">x</span>},<span class="attr">y</span>:<span class="keyword">function</span>(<span class="params">e</span>){<span class="keyword">return</span> e.<span class="property">endPos</span>.<span class="property">y</span>},<span class="attr">radius</span>:<span class="number">0.1</span>,<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">1200</span>,<span class="number">1800</span>),<span class="attr">easing</span>:<span class="string">"easeOutExpo"</span>,<span class="attr">update</span>:renderParticule}).<span class="title function_">add</span>({<span class="attr">targets</span>:a,<span class="attr">radius</span>:anime.<span class="title function_">random</span>(<span class="number">80</span>,<span class="number">160</span>),<span class="attr">lineWidth</span>:<span class="number">0</span>,<span class="attr">alpha</span>:{<span class="attr">value</span>:<span class="number">0</span>,<span class="attr">easing</span>:<span class="string">"linear"</span>,<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">600</span>,<span class="number">800</span>)},<span class="attr">duration</span>:anime.<span class="title function_">random</span>(<span class="number">1200</span>,<span class="number">1800</span>),<span class="attr">easing</span>:<span class="string">"easeOutExpo"</span>,<span class="attr">update</span>:renderParticule,<span class="attr">offset</span>:<span class="number">0</span>})}<span class="keyword">function</span> <span class="title function_">debounce</span>(<span class="params">e,t</span>){<span class="keyword">var</span> a;<span class="keyword">return</span> <span class="keyword">function</span>(<span class="params"></span>){<span class="keyword">var</span> n=<span class="variable language_">this</span>,i=<span class="variable language_">arguments</span>;<span class="built_in">clearTimeout</span>(a),a=<span class="built_in">setTimeout</span>(<span class="keyword">function</span>(<span class="params"></span>){e.<span class="title function_">apply</span>(n,i)},t)}}<span class="keyword">var</span> canvasEl=<span class="variable language_">document</span>.<span class="title function_">querySelector</span>(<span class="string">".fireworks"</span>);<span class="keyword">if</span>(canvasEl){<span class="keyword">var</span> ctx=canvasEl.<span class="title function_">getContext</span>(<span class="string">"2d"</span>),numberOfParticules=<span class="number">30</span>,pointerX=<span class="number">0</span>,pointerY=<span class="number">0</span>,tap=<span class="string">"mousedown"</span>,colors=[<span class="string">"#FF1461"</span>,<span class="string">"#18FF92"</span>,<span class="string">"#5A87FF"</span>,<span class="string">"#FBF38C"</span>],setCanvasSize=<span class="title function_">debounce</span>(<span class="keyword">function</span>(<span class="params"></span>){canvasEl.<span class="property">width</span>=<span class="number">2</span>*<span class="variable language_">window</span>.<span class="property">innerWidth</span>,canvasEl.<span class="property">height</span>=<span class="number">2</span>*<span class="variable language_">window</span>.<span class="property">innerHeight</span>,canvasEl.<span class="property">style</span>.<span class="property">width</span>=<span class="variable language_">window</span>.<span class="property">innerWidth</span>+<span class="string">"px"</span>,canvasEl.<span class="property">style</span>.<span class="property">height</span>=<span class="variable language_">window</span>.<span class="property">innerHeight</span>+<span class="string">"px"</span>,canvasEl.<span class="title function_">getContext</span>(<span class="string">"2d"</span>).<span class="title function_">scale</span>(<span class="number">2</span>,<span class="number">2</span>)},<span class="number">500</span>),render=<span class="title function_">anime</span>({<span class="attr">duration</span>:<span class="number">1</span>/<span class="number">0</span>,<span class="attr">update</span>:<span class="keyword">function</span>(<span class="params"></span>){ctx.<span class="title function_">clearRect</span>(<span class="number">0</span>,<span class="number">0</span>,canvasEl.<span class="property">width</span>,canvasEl.<span class="property">height</span>)}});<span class="variable language_">document</span>.<span class="title function_">addEventListener</span>(tap,<span class="keyword">function</span>(<span class="params">e</span>){<span class="string">"sidebar"</span>!==e.<span class="property">target</span>.<span class="property">id</span>&&<span class="string">"toggle-sidebar"</span>!==e.<span class="property">target</span>.<span class="property">id</span>&&<span class="string">"A"</span>!==e.<span class="property">target</span>.<span class="property">nodeName</span>&&<span class="string">"IMG"</span>!==e.<span class="property">target</span>.<span class="property">nodeName</span>&&(render.<span class="title function_">play</span>(),<span class="title function_">updateCoords</span>(e),<span class="title function_">animateParticules</span>(pointerX,pointerY))},!<span class="number">1</span>),<span class="title function_">setCanvasSize</span>(),<span class="variable language_">window</span>.<span class="title function_">addEventListener</span>(<span class="string">"resize"</span>,setCanvasSize,!<span class="number">1</span>)};</span><br><span class="line"></span><br></pre></td></tr></table></figure></li><li><p>在<code>E:\2_Git\Hexo_Blog\node_modules\hexo-theme-next\layout\_layout.njk</code>中的<code><body></code>块中添加如下内容:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"> {% if theme.fireworks %}</span><br><span class="line"> <span class="tag"><<span class="name">canvas</span> <span class="attr">class</span>=<span class="string">"fireworks"</span> <span class="attr">style</span>=<span class="string">"position: fixed;left: 0;top: 0;z-index: 1; pointer-events: none;"</span> ></span><span class="tag"></<span class="name">canvas</span>></span> </span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">type</span>=<span class="string">"text/javascript"</span> <span class="attr">src</span>=<span class="string">"//cdn.bootcss.com/animejs/2.2.0/anime.min.js"</span>></span><span class="tag"></<span class="name">script</span>></span> </span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">type</span>=<span class="string">"text/javascript"</span> <span class="attr">src</span>=<span class="string">"/js/fireworks.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line">{% endif %}</span><br></pre></td></tr></table></figure></li><li><p>在<code>E:\2_Git\Hexo_Blog\_config.next.yml</code>文末添加:<br><code>fireworks: true</code></p></li><li><p>重启hexo博客就任意位置点击就可以看到这个效果啦<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230506100148.png" alt="20230506100148|left|450"></p></li></ol><hr><p><font color="#ff0000">2024-8-27 回来说一下</font><br>这个特效会严重拖慢网速,打开网站打开的时候卡顿验证,所以我已经不用了,关掉之后网站刷新速度明显快了很多。</p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://blog.csdn.net/Awt_FuDongLai/article/details/107463289">hexo笔记十三:next主题增加点击特效_小镇攻城狮的博客-CSDN博客</a></li><li><a href="https://nuosferatu.github.io/2020/06/12/NexT-Click-Effect/">NexT 主题博客添加鼠标点击烟花特效 | Nuosferatu’s Blog</a></li><li></li></ol>]]></content>
<tags>
<tag> hexo </tag>
<tag> 每日文章 </tag>
</tags>
</entry>
<entry>
<title>163、QQ邮箱收不到Github的邮件解决方法</title>
<link href="/2023/05/05/163%E3%80%81QQ%E9%82%AE%E7%AE%B1%E6%94%B6%E4%B8%8D%E5%88%B0Github%E7%9A%84%E9%82%AE%E4%BB%B6%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/"/>
<url>/2023/05/05/163%E3%80%81QQ%E9%82%AE%E7%AE%B1%E6%94%B6%E4%B8%8D%E5%88%B0Github%E7%9A%84%E9%82%AE%E4%BB%B6%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>国内的好多邮箱收不到github的mail,无法收到github上的通知、留言,这个让人很苦恼,无法及时沟通,所以本文会给出解决方法。</p></blockquote><span id="more"></span><div style="display:inline-block;"><img width="40%" style="float:center " src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230505171221.png" alt="20230522144603"></div><p>注册GitHub需要进行邮箱激活验证,否则不能创建仓库,码笔记发现使用QQ邮箱、163邮箱等国内常见邮箱可能收不到激活邮件,这是什么原因呢?码笔记分享GitHub收不到激活邮件的解决方法:</p><h2 id="GitHub收不到邮件的解决方法"><a href="#GitHub收不到邮件的解决方法" class="headerlink" title="GitHub收不到邮件的解决方法"></a>GitHub收不到邮件的解决方法</h2><p>GitHub需要“Please verify your email address”,否则不能使用GitHub。国内常见的邮箱QQ邮箱或者163邮箱等可能会收不到GitHub发来的激活验证邮件,那么如何解决呢?</p><h3 id="将GitHub设置到邮箱白名单即可"><a href="#将GitHub设置到邮箱白名单即可" class="headerlink" title="将GitHub设置到邮箱白名单即可"></a>将GitHub设置到邮箱白名单即可</h3><p>码笔记以QQ邮箱为例,将GitHub加入到邮箱白名单即可。登录到你的邮箱,点击【设置】-【反垃圾】-【白名单】,将<code>github.com</code>添加到邮箱白名单即可,如下图所示:<br><a href="https://www.mabiji.com/wp-content/uploads/2019/11/baimingdan.jpg"><img src="https://www.mabiji.com/wp-content/uploads/2019/11/baimingdan.jpg" alt="github.com添加到邮箱白名单"></a></p><p>github.com添加到邮箱白名单</p><p>然后在GitHub端,点击重新发送邮件“Resend”,即可收到GitHub发来的邮件,在邮件中点击“verify email address”即可完成邮箱验证。</p><p>对了,如果大家对AI、新技术、软件评测感兴趣,可以关注我的微信公众号:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a></p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://www.mabiji.com/github/github-email.html#:~:text=%E5%9B%BD%E5%86%85%E5%B8%B8%E8%A7%81%E7%9A%84%E9%82%AE%E7%AE%B1QQ%E9%82%AE%E7%AE%B1%E6%88%96%E8%80%85163%E9%82%AE%E7%AE%B1%E7%AD%89%E5%8F%AF%E8%83%BD%E4%BC%9A%E6%94%B6%E4%B8%8D%E5%88%B0GitHub%E5%8F%91%E6%9D%A5%E7%9A%84%E6%BF%80%E6%B4%BB%E9%AA%8C%E8%AF%81%E9%82%AE%E4%BB%B6%EF%BC%8C%E9%82%A3%E4%B9%88%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%E5%91%A2%EF%BC%9F%20%E5%B0%86GitHub%E8%AE%BE%E7%BD%AE%E5%88%B0%E9%82%AE%E7%AE%B1%E7%99%BD%E5%90%8D%E5%8D%95%E5%8D%B3%E5%8F%AF%20%E7%A0%81%E7%AC%94%E8%AE%B0%E4%BB%A5QQ%E9%82%AE%E7%AE%B1%E4%B8%BA%E4%BE%8B%EF%BC%8C%E5%B0%86GitHub%E5%8A%A0%E5%85%A5%E5%88%B0%E9%82%AE%E7%AE%B1%E7%99%BD%E5%90%8D%E5%8D%95%E5%8D%B3%E5%8F%AF%E3%80%82%20%E7%99%BB%E5%BD%95%E5%88%B0%E4%BD%A0%E7%9A%84%E9%82%AE%E7%AE%B1%EF%BC%8C%E7%82%B9%E5%87%BB%E3%80%90%E8%AE%BE%E7%BD%AE%E3%80%91-%E3%80%90%E5%8F%8D%E5%9E%83%E5%9C%BE%E3%80%91-%E3%80%90%E7%99%BD%E5%90%8D%E5%8D%95%E3%80%91%EF%BC%8C%E5%B0%86github.com%E6%B7%BB%E5%8A%A0%E5%88%B0%E9%82%AE%E7%AE%B1%E7%99%BD%E5%90%8D%E5%8D%95%E5%8D%B3%E5%8F%AF%EF%BC%8C%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA%EF%BC%9A,github.com%E6%B7%BB%E5%8A%A0%E5%88%B0%E9%82%AE%E7%AE%B1%E7%99%BD%E5%90%8D%E5%8D%95%20%E7%84%B6%E5%90%8E%E5%9C%A8GitHub%E7%AB%AF%EF%BC%8C%E7%82%B9%E5%87%BB%E9%87%8D%E6%96%B0%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6%E2%80%9CResend%E2%80%9D%EF%BC%8C%E5%8D%B3%E5%8F%AF%E6%94%B6%E5%88%B0GitHub%E5%8F%91%E6%9D%A5%E7%9A%84%E9%82%AE%E4%BB%B6%EF%BC%8C%E5%9C%A8%E9%82%AE%E4%BB%B6%E4%B8%AD%E7%82%B9%E5%87%BB%E2%80%9Cverify%20email%20address%E2%80%9D%E5%8D%B3%E5%8F%AF%E5%AE%8C%E6%88%90%E9%82%AE%E7%AE%B1%E9%AA%8C%E8%AF%81%E3%80%82">GitHub收不到邮件的解决方法 | 码笔记</a></li></ol>]]></content>
<tags>
<tag> 每日文章 </tag>
</tags>
</entry>
<entry>
<title>不用魔法免费使用类chatGPT聊天</title>
<link href="/2023/05/05/%E4%B8%8D%E7%94%A8%E9%AD%94%E6%B3%95%E5%85%8D%E8%B4%B9%E4%BD%BF%E7%94%A8%E7%B1%BBchatGPT%E8%81%8A%E5%A4%A9/"/>
<url>/2023/05/05/%E4%B8%8D%E7%94%A8%E9%AD%94%E6%B3%95%E5%85%8D%E8%B4%B9%E4%BD%BF%E7%94%A8%E7%B1%BBchatGPT%E8%81%8A%E5%A4%A9/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>不需要魔法,不用搭梯子,免费不受限制的使用类 chatGPT 聊天。</p></blockquote><span id="more"></span><p>我们将类 chatGPT 接入到了微信公众号,你可以跟他聊天,询问天气,甚至是骂它俩句,他绝对不会还嘴的,哈哈哈。<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a><br><font color="#ff0000">关注公众号,直接发消息就可以愉快的聊天啦。</font><br>放几张聊天截图,感受喜爱它的小脾气吧:<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230505135849.png" alt="20230505135849|100|left|300"><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230505140136.png" alt="20230505140136|left|300"></p>]]></content>
</entry>
<entry>
<title>随便聊两句</title>
<link href="/2023/05/05/%E9%9A%8F%E4%BE%BF%E8%81%8A%E4%B8%A4%E5%8F%A5/"/>
<url>/2023/05/05/%E9%9A%8F%E4%BE%BF%E8%81%8A%E4%B8%A4%E5%8F%A5/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>进来聊聊天呗…</p></blockquote><span id="more"></span><h3 id="话说如果不考虑赚钱,只考虑兴趣爱好,你们还会从事现在的行业吗?"><a href="#话说如果不考虑赚钱,只考虑兴趣爱好,你们还会从事现在的行业吗?" class="headerlink" title="话说如果不考虑赚钱,只考虑兴趣爱好,你们还会从事现在的行业吗?"></a>话说如果不考虑赚钱,只考虑兴趣爱好,你们还会从事现在的行业吗?</h3><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230505113619.png" alt="20230505113619|left|450"></p>]]></content>
</entry>
<entry>
<title>免费域名申请</title>
<link href="/2023/04/28/%E5%85%8D%E8%B4%B9%E5%9F%9F%E5%90%8D%E7%94%B3%E8%AF%B7/"/>
<url>/2023/04/28/%E5%85%8D%E8%B4%B9%E5%9F%9F%E5%90%8D%E7%94%B3%E8%AF%B7/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>本文将介绍如何免费申请域名,在最近的折腾中发现,域名真的很重要,不然好多服务是无法访问的。</p></blockquote><span id="more"></span><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230428153405.png" alt="20230428153405|left|500"></p><p><strong>备注</strong>:由于freenom基于技术原因,暂时停止免费域名的申请,所以最后作者是在阿里云里面花了6块钱申请了域名。</p><h3 id="Freenom注册域名"><a href="#Freenom注册域名" class="headerlink" title="Freenom注册域名"></a>Freenom注册域名</h3><ul><li>官网:<a href="https://www.freenom.com/zh/index.html?lang=zh">Freenom - 人人都熟悉的名字</a></li><li>实测无法注册新的免费域名了:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230428104025.png" alt="20230428104025|left|500"></li></ul><h3 id="阿里云申请域名"><a href="#阿里云申请域名" class="headerlink" title="阿里云申请域名"></a>阿里云申请域名</h3><ul><li>官网:<a href="https://wanwang.aliyun.com/domain/searchresult/?keyword=helloworld&suffix=.com#?keyword=lansedanche&suffix=life">域名查询结果_域名信息_域名交易-万网-阿里云旗下品牌</a></li><li>找到比较便宜的域名:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230428110130.png" alt="20230428110130|left"></li></ul><h3 id="域名比价查询网站"><a href="#域名比价查询网站" class="headerlink" title="域名比价查询网站"></a>域名比价查询网站</h3><p>对比域名价格的网站(需要挂梯子):<br><a href="https://www.nazhumi.com/">哪煮米 - 全网域名,一站比价</a></p><h3 id="如果你有教育邮箱的话"><a href="#如果你有教育邮箱的话" class="headerlink" title="如果你有教育邮箱的话"></a>如果你有教育邮箱的话</h3><p><a href="https://nc.me/">Site Unreachable</a> ,倒是可以免费注册.me,不过需要那边认可的教育邮箱。</p>]]></content>
<tags>
<tag> 每日文章 </tag>
</tags>
</entry>
<entry>
<title>为Hexo博客next主题添加友链</title>
<link href="/2023/04/27/%E4%B8%BAHexo%E5%8D%9A%E5%AE%A2next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E5%8F%8B%E9%93%BE/"/>
<url>/2023/04/27/%E4%B8%BAHexo%E5%8D%9A%E5%AE%A2next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E5%8F%8B%E9%93%BE/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>本文将介绍如何为Hexo博客next主题添加友链,方便你与其他博主进行联系,同时可以引流。</p></blockquote><span id="more"></span><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230427153826.png" alt="20230427153826|left"></p><h3 id="效果展示"><a href="#效果展示" class="headerlink" title="效果展示"></a>效果展示</h3><p>先看实际效果,如果感觉ok,就可以继续往下看,否则请节省时间逛逛别的文章:<br><a href="http://localhost:4000/links/">链接在这里</a><br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230427154005.png" alt="20230427154005|left|500"></p><h3 id="添加友链的方法"><a href="#添加友链的方法" class="headerlink" title="添加友链的方法"></a>添加友链的方法</h3><h4 id="修改hexo的next主题配置文件-config-next-yml"><a href="#修改hexo的next主题配置文件-config-next-yml" class="headerlink" title="修改hexo的next主题配置文件_config.next.yml"></a>修改hexo的next主题配置文件_config.next.yml</h4><p>我的_config.next.yml是在根目录下,打开后,在menu节点下,添加这一行:<br><code>link: /links/ || fa fa-link</code></p><h4 id="将配置文件中的link备注中文名称"><a href="#将配置文件中的link备注中文名称" class="headerlink" title="将配置文件中的link备注中文名称"></a>将配置文件中的link备注中文名称</h4><p>打开目录<code>Hexo_Blog\node_modules\hexo-theme-next\languages</code>,打开文件<code>zh-CN.yml</code>,在menu节点下添加这一行:<br><code>link: 友链</code></p><h4 id="添加友链页面"><a href="#添加友链页面" class="headerlink" title="添加友链页面"></a>添加友链页面</h4><p>打开目录<code>Hexo_Blog\source</code>新建文件夹<code>links</code>,在<code>Hexo_Blog\source\links</code>下新建文件<code>index.md</code>,添加如下内容:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: 友情链接</span><br><span class="line">date: 2023-04-26 00:34:27</span><br><span class="line">---</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"post-body"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">id</span>=<span class="string">"links"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">style</span>></span><span class="language-css"></span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.links-content</span>{</span></span><br><span class="line"><span class="language-css"> <span class="attribute">margin-top</span>:<span class="number">1rem</span>;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.link-navigation</span><span class="selector-pseudo">::after</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">content</span>: <span class="string">" "</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">display</span>: block;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">clear</span>: both;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">width</span>: <span class="number">45%</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-size</span>: <span class="number">1rem</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">padding</span>: <span class="number">10px</span> <span class="number">20px</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">border-radius</span>: <span class="number">4px</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">transition-duration</span>: <span class="number">0.15s</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">margin-bottom</span>: <span class="number">1rem</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">display</span>:flex;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span><span class="selector-pseudo">:nth-child</span>(odd) {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">float</span>: left;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span><span class="selector-pseudo">:nth-child</span>(even) {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">float</span>: right;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span><span class="selector-pseudo">:hover</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">transform</span>: <span class="built_in">scale</span>(<span class="number">1.1</span>);</span></span><br><span class="line"><span class="language-css"> <span class="attribute">box-shadow</span>: <span class="number">0</span> <span class="number">2px</span> <span class="number">6px</span> <span class="number">0</span> <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.12</span>), <span class="number">0</span> <span class="number">0</span> <span class="number">6px</span> <span class="number">0</span> <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.04</span>);</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-tag">a</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">border</span>:none;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-class">.ava</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">width</span>: <span class="number">3rem</span><span class="meta">!important</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">height</span>: <span class="number">3rem</span><span class="meta">!important</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">margin</span>:<span class="number">0</span><span class="meta">!important</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">margin-right</span>: <span class="number">1em</span><span class="meta">!important</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">border-radius</span>:<span class="number">4px</span>;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-class">.card-header</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-style</span>: italic;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">overflow</span>: hidden;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">width</span>: <span class="number">100%</span>;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-class">.card-header</span> <span class="selector-tag">a</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-style</span>: normal;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">color</span>: <span class="number">#2bbc8a</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-weight</span>: bold;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">text-decoration</span>: none;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-class">.card-header</span> <span class="selector-tag">a</span><span class="selector-pseudo">:hover</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">color</span>: <span class="number">#d480aa</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">text-decoration</span>: none;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> <span class="selector-class">.card</span> <span class="selector-class">.card-header</span> <span class="selector-class">.info</span> {</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-style</span>:normal;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">color</span>:<span class="number">#a3a3a3</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">font-size</span>:<span class="number">14px</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">min-width</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">overflow</span>: hidden;</span></span><br><span class="line"><span class="language-css"> <span class="attribute">white-space</span>: nowrap;</span></span><br><span class="line"><span class="language-css"> }</span></span><br><span class="line"><span class="language-css"> </span><span class="tag"></<span class="name">style</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"links-content"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"link-navigation"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">img</span> <span class="attr">class</span>=<span class="string">"ava"</span> <span class="attr">src</span>=<span class="string">"https://laosu.ml/images/laosu_wx.jpg"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card-header"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"https://laosu.ml/"</span>></span>杨浦老苏<span class="tag"></<span class="name">a</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"info"</span>></span>聚沙成塔,集腋成裘 <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">img</span> <span class="attr">class</span>=<span class="string">"ava"</span> <span class="attr">src</span>=<span class="string">"https://weicun.gitee.io/images/logo.png"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card-header"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"https://weicun.gitee.io/"</span>></span>蓝色单车<span class="tag"></<span class="name">a</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"info"</span>></span>软件评测、AI、感悟,分享好玩的东东<span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"><span class="tag"></<span class="name">div</span>></span></span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure><p>如果你想单车一样用 obsidian 编辑器对 html 编辑不友好,建议在 VS code 或者 sublime text 里面编辑好在粘贴过来。(跟新:建议直接用 sublime text 去编辑就好,不要用 ob 去编辑)。<br>如果有小伙伴请求添加友链,你只需要在上述代码的技术上添加如下代码块即可:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">img</span> <span class="attr">class</span>=<span class="string">"ava"</span> <span class="attr">src</span>=<span class="string">"https://laosu.ml/images/laosu_wx.jpg"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"card-header"</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"https://laosu.ml/"</span>></span>杨浦老苏<span class="tag"></<span class="name">a</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">class</span>=<span class="string">"info"</span>></span>聚沙成塔,集腋成裘 <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">div</span>></span></span><br><span class="line"><span class="tag"></<span class="name">div</span>></span></span><br></pre></td></tr></table></figure><p>这里添加了我最喜欢的一个博主:<a href="https://laosu.ml/">老苏的博客</a>,虽然没有经过他的允许,但是我还是很想把他分享给大家,因为他的文章的确是纯纯的干货文章。</p><hr><h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><p>好了,至此我们已经完成了全部工作,回顾下其实就三个步骤:</p><ul><li>修改hexo的next主题配置文件_config.next.yml </li><li>将配置文件中的link备注中文名称</li><li>添加友链页面<br>现在你可以部署你的hexo博客看效果了(<code>hexo clean、hexo g、hexo s、hexo d</code>),希望能看到你满意的效果。<br>有什么问题欢迎留言。</li></ul><p>对了,如果大家喜欢可以关注我的博客和微信公众号,平时会经常分享一下软件、AI、感悟、好玩的东东。谢谢啦。<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a></p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><p>1.<br>2.<br>3. </p>]]></content>
<tags>
<tag> hexo </tag>
<tag> 每日文章 </tag>
</tags>
</entry>
<entry>
<title>FFmpeg用法</title>
<link href="/2023/04/25/Ffmpeg%E7%94%A8%E6%B3%95/"/>
<url>/2023/04/25/Ffmpeg%E7%94%A8%E6%B3%95/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>本文主要介绍ffmpeg的各种用法,纯纯干货,请慢慢咀嚼,管饱。</p></blockquote><span id="more"></span><h4 id="环境搭建"><a href="#环境搭建" class="headerlink" title="环境搭建"></a>环境搭建</h4><ul><li>win10安装ffmpeg<ul><li>官网:<a href="https://ffmpeg.org/">Site Unreachable</a></li><li>下载页面:<a href="https://ffmpeg.org/download.html">Download FFmpeg</a></li><li>下载完成后直接进行解压,然后配置环境变量就OK了</li></ul></li><li>百度网盘下载:<ul><li>链接:<a href="https://pan.baidu.com/s/1Jk119himVJhifuhU4lP0Ow">https://pan.baidu.com/s/1Jk119himVJhifuhU4lP0Ow</a> </li><li>提取码:w6o0</li></ul></li><li>ffmpeg 验证:<ul><li><code>ffmpeg –version</code><img src="https://pic2.zhimg.com/80/v2-fa3860fc6f29dffc51d5a98bd8546bb5_1440w.webp" alt="|L|475"></li></ul></li></ul><h3 id="图像处理"><a href="#图像处理" class="headerlink" title="图像处理"></a>图像处理</h3><h4 id="视频切割"><a href="#视频切割" class="headerlink" title="视频切割"></a>视频切割</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ffmpeg -ss 00:00:05 -t 00:00:04 -i C:\Users\mmmm2sdsd1\Desktop\105_Flashing_Frying_six_dragon_05.ts -vcodec copy -acodec copy output.ts </span><br></pre></td></tr></table></figure><pre><code>- 00:00:05 :起始时间点。 - 00:00:04 :切割视频总时长。 </code></pre><h4 id="视频转图像(vidoe-2-BMP):"><a href="#视频转图像(vidoe-2-BMP):" class="headerlink" title="视频转图像(vidoe 2 BMP):"></a>视频转图像(vidoe 2 BMP):</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ffmpeg -ss 00:00:00 -i C:\Users\jimmy_wei\Desktop\142.MOV -t 00:00:15 -s 1920x1088 -pix_fmt bgr24 -y C:\Users\jimmy_wei\Desktop\halo\142\%06d.bmp </span><br><span class="line">ffmpeg -ss 00:00:03 -i E:\_VIDEO\435_AQUAMAN_08.mp4 -t 00:00:15 -s 3840x2160 -pix_fmt bgr24 -y E:\_BMP\3840_2160\435\%06d.bmp </span><br></pre></td></tr></table></figure><h4 id="图像合成视频(BMP-2-video):"><a href="#图像合成视频(BMP-2-video):" class="headerlink" title="图像合成视频(BMP 2 video):"></a>图像合成视频(BMP 2 video):</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ffmpeg -framerate 60 -i C:\Users\jimmy\Desktop\source_pic\%06d.bmp -r 60 -s 1920x1080 -c:v libx265 -crf 18 -pix_fmt yuv420p -y C:\Users\jimmy\Desktop\output.mp4 </span><br></pre></td></tr></table></figure><h3 id="视频推流"><a href="#视频推流" class="headerlink" title="视频推流"></a>视频推流</h3><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230426164032.png" alt="20230426164032|left|500"></p><h4 id="推流视频到nginx网页"><a href="#推流视频到nginx网页" class="headerlink" title="推流视频到nginx网页"></a>推流视频到nginx网页</h4><h5 id="nginx服务器:"><a href="#nginx服务器:" class="headerlink" title="nginx服务器:"></a>nginx服务器:</h5><ul><li>软件地址:<code>D:\Program\nginx-1.7.11.3-Gryphon</code></li><li>启动方法:<code>nginx.exe -c conf\nginx-win-rtmp.conf</code></li></ul><h5 id="ffmpeg推流:"><a href="#ffmpeg推流:" class="headerlink" title="ffmpeg推流:"></a>ffmpeg推流:</h5><ul><li>指令:<code>ffmpeg -re -i F:\2_视频\电视剧\武林外传\1.郭女侠怒砸同福店,佟掌柜妙点迷路人.mkv -vcodec libx264 -acodec aac -f flv rtmp://localhost:1935/live/home</code><br><em>按Q可以退出推流。</em></li></ul><h5 id="查看推流视频:"><a href="#查看推流视频:" class="headerlink" title="查看推流视频:"></a>查看推流视频:</h5><ul><li>点击这个连接可以自动弹出PotPlayer播放推流视频:<a href="rtmp://localhost:1935/live/home">rtmp://localhost:1935/live/home</a></li></ul><h4 id="推流视频到b站"><a href="#推流视频到b站" class="headerlink" title="推流视频到b站"></a>推流视频到b站</h4><h5 id="b站服务器端设置:"><a href="#b站服务器端设置:" class="headerlink" title="b站服务器端设置:"></a>b站服务器端设置:</h5><ul><li><a href="https://link.bilibili.com/p/center/index#/my-room/start-live">开播设置 - 个人中心 - bilibili link</a></li><li>进入直播,点击开播设置,设置分类,房间名称,开启直播<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230426135952.png" alt="20230426135952|left|425"></li><li>生成rtmp推流地址和串流密匙。这两个会在推流中使用。<ul><li>服务器地址:%%🔐α 💡ID💡1vqREn1/S+Z8L2gewqQOW6s1cZIOuE+HJnrtMH1bhfjvU2kIUkt1n31BEZV5Q51XTAlVmk1HG/b0P96qcjcFGFmS+EElaSrL 🔐%%</li><li>串流密钥:%%🔐α 💡ID💡NTCvUsiKTYODuGkCPb88QCIKEMfWaSri+NoFOiyquHczADwXk4Ex73RK980fFdxyNAV+ddz27TY73NdnfJFFdvo9zOj0LDZBAwqUGsNQRr96fF6F1SkbNPw/i4Ri9nZlbfrAdDMvEud2yqvzhlcu8gpym2SnxkL4yToj 🔐%%</li></ul></li></ul><h5 id="ffmpeg推流:-1"><a href="#ffmpeg推流:-1" class="headerlink" title="ffmpeg推流:"></a>ffmpeg推流:</h5><ul><li>指令模板:<code>ffmpeg -re -stream_loop -1 -i "test.mp4" -c copy -f flv "${rtmp}"</code><br><em>视频文件全路径不需要加双引号。</em><br><em>rtmp地址需要加双引号,替换<code>${rtmp}</code>即可。</em></li><li>实际测试ok指令:%%🔐α 💡ID💡PK4pmoTqn46s4H/D2oQ/N65OryxeHqiollA6Jtzzgb8H4h1ITMrqGX+9Syr/9CUXtTcCNzTu34+Uleo1QfgHGUZd2fxpmSEJdozTvbi4A7LfYxAiZkCREe8f1oS8z9nSqLqFbuoAjzq260KE/j7hkB/3AtDMY0CRcrDklOXkJ7u0i2OELTrW3ie8fBvCpMUfGHBn1IYkZTtLAKmr5EWzW888ngpZtgopijPhrO+vPVfATMtwQZBoiXadL6YjRTaVmuhzVdG6qG1Hb2Cn0KuiKOYIeDVeU78t0OKOWBaaZUIPijqyEz4BRI+2ZC62yu48+OgG1IWuzNcToGw6JVtVDfTpUd3OvAl8gzFX1wOmpAzFBJsRYwkA2+yl/0O4NbFNnJkeUwBq6Iylb9kGEDyh/Ww= 🔐%%</li></ul><h5 id="查看推流视频:-1"><a href="#查看推流视频:-1" class="headerlink" title="查看推流视频:"></a>查看推流视频:</h5><ul><li>打开网页即可:<a href="http://live.bilibili.com/9134075">老白涮肉坊 - laaaaaaaaa - 哔哩哔哩直播,二次元弹幕直播平台</a></li></ul><h5 id="b站推流应用价值:"><a href="#b站推流应用价值:" class="headerlink" title="b站推流应用价值:"></a>b站推流应用价值:</h5><h6 id="什么是无人直播?"><a href="#什么是无人直播?" class="headerlink" title="什么是无人直播?"></a>什么是无人直播?</h6><blockquote><p>无人直播是一种自动化、智能化的直播方式,其运作过程不需要人工干预或仅仅需要非常少量的人工干预。相对于传统的人工直播模式,无人直播更加智能、高效、稳定和节省人力成本。<br>具体来说,无人直播通过将摄像头、麦克风、主机、人工智能等技术设备集成在一起,实现了直播内容的自动生成、发布以及分发等功能,不需要直播员现场控制,而是通过算法和预设的规则智能化地进行直播,从而实现了自动化直播。<br>同时,无人直播还有着更高的直播覆盖率和更好的直播质量。无人直播被广泛应用于各种应用场景,如电商直播、房地产直播、景区直播、体育赛事直播等。</p></blockquote><h6 id="无人直播优势?"><a href="#无人直播优势?" class="headerlink" title="无人直播优势?"></a>无人直播优势?</h6><blockquote><p>人工智能技术、自动化技术等先进技术逐渐成熟,让我们可以更加智能地管理业务,提高工作效率。此外,无人直播可以为企业、机构、个人提供更加便捷、高效、安全的直播服务,让他们更好地宣传品牌、增加销售额、吸引更多客户。<br>无人直播还可以提高直播的稳定性和可靠性,减少人工干预导致的差错和错误,从而更好地满足用户的需求,实现商业价值。总之,无人直播是一种符合科技发展趋势、提高工作效率和商业价值的好方式。</p></blockquote><h3 id="摄像头推流"><a href="#摄像头推流" class="headerlink" title="摄像头推流"></a>摄像头推流</h3><h4 id="nginx服务器:-1"><a href="#nginx服务器:-1" class="headerlink" title="nginx服务器:"></a>nginx服务器:</h4><ul><li>软件地址:<code>D:\Program\nginx-1.7.11.3-Gryphon</code></li><li>启动方法:<code>nginx.exe -c conf\nginx-win-rtmp.conf</code></li></ul><h4 id="python-OpenCV-ffmpeg推流"><a href="#python-OpenCV-ffmpeg推流" class="headerlink" title="python OpenCV + ffmpeg推流"></a>python OpenCV + ffmpeg推流</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> subprocess <span class="keyword">as</span> sp </span><br><span class="line"><span class="keyword">import</span> cv2 <span class="keyword">as</span> cv </span><br><span class="line"><span class="keyword">import</span> subprocess </span><br><span class="line"><span class="comment">### 参考教程:https://zhuanlan.zhihu.com/p/74260950 </span></span><br><span class="line"><span class="comment">### 后期如果要提升响应速度,减少延迟,可以参考下面这篇文章: </span></span><br><span class="line"><span class="comment">### https://zhuanlan.zhihu.com/p/38136322 </span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">rtmpUrl = <span class="string">"rtmp://localhost:1935/live/home"</span> </span><br><span class="line">camera_path = <span class="number">0</span> </span><br><span class="line">cap = cv.VideoCapture(camera_path) </span><br><span class="line"></span><br><span class="line"><span class="comment"># Get video information </span></span><br><span class="line">fps = <span class="built_in">int</span>(cap.get(cv.CAP_PROP_FPS)) </span><br><span class="line">width = <span class="built_in">int</span>(cap.get(cv.CAP_PROP_FRAME_WIDTH)) </span><br><span class="line">height = <span class="built_in">int</span>(cap.get(cv.CAP_PROP_FRAME_HEIGHT)) </span><br><span class="line"></span><br><span class="line"><span class="comment"># ffmpeg command </span></span><br><span class="line">command = [<span class="string">'ffmpeg'</span>, </span><br><span class="line"> <span class="string">'-y'</span>, </span><br><span class="line"> <span class="string">'-f'</span>, <span class="string">'rawvideo'</span>, </span><br><span class="line"> <span class="string">'-vcodec'</span>,<span class="string">'rawvideo'</span>, </span><br><span class="line"> <span class="string">'-pix_fmt'</span>, <span class="string">'bgr24'</span>, </span><br><span class="line"> <span class="string">'-s'</span>, <span class="string">"{}x{}"</span>.<span class="built_in">format</span>(width, height), </span><br><span class="line"> <span class="string">'-r'</span>, <span class="built_in">str</span>(fps), </span><br><span class="line"> <span class="string">'-i'</span>, <span class="string">'-'</span>, </span><br><span class="line"> <span class="string">'-c:v'</span>, <span class="string">'libx264'</span>, </span><br><span class="line"> <span class="string">'-pix_fmt'</span>, <span class="string">'yuv420p'</span>, </span><br><span class="line"> <span class="string">'-preset'</span>, <span class="string">'ultrafast'</span>, </span><br><span class="line"> <span class="string">'-f'</span>, <span class="string">'flv'</span>, </span><br><span class="line"> rtmpUrl] </span><br><span class="line"></span><br><span class="line"><span class="comment"># 管道配置 </span></span><br><span class="line">p = sp.Popen(command, stdin=sp.PIPE) </span><br><span class="line"></span><br><span class="line"><span class="comment"># read webcamera </span></span><br><span class="line"><span class="keyword">while</span>(cap.isOpened()): </span><br><span class="line"> ret, frame = cap.read() </span><br><span class="line"> <span class="comment"># frame_queue.put(frame) </span></span><br><span class="line"> <span class="keyword">if</span> <span class="keyword">not</span> ret: </span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"Opening camera is failed"</span>) </span><br><span class="line"> <span class="keyword">break</span> </span><br><span class="line"></span><br><span class="line"> <span class="comment"># process frame </span></span><br><span class="line"> <span class="comment"># your code </span></span><br><span class="line"> <span class="comment"># process frame </span></span><br><span class="line"></span><br><span class="line"> <span class="comment"># write to pipe </span></span><br><span class="line"> <span class="comment"># if frame_queue.empty() != True: </span></span><br><span class="line"> <span class="comment"># frame_new = frame_queue.get() </span></span><br><span class="line"> p.stdin.write(frame.tostring()) </span><br></pre></td></tr></table></figure><h3 id="ffmpeg-参数详解"><a href="#ffmpeg-参数详解" class="headerlink" title="ffmpeg 参数详解"></a>ffmpeg 参数详解</h3><p>基本使用方式:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ffmpeg [[options][`-i' input_file]] {[options] output_file}</span><br></pre></td></tr></table></figure><p>参数含义:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br></pre></td><td class="code"><pre><span class="line">a) 通用选项</span><br><span class="line">-L license</span><br><span class="line">-h 帮助</span><br><span class="line">-fromats 显示可用的格式,编解码的,协议的。。。</span><br><span class="line">-f fmt 强迫采用格式fmt</span><br><span class="line">-i filename 输入文件</span><br><span class="line">-y 覆盖输出文件(即如果test.***文件已经存在的话,不经提示就覆盖掉了)</span><br><span class="line">-t duration 设置纪录时间 hh:mm:ss[.xxx]格式的记录时间也支持</span><br><span class="line">-ss position 搜索到指定的时间 [-]hh:mm:ss[.xxx]的格式也支持。使用-ss参数的作用,可以从指定时间点开始转换任务,-ss后的时间单位为秒</span><br><span class="line">-title string 设置标题(比如PSP中显示影片的标题)</span><br><span class="line">-author string 设置作者</span><br><span class="line">-copyright string 设置版权</span><br><span class="line">-comment string 设置评论</span><br><span class="line">-target type 设置目标文件类型(vcd,svcd,dvd) 所有的格式选项(比特率,编解码以及缓冲区大小)自动设置 ,只需要输入如下的就可以了:ffmpeg -i myfile.avi -target vcd vcd.mpg</span><br><span class="line">-hq 激活高质量设置</span><br><span class="line">-itsoffset offset 设置以秒为基准的时间偏移,该选项影响所有后面的输入文件。该偏移被加到输入文件的时戳,定义一个正偏移意味着相应的流被延迟了 offset秒。 [-]hh:mm:ss[.xxx]的格式也支持。</span><br><span class="line">b) 视频选项</span><br><span class="line">-b bitrate 设置比特率,缺省200kb/s</span><br><span class="line">-vb bitrate set bitrate (in bits/s)</span><br><span class="line">-vframes number 设置要编码多少帧</span><br><span class="line">-r fps 设置帧频 缺省25</span><br><span class="line">-s size 设置帧大小 格式为W*H 缺省160X128.也可以直接使用简写,也认:Sqcif qcif cif 4cif 等</span><br><span class="line">-aspect aspect 设置横纵比 4:3 16:9 或 1.3333 1.7777</span><br><span class="line">-croptop size 设置顶部切除带大小 像素单位</span><br><span class="line">-cropbottom size -cropleft size -cropright size</span><br><span class="line">-padtop size 设置顶部补齐的大小 像素单位</span><br><span class="line">-padbottom size -padleft size -padright size -padcolor color 设置补齐条颜色(hex,6个16进制的数,红:绿:兰排列,比如 000000代表黑色)</span><br><span class="line">-vn 不做视频记录</span><br><span class="line">-bt tolerance 设置视频码率容忍度kbit/s (固定误差)</span><br><span class="line">-maxrate bitrate设置最大视频码率容忍度 (可变误差)</span><br><span class="line">-minrate bitreate 设置最小视频码率容忍度(可变误差)</span><br><span class="line">-bufsize size 设置码率控制缓冲区大小</span><br><span class="line">-vcodec codec 强制使用codec编解码方式,如-vcodec xvid 使用xvid压缩 如果用copy表示原始编解码数据必须被拷贝。</span><br><span class="line">-sameq 使用同样视频质量作为源(VBR)</span><br><span class="line">-pass n 选择处理遍数(1或者2)。两遍编码非常有用。第一遍生成统计信息,第二遍生成精确的请求的码率</span><br><span class="line">-passlogfile file 选择两遍的纪录文件名为file</span><br><span class="line">c)高级视频选项</span><br><span class="line">-g gop_size 设置图像组大小 这里设置GOP大小,也表示两个I帧之间的间隔</span><br><span class="line">-intra 仅适用帧内编码</span><br><span class="line">-qscale q 使用固定的视频量化标度(VBR) 以<q>质量为基础的VBR,取值0.01-255,约小质量越好,即qscale 4和-qscale 6,4的质量比6高 。此参数使用次数较多,实际使用时发现,qscale是种固定量化因子,设置qscale之后,前面设置的-b好像就无效了,而是自动调整了比特率。</span><br><span class="line">-qmin q 最小视频量化标度(VBR) 设定最小质量,与-qmax(设定最大质量)共用</span><br><span class="line">-qmax q 最大视频量化标度(VBR) 使用了该参数,就可以不使用qscale参数</span><br><span class="line">-qdiff q 量化标度间最大偏差 (VBR)</span><br><span class="line">-qblur blur 视频量化标度柔化(VBR)</span><br><span class="line">-qcomp compression 视频量化标度压缩(VBR)</span><br><span class="line">-rc_init_cplx complexity 一遍编码的初始复杂度</span><br><span class="line">-b_qfactor factor 在p和b帧间的qp因子</span><br><span class="line">-i_qfactor factor 在p和i帧间的qp因子</span><br><span class="line">-b_qoffset offset 在p和b帧间的qp偏差</span><br><span class="line">-i_qoffset offset 在p和i帧间的qp偏差</span><br><span class="line">-rc_eq equation 设置码率控制方程 默认tex^qComp</span><br><span class="line">-rc_override override 特定间隔下的速率控制重载</span><br><span class="line">-me method 设置运动估计的方法 可用方法有 zero phods log x1 epzs(缺省) full</span><br><span class="line">-dct_algo algo 设置dct的算法 可用:</span><br><span class="line">0 FF_DCT_AUTO 缺省的DCT</span><br><span class="line">1 FF_DCT_FASTINT</span><br><span class="line">2 FF_DCT_INT</span><br><span class="line">3 FF_DCT_MMX</span><br><span class="line">4 FF_DCT_MLIB</span><br><span class="line">5 FF_DCT_ALTIVEC</span><br><span class="line">-idct_algo algo 设置idct算法。可用的有:</span><br><span class="line">0 FF_IDCT_AUTO 缺省的IDCT</span><br><span class="line">1 FF_IDCT_INT</span><br><span class="line">2 FF_IDCT_SIMPLE</span><br><span class="line">3 FF_IDCT_SIMPLEMMX</span><br><span class="line">4 FF_IDCT_LIBMPEG2MMX</span><br><span class="line">5 FF_IDCT_PS2</span><br><span class="line">6 FF_IDCT_MLIB</span><br><span class="line">7 FF_IDCT_ARM</span><br><span class="line">8 FF_IDCT_ALTIVEC</span><br><span class="line">9 FF_IDCT_SH4</span><br><span class="line">10 FF_IDCT_SIMPLEARM</span><br><span class="line">-er n 设置错误残留为n</span><br><span class="line">1 FF_ER_CAREFULL 缺省</span><br><span class="line">2 FF_ER_COMPLIANT</span><br><span class="line">3 FF_ER_AGGRESSIVE</span><br><span class="line">4 FF_ER_VERY_AGGRESSIVE</span><br><span class="line">-ec bit_mask 设置错误掩蔽为bit_mask,该值为如下值的位掩码 1 FF_EC_GUESS_MVS (default=enabled) 2 FF_EC_DEBLOCK (default=enabled)</span><br><span class="line">-bf frames 使用frames个B 帧,支持mpeg1,mpeg2,mpeg4(即如果-bf 2的话,在两个非b帧中间隔的b帧数目为2,即IBBPBBPBBP结构)</span><br><span class="line">-mbd mode 宏块决策</span><br><span class="line">0 FF_MB_DECISION_SIMPLE 使用mb_cmp</span><br><span class="line">1 FF_MB_DECISION_BITS 2 FF_MB_DECISION_RD</span><br><span class="line">-4mv 使用4个运动矢量 仅用于mpeg4</span><br><span class="line">-part 使用数据划分 仅用于mpeg4</span><br><span class="line">-bug param 绕过没有被自动监测到编码器的问题</span><br><span class="line">-strict strictness 跟标准的严格性</span><br><span class="line">-aic 使能高级帧内编码 h263+</span><br><span class="line">-umv 使能无限运动矢量 h263+</span><br><span class="line">-deinterlace 不采用交织方法</span><br><span class="line">-interlace 强迫交织法编码 仅对mpeg2和mpeg4有效。当你的输入是交织的并且你想要保持交织以最小图像损失的时候采用该选项。可选的方法是不交织,但是损失更大</span><br><span class="line">-psnr 计算压缩帧的psnr</span><br><span class="line">-vstats 输出视频编码统计到vstats_hhmmss.log</span><br><span class="line">-vhook module 插入视频处理模块 module 包括了模块名和参数,用空格分开</span><br><span class="line">-bitexact 使用标准比特率</span><br><span class="line">-max_qdiff 视频中所有桢(包括i/b/P)的最大Q值差距</span><br><span class="line">-b_qfactor 表示i/p与B的Q值比例因子,值越大B桢劣化越严重</span><br><span class="line">-b_qoffset 表示1/p与B的Q值比例的偏移量,值越大B桢劣化越严重.如果大于0,那么下一个B的Q=前一个P的Q乘以b_quant_factor再加上offset,如果小于0,则B的Q=负的normal_Q乘以factor加上offset.</span><br><span class="line">-i_qfactor p和i的Q值比例因子,越接近1则P越优化.</span><br><span class="line">-i_qoffset p和i的Q的偏移量</span><br><span class="line">D)音频选项%%%%</span><br><span class="line">-ab bitrate 设置音频码率</span><br><span class="line">-ar freq 设置音频采样率</span><br><span class="line">-ac channels 设置通道 缺省为1,即单通道</span><br><span class="line">-an 不使能音频纪录</span><br><span class="line">-acodec codec 使用codec编解码 如:-acodec AAC 使用AAC音频编码</span><br></pre></td></tr></table></figure><p>对了,如果大家对AI、新技术、软件评测感兴趣,可以关注我的微信公众号:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a></p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://juejin.cn/post/7215842530838085692">睡后收入(无人直播) - 掘金</a></li><li>FFmpeg的官方网址是 <a href="http://ffmpeg.mplayerhq.hu/">http://ffmpeg.mplayerhq.hu/</a> </li><li>中文Wiki是 <a href="http://www.ffmpeg.com.cn/">http://www.ffmpeg.com.cn/</a> </li><li><a href="https://zhuanlan.zhihu.com/p/118362010">Windows下安装使用ffmpeg - 知乎</a></li><li><a href="../%E3%80%90===1-%E7%9F%A5%E8%AF%86%E4%BD%93%E7%B3%BB===%E3%80%91/0-%E6%8A%80%E6%9C%AF/1-%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83&%E5%B7%A5%E5%85%B7/3-API&%E5%B0%8F%E6%8A%80%E5%B7%A7/Ffmpeg%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7.md">Ffmpeg使用技巧</a></li><li><a href="../../../../%E3%80%90===2-%E9%A1%B9%E7%9B%AE===%E3%80%91/009-%E8%A7%86%E5%B1%8F%E7%9B%91%E6%8E%A7/%E5%AE%B6%E5%BA%AD%E8%A7%86%E9%A2%91%E7%9B%91%E6%8E%A7%E7%B3%BB%E7%BB%9F.md">家庭视频监控系统</a></li></ol>]]></content>
<tags>
<tag> 每日文章 </tag>
<tag> ffmpeg </tag>
</tags>
</entry>
<entry>
<title>AgentGPT-带互联网搜索功能的chatGPT</title>
<link href="/2023/04/25/AgentGPT-%E5%B8%A6%E4%BA%92%E8%81%94%E7%BD%91%E6%90%9C%E7%B4%A2%E5%8A%9F%E8%83%BD%E7%9A%84chatGPT/"/>
<url>/2023/04/25/AgentGPT-%E5%B8%A6%E4%BA%92%E8%81%94%E7%BD%91%E6%90%9C%E7%B4%A2%E5%8A%9F%E8%83%BD%E7%9A%84chatGPT/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>Agent GPT 主要的AI 功能就是建立在原版的AutoGPT 之上,然后再加上图形介面,这样阅读起来比较容易也比较方便。<br>相较于ChatGPT,它具有:互联网搜索查询功能、任务拆解各个执行然后串联能力。<br>它能够根据用户需求,在用户完全不插手的情况下自主执行任务,包括日常的事件分析、营销方案撰写、代码编程、数学运算等事务都能代劳。<br>这里我会按照AgentGPT 官方所建议的步骤,一步一步教搭建安装并体验AgentGPT。</p></blockquote><span id="more"></span><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425145426.png" alt="20230425145426|left|475"></p><h3 id="如何安装Agent-GPT"><a href="#如何安装Agent-GPT" class="headerlink" title="如何安装Agent GPT"></a>如何安装Agent GPT</h3><ul><li>平台:win10 docker desktop </li><li>安装方法:<ol><li>在github上下载<a href="https://github.com/reworkd/AgentGPT">AgentGPT项目</a>:<code>git clone [email protected]:reworkd/AgentGPT.git</code></li><li>按照官网推荐的docker安装方式:<code>./setup.sh --docker</code>,当然你也可以在本地安装,不过介于docker安装方式最简单,所以这边就不再本地环境搭建了,有兴趣可以在github agentGPT官网上查询。<a href="https://github.com/reworkd/AgentGPT">GitHub - reworkd/AgentGPT: 🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.</a><br><em>这里有个小的知识点,如何在win10上运行.sh脚本文件?答案是:用git bash</em></li><li>用setup脚本安装完成之后,可以用<code>docker ps -a</code>确认下container是否真的安装好并启动:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425144818.png" alt="20230425144818|left|525">可以看到agentgpt已经成功创建成功,并在3000端口运行了。</li><li>访问agentGPT container的web:<a href="http://localhost:3000/">http://localhost:3000/</a>,出现这个界面就表示安装成功了:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425145027.png" alt="20230425145027|left|475"></li><li>接下来我们设置下AI驱动,点击settings,选择gpt-3.5-turbo,输入你的gpt3.5 kye(这个需要你之前注册好,注册的硬性要求有两个:1. 需要会魔法。 2.需要有国外手机号,用于接收验证码,这类网站有很多,请自行百度)<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425145325.png" alt="20230425145325|left|475"></li></ol></li></ul><h3 id="AgentGPT使用体验"><a href="#AgentGPT使用体验" class="headerlink" title="AgentGPT使用体验"></a>AgentGPT使用体验</h3><h4 id="询问系统时间"><a href="#询问系统时间" class="headerlink" title="询问系统时间"></a>询问系统时间</h4><p>这个实验尝试了文agentGPT现在时间是几点?<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425145750.png" alt="20230425145750|left|500"><br>在这里可以看到他的分析思路是:</p><ul><li>使用系统时钟获取当前时间</li><li>将当前时间转换为字符串格式</li><li>返回字符串时间作为响应</li><li>将字符串时间转换为数字时间</li><li>返回数字时间作为响应<br>思路是对的,想法也很好,但是在执行第一步骤的时候就失败了:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425150017.png" alt="20230425150017|left|500">之后就是不停的循环这几个步骤,陷入了死循环。</li></ul><h4 id="统计淘宝网上销量前6的血压仪价格及名称"><a href="#统计淘宝网上销量前6的血压仪价格及名称" class="headerlink" title="统计淘宝网上销量前6的血压仪价格及名称"></a>统计淘宝网上销量前6的血压仪价格及名称</h4><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425150456.png" alt="20230425150456|left|675"><br>结果:我很满意,的确是有访问互联网并统计到。<br>但是,我不满意的是它的任务拆解执行能力,我的确是从它的子任务重得到了答案,但是它把任务拆分的方式有问题,还是会陷入死循环。<br>因此,如何跳出死循环,这个是AgentGPT需要加强的地方。当然这也是最难的地方。</p><p>随后我让它用中文回复我,可以看到它的确是有统计到结果,但是一旦遇到某一步骤无法得到结果,它就会不停的陷入死循环:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230425150901.png" alt="20230425150901|left|500"></p><h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><p>AgetGPT的确是给人眼前一亮的感觉,相较于chatGPT它的互联网搜索能力、任务拆解执行能力,的确是很经验。<br>但是,如何跳出死循环这部分还是需要继续努力。不过介于目前的版本还是beta版本,所以我觉得已经很棒了,加油,希望可以给我们带来更好的产品。</p><p>对了,如果大家对AI、新技术、软件评测感兴趣,可以关注我的微信公众号:<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100734.png" alt="image-20220328170047757|left" style="zoom: 12.5%;" />或者个人博客:<a href="https://weicun.gitee.io/">https://weicun.gitee.io/</a> <a href="https://weicun.gitee.io/">蓝色单车</a></p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><p>1.<br>2.<br>3. </p>]]></content>
</entry>
<entry>
<title>组件世界-初体验</title>
<link href="/2023/04/23/obsidian%E4%BD%93%E9%AA%8C%E7%BB%84%E4%BB%B6%E4%B8%96%E7%95%8C/"/>
<url>/2023/04/23/obsidian%E4%BD%93%E9%AA%8C%E7%BB%84%E4%BB%B6%E4%B8%96%E7%95%8C/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>逛网站的时候看到的组件库,感觉很漂亮,记录并实验看下效果。<br> 我用的是 obsidian,所以本文是基于 obsidian 来实验组件世界的效果。</p></blockquote><span id="more"></span><h3 id="组件世界-介绍"><a href="#组件世界-介绍" class="headerlink" title="组件世界-介绍"></a>组件世界-介绍</h3><p>一个服务于 <strong>Notion 类</strong>产品、<strong>双链笔记类</strong>产品、<strong>代码托管平台</strong>「GitHub 等」、<strong>博客系统</strong>「WordPress」以及为知笔记等文本编辑器的可嵌入式小组件库。<br>一个辅助用户建立个性化、可视化的<strong>仪表盘</strong>或者<strong>知识库</strong>的工具。<br><strong>官网地址</strong>:<a href="https://cn.widgetstore.net/#/lib/basic">组件世界/WidgetStore - 丰富的嵌入式小组件库、动态图标库、可视化图表库</a></p><h3 id="组件世界-功能"><a href="#组件世界-功能" class="headerlink" title="组件世界-功能"></a>组件世界-功能</h3><p>目前,「组件世界/WidgetStore」提供<strong>基础组件、动态图标、动态背景、可视化图表、Notion 汉化、效率时代「博客」</strong>。</p><h3 id="组件世界-支持的平台"><a href="#组件世界-支持的平台" class="headerlink" title="组件世界-支持的平台"></a>组件世界-支持的平台</h3><p><strong>Notion 类笔记软件</strong>:包括 Notion、FlowUs 息流笔记 <a href="https://www.zhihu.com/people/8b64b81de4123ec48f2f75c1b254929c">@FlowUs</a>、Wolai 我来云笔记、ClickUp、Coda、Anytype. 以及将来支持网页嵌入的印象笔记 Verse、微软 Microsoft Loop、妙记多 <a href="https://www.zhihu.com/people/38a9626ec5cde25f8653f9dd082da795">@妙记多Mojidoc</a> ……<br><strong>双链笔记软件</strong>,比如 Roam Research、Obsidian 黑曜石、Logseq、RemNote、思源笔记、Roam Edit、HuluNote 葫芦笔记。<br><strong>其他编辑器</strong>:为知笔记 WizNote<br><strong>代码托管平台</strong>:Github、Gitee、Gitlab<br><strong>博客平台</strong>:Wordpress<br><img src="https://pic4.zhimg.com/80/v2-5395c20620c0ae38d30839b233c44c67_1440w.webp" alt="|475"></p><h3 id="组件世界-特点"><a href="#组件世界-特点" class="headerlink" title="组件世界-特点"></a>组件世界-特点</h3><p><strong>小组件类型丰富</strong>。目前,「组件世界/WidgetStore」提供了包括 <strong>基础组件、动态图标、动态背景、可视化图表、Notion 汉化</strong> 等多种服务,可以为笔记用户<strong>提供适用于时间管理、任务管理、资讯管理、习惯养成、学习等多种使用场景的解决方案</strong>。比如,在基础组件中包括天气、时钟、番茄钟、倒计时、日历、纪念日、习惯打卡、访客统计、白噪音、热力图、微博热搜、百度统计埋点等多种类型等小组件。<br><strong>小组件服务稳定</strong>。相比国外同类产品,服务稳定,使用十分方便。<br><strong>小组件支持个性化定制</strong>。小组件支持文字字体、颜色、数字等基础信息的组件设置。与此同时,小组件也支持小组件外观背景等公共配置。<br><strong>小组件平台化</strong>。目前,「组件世界/WidgetStore」正在快速迭代中。并且,「组件世界/WidgetStore」支持第三方开发者参与开发小组件,共建社区生态。</p><h3 id="实际使用体验"><a href="#实际使用体验" class="headerlink" title="实际使用体验"></a>实际使用体验</h3><h4 id="注册账号"><a href="#注册账号" class="headerlink" title="注册账号"></a>注册账号</h4><p>官网: <a href="https://cn.widgetstore.net/#/lib/basic">组件世界/WidgetStore - 丰富的嵌入式小组件库、动态图标库、可视化图表库</a><br>微信登陆。免费版 and 付费版的差异:<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230423133519.png" alt="20230423133519|left|775"></p><p>免费版用于体验体验还是不错的。39.9 元/年那个套餐看起来还不错的,有需要的可以试试。</p><h4 id="天气预报"><a href="#天气预报" class="headerlink" title="天气预报"></a>天气预报</h4><p>创建该组件,获取 url 地址:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://cn.widgetstore.net/view/index.html?q=5a69cbba6343e96e008b8d577a5b4815.0122a5876444c41d099d8ced1592d84f</span><br></pre></td></tr></table></figure><p>替换下面的 url 地址:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">iframe</span> <span class="attr">src</span>=<span class="string">"https://cn.widgetstore.net/view/index.html?q=b47ffc57625d6ba5004fa62311af799f.a145a9ee6444a6c200037f1662fa074d"</span> <span class="attr">frameborder</span>=<span class="string">"0"</span> <span class="attr">width</span>=<span class="string">"300"</span> <span class="attr">height</span>=<span class="string">"300"</span> ></span><span class="tag"></<span class="name">iframe</span>></span></span><br></pre></td></tr></table></figure><p>实际效果:</p><iframe src="https://cn.widgetstore.net/view/index.html?q=5a69cbba6343e96e008b8d577a5b4815.0122a5876444c41d099d8ced1592d84f" frameborder="0" width="400" height="300" ></iframe><h4 id="节假日倒计时"><a href="#节假日倒计时" class="headerlink" title="节假日倒计时"></a>节假日倒计时</h4><p>配置同上,实际效果:</p><iframe src="https://cn.widgetstore.net/view/index.html?q=b47ffc57625d6ba5004fa62311af799f.a145a9ee6444a6c200037f1662fa074d" frameborder="0" width="300" height="300" ></iframe>#### 动态日历<iframe src="https://swg.notion.pet/s/1923d7786444c5b90003a5f02b42821d" frameborder="0" width="100" height="100" ></iframe><h4 id="卡片胶囊倒计时"><a href="#卡片胶囊倒计时" class="headerlink" title="卡片胶囊倒计时"></a>卡片胶囊倒计时</h4><iframe src="https://swg.notion.pet/s/bg-873d64f46444c657000518ee33dd78b0" frameborder="0" width="500" height="300" ></iframe>#### 图表类型折线图、饼状图、柱状图等需要 notion 数据库,目前用 obsidian,所以这部分无法尝试。<h3 id="实际使用感受"><a href="#实际使用感受" class="headerlink" title="实际使用感受"></a>实际使用感受</h3><p>obsidian 使用组件世界基本玩的差不多了,总体感觉:眼睛一亮,后续仍然需要加强。<br>如果说到建议的话:</p><ul><li>免费账户政策 bug: <ul><li>免费账户只可以使用 2 个小组件,这个里面其实是有个政策 bug 的。因为任意一个账号创建的小组件,都可以免费的给任何用。(例如上文中的天气组件,你们都可以随便用)那么,如果我有几个小伙伴,每个人都注册一个这样的账号,然后创建各不相同的组件,然后共享。这样分分钟钟就可以用遍所有小组件。 </li><li>当然我没有这样做,这样做挺没意思的。我们还是要支持正版软件的良性循环。</li></ul></li><li>图表类型组件数据库支持类型太少了:<ul><li>正如官网上所说,目前只支持 notion,这个对 obsidian 不太友好。</li></ul></li><li>网上免费的资源有许多可以实现同等效果:<ul><li>例如:<a href="https://tianqiapi.com/api.php?style=tw&skin=pitaya">苏州天气预报 - TianqiAPI.com</a> 也可以实现同等的效果,所以用户依赖性不是很强。<div><iframe scrolling="no" src="https://tianqiapi.com/api.php?style=tw&skin=pitaya" frameborder="0" width="500" height="500" allowtransparency="true"></iframe></div>好了,今天就到这里了,有什么想法欢迎给我留言。thanks❤</li></ul></li></ul><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://zhuanlan.zhihu.com/p/582745338">「组件世界/WidgetStore」 :一个丰富、强大的嵌入式小组件库 - 知乎</a></li><li></li><li></li></ol>]]></content>
</entry>
<entry>
<title>hexo 部署填写 github 用户名和密码一次性解决方案</title>
<link href="/2023/04/20/hexo%E9%83%A8%E7%BD%B2%E5%A1%AB%E5%86%99github%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81%E4%B8%80%E6%AC%A1%E6%80%A7%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/"/>
<url>/2023/04/20/hexo%E9%83%A8%E7%BD%B2%E5%A1%AB%E5%86%99github%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81%E4%B8%80%E6%AC%A1%E6%80%A7%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/</url>
<content type="html"><![CDATA[<blockquote><p>🌈<strong>Description</strong>:<br>hexo 部署文章时候,会弹出 github 弹窗填写 username 和 password,填完之后还是无法上传,本文会给出解决方法。</p></blockquote><span id="more"></span><h2 id="问题描述"><a href="#问题描述" class="headerlink" title="问题描述"></a>问题描述</h2><p>hexo 博客半年没写了,今天尝试更新,发现 <code>hexo d</code> 之后需要输入 github 的用户名和密码,但是我输入之后没有效果,还是无法推送到 github 上。<br>研究之后发现 rootcause 是:github 已经无法再用密码登陆推送,只能用 token,我的 token 之前只设置了 3 个月的有效期,所以现在失效了。</p><h2 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h2><h4 id="1-重新生成新的-token"><a href="#1-重新生成新的-token" class="headerlink" title="1. 重新生成新的 token"></a>1. 重新生成新的 token</h4><p>新的 token 设置网址:<a href="https://github.com/settings/tokens">Personal Access Tokens (Classic) (github.com)</a><br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230420101025.png" alt="20230420101025|left"><br>新的 token (%%🔐α 💡ID💡MDO/W 4 Cm 9 AJ 4 Ls 8/i+yXXM 5 GzNzTJ 0 o 2 u 4 AwfZGVs 5 EqWEESkIf 0+kWt+quYVANDGUCe 4 GJWAxLJnr 7 vIgsi 7 QtSUNma 9 MPz 🔐%%)记得保存好,网页刷新之后就再也看不见了。</p><h4 id="2-配置-hexo-config-yml"><a href="#2-配置-hexo-config-yml" class="headerlink" title="2. 配置 hexo config.yml"></a>2. 配置 hexo config.yml</h4><p>配置 hexo config.yml:<br>原本的配置:<code>repo: https://github.com/weicun581/weicun581.git</code><br>新的配置:<code>repo: https://your token [email protected]/weicun581/weicun581.git</code><br>替换 <code>your token here</code> 替换成上一步的 token 就好了。</p><h2 id="实际使用效果"><a href="#实际使用效果" class="headerlink" title="实际使用效果"></a>实际使用效果</h2><p>在 hexo 根目录下执行:<code>hexo d</code>,之后在 github project 的 action 界面就可以看到 action 动作了:<br><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20230420101947.png" alt="20230420101947|left"></p><hr><h3 id="🌈参考:"><a href="#🌈参考:" class="headerlink" title="🌈参考:"></a>🌈参考:</h3><ol><li><a href="https://blog.csdn.net/qq_43340547/article/details/119895671">(75条消息) 命令行输入hexo d后发现不能输入GitHub密码登录_SoberGit的博客-CSDN博客</a></li><li><a href="https://blog.csdn.net/weixin_41010198/article/details/119698015?utm_source=app&app_version=4.12.0&code=app_1562916241&uLinkId=usr1mkqgl919blen">(75条消息) github开发人员在七夕搞事情:remote: Support for password authentication was removed on August 13, 2021._点亮~黑夜的博客-CSDN博客</a></li></ol><p>个人博客地址:<a href="https://weicun.gitee.io/">蓝色单车 (gitee.io)</a></p>]]></content>
<tags>
<tag> hexo </tag>
<tag> 每日文章 </tag>
<tag> github </tag>
</tags>
</entry>
<entry>
<title>日记怀旧</title>
<link href="/2023/04/20/%E9%87%8D%E6%96%B0%E5%BC%80%E5%A7%8B/"/>
<url>/2023/04/20/%E9%87%8D%E6%96%B0%E5%BC%80%E5%A7%8B/</url>
<content type="html"><![CDATA[<h3 id="2023-04-20小记"><a href="#2023-04-20小记" class="headerlink" title="2023-04-20小记"></a>2023-04-20小记</h3><h4 id="博客停更的原因"><a href="#博客停更的原因" class="headerlink" title="博客停更的原因"></a>博客停更的原因</h4><p>hello 大家好,这个博客网站快有半年没更新了,原因嘛,很好解释,没有人跟我互动,懒得写了,后来就搁置了。<br>其实这半年还有好多事情,导致博客网站没有继续写下去:</p><ul><li>疫情的爆发</li><li>工作量突然加重</li><li>内心的浮躁<br>我觉得客观原因都是小事情,关键是内心浮躁了,总是想着赚钱、赚钱、赚钱。结果啥也没干成。<br>所以想了下,还是要沉下心来,努力做事情,而不是天天想着搞钱,做事浅尝辄止、做人浮浮躁躁。<span id="more"></span></li></ul><h4 id="关于博客日后的规划"><a href="#关于博客日后的规划" class="headerlink" title="关于博客日后的规划"></a>关于博客日后的规划</h4><ol><li>记录日常感悟,分享人生经历,总结生活。</li><li>分享个人技术成长路线。</li><li>分享技术热点</li></ol>]]></content>
<categories>
<category> 日记 </category>
</categories>
<tags>
<tag> 日记 </tag>
</tags>
</entry>
<entry>
<title>日记怀旧</title>
<link href="/2022/11/15/009-%E6%97%A5%E8%AE%B0%E6%80%80%E6%97%A7/"/>
<url>/2022/11/15/009-%E6%97%A5%E8%AE%B0%E6%80%80%E6%97%A7/</url>
<content type="html"><![CDATA[<h3 id="2022-x2F-11-x2F-15-小记"><a href="#2022-x2F-11-x2F-15-小记" class="headerlink" title="2022/11/15 小记"></a>2022/11/15 小记</h3><p>很久之前,大概是 2013 年的时候,在人人上听过,惊为天人。<br>快 10 年了,<br>人人网也已经不在,<br>曾经想逃离的过去,现在却成了回不去的记忆。</p><span id="more"></span> <iframe src="//player.bilibili.com/player.html?aid=254554192&bvid=BV1zY411g7zT&cid=544709836&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" height=300> </iframe>]]></content>
<categories>
<category> 日记 </category>
</categories>
<tags>
<tag> 日记 </tag>
</tags>
</entry>
<entry>
<title>有意思的名言警句</title>
<link href="/2022/11/15/%E6%9C%89%E6%84%8F%E6%80%9D%E7%9A%84%E5%90%8D%E8%A8%80%E8%AD%A6%E5%8F%A5/"/>
<url>/2022/11/15/%E6%9C%89%E6%84%8F%E6%80%9D%E7%9A%84%E5%90%8D%E8%A8%80%E8%AD%A6%E5%8F%A5/</url>
<content type="html"><![CDATA[<center><font size=5>今天看到的名言警句</font></center><ul><li><p><a href="https://www.apachecn.org/#/">名言警句</a>:</p><ol><li><p>渣男除了渣没其他缺点,舔狗除了舔没其他优点。</p></li><li><p>既然我们做什么都会被喷,____________。</p></li><li><p>搞钱的大原则就是信息不对称。</p></li><li><p>风口可能有很多个,但是对应的技术可能就那么点,所以,尽早储备一个通用的技术栈。</p><span id="more"></span></li><li><p>资本家为了奴役你给你挖了很多坑,比如消费主义,比如训练你当螺丝钉,还有最重要的就是榨干你的空闲时间。</p></li><li><p>打工的钱都是棺材费,自己从市场赚的才叫钱。尽早摆脱打工人的困境比啥都重要。</p></li><li><p>在体验一样的情况下,选成本低的,但不要为此牺牲体验。</p></li><li><p>如果花在开源上的时间和刷牙洗脸一样,那么可持续性就不是问题。</p></li><li><p>宣传应当是你的产品的不可分割的一部分,它和内容同等重要,并且可以借助技术做得更好。五分内容五分宣传,这就是五五开定律。</p></li><li><p>冗余:一、预估时间的时候,将极限时间x2就是最终时间(侯世达定律)。二、重要资料做好备份,本地至少两份在不同介质上。</p></li><li><p>第一性原理:完成一个目标只有少数几个必要条件。只需要专注他们,不要总是有奇奇怪怪的无效假设。不要被乌合之众的观点/做法绑架。</p></li><li><p>热插拔:保证自己是个独立完整的系统,与别人合作但不依赖别人。优先磨练自己的议价能力而不是协作能力来增加选择面,保证自己可以随时中止合作关系,防止受限于任何人。遇到问题优先考虑终止合作并换人,而不是改善合作关系。</p></li><li><p>专注、迭代、极致:一次只专注于一件事情,允许不足,在多个迭代中反复改进,尽可能达到极致。</p></li><li><p>大数据:(1)大数据不仅仅指数字和表格本身,也包含情报,经验,教程,方法论这些非结构化数据。(2)收集数据来遍历每一种可能性,对抗不确定性,避免认知偏差,好处是无需亲身实践直接借助他人经验。(3)注意收集你暂时用不到,但是大家都需要的数据,并且改造你的存储设施来存的下更多数据。</p></li><li><p>跨界:用数字化改造一切,程序员的使命就是先消灭其它行业再消灭自身。</p></li></ol></li><li><p>感悟:</p><ol><li><p>渣男好像真的只是渣,其他都是有点,舔狗唯一的特点舔貌似也不是什么有点,只会招人烦。</p></li><li><p>所以,宁愿做渣男也不要做舔狗。</p></li><li><p>既然做任何事情都会被喷,那我还在乎你喷不喷?</p></li><li><p>通用技术栈一定要精通、熟练掌握。(写软件、网站开发、小程序)</p></li><li><p>空闲时间,利用好了就是我自大的资本;利用不好,只会消耗自己。</p></li><li><p>副业很重要。</p></li><li><p>合理规划目标,每次只focus on一个计划,时间要预留充足。</p></li><li><p>数字化everything。</p></li></ol></li></ul>]]></content>
<tags>
<tag> 日记 </tag>
</tags>
</entry>
<entry>
<title>python多进程</title>
<link href="/2022/10/27/008-Python%E5%A4%9A%E8%BF%9B%E7%A8%8B/"/>
<url>/2022/10/27/008-Python%E5%A4%9A%E8%BF%9B%E7%A8%8B/</url>
<content type="html"><![CDATA[<blockquote><p>大家看过前面文章的应该都知道python中的GIL的存在,也就是多线程的时候,同一时间只能有一个线程在CPU上运行,而且是单个CPU上运行,不管你的CPU有多少核数。如果想要充分地使用多核CPU的资源,在python中大部分情况需要使用多进程。</p></blockquote><h2 id="多进程介绍"><a href="#多进程介绍" class="headerlink" title="多进程介绍"></a>多进程介绍</h2><ul><li>进程:一个程序运行起来后,代码+用到的资源 称为进程。他是操作系统分配资源的基本单元。线程完成的多任务,进程也可以。</li><li>现在的电脑的CPU一般都有多个核心,在Python中可以使用 multiprocessing 包比较方便地实现将计算任务分配给多个核心,使之并行地计算以实现加速的效果。</li><li>进程是表示资源分配的基本单位,又是调度运行的基本单位。例如,用户运行自己的程序,系统就创建一个进程,并为它分配资源,包括各种表格、<a href="https://so.csdn.net/so/search?q=%E5%86%85%E5%AD%98&spm=1001.2101.3001.7020">内存</a>空间、磁盘空间、I/O设备等。所以,进程是系统中的并发执行的单位。</li></ul><span id="more"></span><h2 id="多进程用法"><a href="#多进程用法" class="headerlink" title="多进程用法"></a>多进程用法</h2><h3 id="多进程实现方法"><a href="#多进程实现方法" class="headerlink" title="多进程实现方法"></a>多进程实现方法</h3><ul><li>Python中的多进程是通过multiprocessing包来实现的。</li><li>利用multiprocessing.Process对象来创建一个进程对象。</li><li>构造方法:<code>Process([group [, target [, name [, args [, kwargs]]]]])</code><ul><li>group: 线程组 </li><li>target: 要执行的方法</li><li>name: 进程名</li><li>args/kwargs: 要传入方法的参数</li></ul></li><li>实例方法:<ul><li>start() :进程准备就绪,等待CPU调度。</li><li>run():strat()调用run方法,如果实例进程时未制定传入target,这star执行t默认run()方法。</li><li>join([timeout]):阻塞当前上下文环境的进程程,直到调用此方法的进程终止或到达指定的timeout(可选参数)。</li><li>is_alive():返回进程是否在运行,bool类型。</li><li>terminate():不管任务是否完成,立即停止工作进程</li></ul></li><li>属性:<ul><li>name:进程名字</li><li>pid:进程号</li></ul></li></ul><h4 id="1-常见多进程用法"><a href="#1-常见多进程用法" class="headerlink" title="1. 常见多进程用法"></a>1. 常见多进程用法</h4><ul><li><p>最简单的多进程方法:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> multiprocessing <span class="keyword">import</span> Process</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">fun1</span>(<span class="params">name</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'测试%s多进程'</span> %name)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> process_list = []</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">5</span>): <span class="comment">#开启5个子进程执行fun1函数</span></span><br><span class="line"> p = Process(target=fun1,args=(<span class="string">'Python'</span>,)) <span class="comment">#实例化进程对象</span></span><br><span class="line"> p.start()</span><br><span class="line"> process_list.append(p)</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> process_list:</span><br><span class="line"> p.join()</span><br><span class="line"></span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'结束测试'</span>)</span><br></pre></td></tr></table></figure></li></ul><h4 id="2-类实现多进程用法"><a href="#2-类实现多进程用法" class="headerlink" title="2. 类实现多进程用法"></a>2. 类实现多进程用法</h4><ul><li><p>继承类Process方法:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> multiprocessing <span class="keyword">import</span> Process</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">MyProcess</span>(<span class="title class_ inherited__">Process</span>): <span class="comment">#继承Process类</span></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">__init__</span>(<span class="params">self,name</span>):</span><br><span class="line"> <span class="built_in">super</span>(MyProcess,self).__init__()</span><br><span class="line"> self.name = name</span><br><span class="line"></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">self</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'测试%s多进程'</span> % self.name)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> process_list = []</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">5</span>): <span class="comment">#开启5个子进程执行fun1函数</span></span><br><span class="line"> p = MyProcess(<span class="string">'Python'</span>) <span class="comment">#实例化进程对象</span></span><br><span class="line"> p.start()</span><br><span class="line"> process_list.append(p)</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> process_list:</span><br><span class="line"> p.join()</span><br><span class="line"></span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'结束测试'</span>)</span><br></pre></td></tr></table></figure></li></ul><h3 id="多进程通信"><a href="#多进程通信" class="headerlink" title="多进程通信"></a>多进程通信</h3><blockquote><p>进程是系统独立调度核分配系统资源(CPU、内存)的基本单位,进程之间是相互独立的,每启动一个新的进程相当于把数据进行了一次克隆,子进程里的数据修改无法影响到主进程中的数据,不同子进程之间的数据也不能共享,这是多进程在使用中与多线程最明显的区别。</p><p>但是难道Python多进程中间难道就是孤立的吗?</p><p>当然不是,python也提供了多种方法实现了多进程中间的通信和数据共享(可以修改一份数据)</p></blockquote><h4 id="1-进程队列Queue"><a href="#1-进程队列Queue" class="headerlink" title="1. 进程队列Queue"></a>1. 进程队列Queue</h4><ul><li><p>queue:进程之间的数据管道,实现进程通信。</p></li><li><p>有点类似派一个间谍过去,时不时的往回发送情报。</p><figure class="highlight py"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> multiprocessing <span class="keyword">import</span> Process,Queue</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">fun1</span>(<span class="params">q,i</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'子进程%s 开始put数据'</span> %i)</span><br><span class="line"> q.put(<span class="string">'我是%s 通过Queue通信'</span> %i)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> q = Queue()</span><br><span class="line"></span><br><span class="line"> process_list = []</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">3</span>):</span><br><span class="line"> p = Process(target=fun1,args=(q,i,)) <span class="comment">#注意args里面要把q对象传给我们要执行的方法,这样子进程才能和主进程用Queue来通信</span></span><br><span class="line"> p.start()</span><br><span class="line"> process_list.append(p)</span><br><span class="line"></span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> process_list:</span><br><span class="line"> p.join()</span><br><span class="line"></span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'主进程获取Queue数据'</span>)</span><br><span class="line"> <span class="built_in">print</span>(q.get())</span><br><span class="line"> <span class="built_in">print</span>(q.get())</span><br><span class="line"> <span class="built_in">print</span>(q.get())</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'结束测试'</span>)</span><br></pre></td></tr></table></figure></li></ul><h4 id="2-管道Pipe"><a href="#2-管道Pipe" class="headerlink" title="2. 管道Pipe"></a>2. 管道Pipe</h4><ul><li><p>管道Pipe和Queue的作用大致差不多,也是实现进程间的通信。</p></li><li><p>有点类似量子纠缠,先设置一对纠缠粒子,把其中一个发送给子进程,然后通过量子纠缠的方式进行瞬时通信。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> multiprocessing <span class="keyword">import</span> Process, Pipe</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">fun1</span>(<span class="params">conn</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'子进程发送消息:'</span>)</span><br><span class="line"> conn.send(<span class="string">'你好主进程'</span>)</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'子进程接受消息:'</span>)</span><br><span class="line"> <span class="built_in">print</span>(conn.recv())</span><br><span class="line"> conn.close()</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> conn1, conn2 = Pipe() <span class="comment">#关键点,pipe实例化生成一个双向管</span></span><br><span class="line"> p = Process(target=fun1, args=(conn2,)) <span class="comment">#conn2传给子进程</span></span><br><span class="line"> p.start()</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'主进程接受消息:'</span>)</span><br><span class="line"> <span class="built_in">print</span>(conn1.recv())</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'主进程发送消息:'</span>)</span><br><span class="line"> conn1.send(<span class="string">"你好子进程"</span>)</span><br><span class="line"> p.join()</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'结束测试'</span>)</span><br></pre></td></tr></table></figure></li></ul><h4 id="3-数据共享方法Managers"><a href="#3-数据共享方法Managers" class="headerlink" title="3. 数据共享方法Managers"></a>3. 数据共享方法Managers</h4><ul><li><p>Queue和Pipe只是实现了数据交互,并没实现数据共享,即一个进程去更改另一个进程的数据。那么久要用到Managers。</p></li><li><p>类似定义了一个跨进程的公共变量,传入到子进程后,主进程、子进程都可以访问读写这个公共变量。</p><ul><li><pre><code class="python">from multiprocessing import Process, Managerdef fun1(dic,lis,index): dic[index] = 'a' dic['2'] = 'b' lis.append(index) # [0,1,2,3,4,0,1,2,3,4,5,6,7,8,9] #print(l)if __name__ == '__main__': with Manager() as manager: dic = manager.dict()# 注意字典的声明方式,不能直接通过{}来定义 l = manager.list(range(5))# [0,1,2,3,4] process_list = [] for i in range(10): p = Process(target=fun1, args=(dic,l,i)) p.start() process_list.append(p) for res in process_list: res.join() print(dic) print(l)</code></pre></li></ul></li></ul><h3 id="进程池"><a href="#进程池" class="headerlink" title="进程池"></a>进程池</h3><h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><h3 id="进程与线程区别"><a href="#进程与线程区别" class="headerlink" title="进程与线程区别"></a>进程与线程区别</h3><h3 id="进程和线程分别适用于什么情况"><a href="#进程和线程分别适用于什么情况" class="headerlink" title="进程和线程分别适用于什么情况"></a>进程和线程分别适用于什么情况</h3><h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2>]]></content>
<categories>
<category> 教程 </category>
</categories>
<tags>
<tag> python </tag>
</tags>
</entry>
<entry>
<title>python多线程</title>
<link href="/2022/10/26/007-Python%E5%A4%9A%E7%BA%BF%E7%A8%8B/"/>
<url>/2022/10/26/007-Python%E5%A4%9A%E7%BA%BF%E7%A8%8B/</url>
<content type="html"><![CDATA[<h2 id="多线程介绍"><a href="#多线程介绍" class="headerlink" title="多线程介绍"></a>多线程介绍</h2><h4 id="什么是线程"><a href="#什么是线程" class="headerlink" title="什么是线程"></a>什么是线程</h4><p>线程(Thread)也叫轻量级进程,是操作系统能够进行运算调度的最小单位,它被包涵在进程之中,是进程中的实际运作单位。</p><p>个线程可以创建和撤消另一个线程,同一进程中的多个线程之间可以并发执行。</p><h3 id="为什么需要多线程"><a href="#为什么需要多线程" class="headerlink" title="为什么需要多线程"></a>为什么需要多线程</h3><ul><li>进程之间不能共享内存,但线程之间共享内存非常容易。</li><li>使用多线程来实现多任务并发执行比使用多进程的效率高。</li><li>多个线程需要并发处理,并共享处理结果。</li></ul><span id="more"></span><h2 id="多线程实现方法"><a href="#多线程实现方法" class="headerlink" title="多线程实现方法"></a>多线程实现方法</h2><h3 id="创建线程"><a href="#创建线程" class="headerlink" title="创建线程"></a>创建线程</h3><h4 id="1-普通创建线程方法"><a href="#1-普通创建线程方法" class="headerlink" title="1.普通创建线程方法"></a>1.普通创建线程方法</h4><ul><li><p>调用threading模块:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading,time</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">run</span>(<span class="params"><span class="built_in">input</span></span>):</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'sub task:%s'</span>%<span class="built_in">input</span>)</span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> t = threading.Thread(target=run, args=(<span class="string">"hello world"</span>,))</span><br><span class="line"> t.start()</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'main task'</span>)</span><br><span class="line"> time.sleep(<span class="number">1</span>) </span><br></pre></td></tr></table></figure></li></ul><h4 id="2-Thread类继承方法"><a href="#2-Thread类继承方法" class="headerlink" title="2.Thread类继承方法"></a>2.Thread类继承方法</h4><ul><li><p>新建类,继承自threading.Thread类:</p><figure class="highlight py"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">MyThread</span>(threading.Thread):</span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">__init__</span>(<span class="params">self, <span class="built_in">input</span></span>):</span><br><span class="line"> <span class="built_in">super</span>(MyThread, self).__init__() <span class="comment"># 重构run函数必须要写</span></span><br><span class="line"> self.<span class="built_in">input</span> = <span class="built_in">input</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">self</span>):</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"task"</span>, self.<span class="built_in">input</span>)</span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">"__main__"</span>:</span><br><span class="line"> t1 = MyThread(<span class="string">"hello world 1"</span>)</span><br><span class="line"> t2 = MyThread(<span class="string">"hello world 2"</span>)</span><br><span class="line"> t1.start()</span><br><span class="line"> t2.start()</span><br></pre></td></tr></table></figure></li></ul><h3 id="守护线程"><a href="#守护线程" class="headerlink" title="守护线程"></a>守护线程</h3><h4 id="1-设置子线程为守护线程"><a href="#1-设置子线程为守护线程" class="headerlink" title="1.设置子线程为守护线程"></a>1.设置子线程为守护线程</h4><ul><li><p>使用setDaemon(True)把所有的子线程都变成了主线程的守护线程,因此<strong>当主进程结束后,子线程也会随之结束</strong>。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">n</span>):</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"task"</span>, self.<span class="built_in">input</span>)</span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> t = threading.Thread(target=run, args=(<span class="string">"hello world"</span>,))</span><br><span class="line"> t.setDaemon(<span class="literal">True</span>) <span class="comment"># 主线程kill,子线程自动kill</span></span><br><span class="line"> t.start()</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"end"</span>)</span><br></pre></td></tr></table></figure></li></ul><h4 id="2-主线程等待子线程结束后执行下一步"><a href="#2-主线程等待子线程结束后执行下一步" class="headerlink" title="2.主线程等待子线程结束后执行下一步"></a>2.主线程等待子线程结束后执行下一步</h4><ul><li><p>为了让守护<strong>线程执行结束之后,主线程再结束</strong>,我们可以使用join方法,让主线程等待子线程执行。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">n</span>):</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'sub task'</span>)</span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> t = threading.Thread(target=run, args=(<span class="string">"t1"</span>,))</span><br><span class="line"> t.setDaemon(<span class="literal">True</span>) <span class="comment"># 主线程kill,子线程自动kill</span></span><br><span class="line"> t.start()</span><br><span class="line"> t.join() <span class="comment"># 主线程停止等待子线程执行完毕后,再继续执行!</span></span><br><span class="line"> <span class="comment"># 注释掉之后,就是子线程、主线程同时跑!</span></span><br></pre></td></tr></table></figure></li></ul><h4 id="3-多线程共享全局变量"><a href="#3-多线程共享全局变量" class="headerlink" title="3.多线程共享全局变量"></a>3.多线程共享全局变量</h4><ul><li><p>线程是进程的执行单元,进程是系统分配资源的最小单位,所以在同一个进程中的多线程是共享资源的。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line">g_num = <span class="number">100</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">n</span>):</span><br><span class="line"> <span class="keyword">global</span> g_num</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'sub task'</span>)</span><br><span class="line"> g_num += <span class="number">1</span></span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> t = threading.Thread(target=run, args=(<span class="string">"t1"</span>,))</span><br><span class="line"> t.setDaemon(<span class="literal">True</span>) <span class="comment"># 主线程kill,子线程自动kill</span></span><br><span class="line"> t.start()</span><br><span class="line"> <span class="comment"># t.join() # 主线程停止等待子线程执行完毕后,再继续执行!</span></span><br><span class="line"> <span class="comment"># 注释掉之后,就是子线程、主线程同时跑!</span></span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'main task:%d'</span>%g_num)</span><br><span class="line"> time.sleep(<span class="number">1</span>) </span><br><span class="line"></span><br></pre></td></tr></table></figure></li></ul><h4 id="4-互斥锁"><a href="#4-互斥锁" class="headerlink" title="4.互斥锁"></a>4.互斥锁</h4><ul><li><p>当<strong>多个线程同时修改同一条数据时可能会出现脏数据</strong>,所以,出现了线程锁,即同一时刻允许一个线程执行操作。</p></li><li><p><strong>如果有多个线程同时操作一个对象</strong>,如果没有很好地保护该对象,会造成程序结果的不可预期,我们也称此为<strong>“线程不安全”</strong>。</p></li><li><p><strong>线程锁用于锁定资源</strong>,你可以定义多个锁, 像下面的代码, 当你需要独占某一资源时,任何一个锁都可以锁这个资源,就好比你用不同的锁都可以把相同的一个门锁住是一个道理。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> threading <span class="keyword">import</span> Thread,Lock</span><br><span class="line"><span class="keyword">import</span> os,time,threading</span><br><span class="line">reg = <span class="number">0</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">work1</span>():</span><br><span class="line"> <span class="keyword">global</span> reg</span><br><span class="line"></span><br><span class="line"> lock.acquire()</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> reg = i</span><br><span class="line"> <span class="built_in">print</span>(reg)</span><br><span class="line"> time.sleep(<span class="number">0.5</span>)</span><br><span class="line"> lock.release()</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">work2</span>():</span><br><span class="line"> <span class="keyword">global</span> reg</span><br><span class="line"></span><br><span class="line"> lock.acquire()</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> reg = i * <span class="number">10</span></span><br><span class="line"> <span class="built_in">print</span>(reg)</span><br><span class="line"> time.sleep(<span class="number">0.5</span>)</span><br><span class="line"> lock.release()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> lock=Lock()</span><br><span class="line"> t1 = threading.Thread(target=work1)</span><br><span class="line"> t2 = threading.Thread(target=work2)</span><br><span class="line"> t1.start()</span><br><span class="line"> t2.start()</span><br><span class="line"> t1.join() <span class="comment"># hold on ,wait for this thread</span></span><br><span class="line"> t2.join() <span class="comment"># hold on ,wait for this thread</span></span><br></pre></td></tr></table></figure></li></ul><h4 id="5-递归锁"><a href="#5-递归锁" class="headerlink" title="5.递归锁"></a>5.递归锁</h4><ul><li><p>RLcok类的用法和Lock类一模一样,但它支持嵌套,在多个锁没有释放的时候一般会使用RLcok类。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">Func</span>(<span class="params">lock</span>):</span><br><span class="line"> <span class="keyword">global</span> gl_num</span><br><span class="line"> lock.acquire()</span><br><span class="line"> gl_num += <span class="number">1</span></span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"> <span class="built_in">print</span>(gl_num)</span><br><span class="line"> lock.release()</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> gl_num = <span class="number">0</span></span><br><span class="line"> lock = threading.RLock()</span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line"> t = threading.Thread(target=Func, args=(lock,))</span><br><span class="line"> t.start()</span><br></pre></td></tr></table></figure></li></ul><h4 id="6-信号量"><a href="#6-信号量" class="headerlink" title="6.信号量"></a>6.信号量</h4><ul><li><p>互斥锁同时只允许一个线程更改数据,而Semaphore是同时允许一定数量的线程更改数据 ,比如厕所有3个坑,那最多只允许3个人上厕所,后面的人只能等里面有人出来了才能再进去。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">n, semaphore</span>):</span><br><span class="line"> semaphore.acquire() <span class="comment">#加锁</span></span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"run the thread:%s\n"</span> % n)</span><br><span class="line"> semaphore.release() <span class="comment">#释放</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> num = <span class="number">0</span></span><br><span class="line"> semaphore = threading.BoundedSemaphore(<span class="number">5</span>) <span class="comment"># 最多允许5个线程同时运行</span></span><br><span class="line"> <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">22</span>):</span><br><span class="line"> t = threading.Thread(target=run, args=(<span class="string">"t-%s"</span> % i, semaphore))</span><br><span class="line"> t.start()</span><br><span class="line"> <span class="keyword">while</span> threading.active_count() != <span class="number">1</span>:</span><br><span class="line"> <span class="keyword">pass</span> <span class="comment"># print threading.active_count()</span></span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">'-----all threads done-----'</span>)</span><br></pre></td></tr></table></figure></li></ul><h4 id="7-事件(Event类)"><a href="#7-事件(Event类)" class="headerlink" title="7.事件(Event类)"></a>7.事件(Event类)</h4><ul><li><p>python线程的事件用于主线程控制其他线程的执行,事件是一个简单的线程同步对象,其主要提供以下几个方法:</p><ul><li>clear 将flag设置为“False”</li><li>set 将flag设置为“True”</li><li>is_set 判断是否设置了flag</li><li>wait 会一直监听flag,如果没有检测到flag就一直处于阻塞状态</li></ul></li><li><p>事件处理的机制:全局定义了一个“Flag”,当flag值为“False”,那么event.wait()就会阻塞,当flag值为“True”,那么event.wait()便不再阻塞。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#利用Event类模拟红绿灯</span></span><br><span class="line"><span class="keyword">import</span> threading</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line">event = threading.Event()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 前5秒是绿灯,5~10秒是红灯。</span></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">lighter</span>():</span><br><span class="line"> count = <span class="number">0</span></span><br><span class="line"> event.<span class="built_in">set</span>() <span class="comment">#初始值为绿灯</span></span><br><span class="line"> <span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line"> <span class="keyword">if</span> <span class="number">5</span> < count <=<span class="number">10</span> :</span><br><span class="line"> event.clear() <span class="comment"># 红灯,清除标志位</span></span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"\33[41;1mred light is on...\033[0m"</span>)</span><br><span class="line"> <span class="keyword">elif</span> count > <span class="number">10</span>:</span><br><span class="line"> event.<span class="built_in">set</span>() <span class="comment"># 绿灯,设置标志位</span></span><br><span class="line"> count = <span class="number">0</span></span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"\33[42;1mgreen light is on...\033[0m"</span>)</span><br><span class="line"></span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"> count += <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">car</span>(<span class="params">name</span>):</span><br><span class="line"> <span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line"> <span class="keyword">if</span> event.is_set(): <span class="comment">#判断是否设置了标志位</span></span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"[%s] running..."</span>%name)</span><br><span class="line"> time.sleep(<span class="number">1</span>)</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"[%s] sees red light,waiting..."</span>%name)</span><br><span class="line"> event.wait()</span><br><span class="line"> <span class="built_in">print</span>(<span class="string">"[%s] green light is on,start going..."</span>%name)</span><br><span class="line"></span><br><span class="line">light = threading.Thread(target=lighter,)</span><br><span class="line">light.start()</span><br><span class="line"></span><br><span class="line">car = threading.Thread(target=car,args=(<span class="string">"MINI"</span>,))</span><br><span class="line">car.start()</span><br></pre></td></tr></table></figure></li></ul><h2 id="Python多线程内在逻"><a href="#Python多线程内在逻" class="headerlink" title="Python多线程内在逻"></a>Python多线程内在逻</h2><ul><li>在非python环境中,单核情况下,同时只能有一个任务执行。多核时可以支持多个线程同时执行<strong>。但是在python中,无论有多少核,同时只能执行一个线程。</strong></li><li>**GIL的全称是Global Interpreter Lock(全局解释器锁)**,来源是python设计之初的考虑,为了数据安全所做的决定。某个线程想要执行,必须先拿到GIL,我们可以把GIL看作是“通行证”,并且在一个python进程中,GIL只有一个。拿不到通行证的线程,就不允许进入CPU执行。</li><li>Python多线程的工作过程:(python在使用多线程的时候,调用的是c语言的原生线程)<ul><li>拿到公共数据</li><li>申请gil</li><li>python解释器调用os原生线程</li><li>os操作cpu执行运算</li><li>当该线程执行时间到后,无论运算是否已经执行完,gil都被要求释放</li><li>进而由其他进程重复上面的过程</li><li>等其他进程执行完后,又会切换到之前的线程(从他记录的上下文继续执行),整个过程是每个线程执行自己的运算,当执行时间到就进行切换(context switch)。</li></ul></li></ul><h2 id="参考教程"><a href="#参考教程" class="headerlink" title="参考教程"></a>参考教程</h2><blockquote><p><a href="https://www.cnblogs.com/luyuze95/p/11289143.html">https://www.cnblogs.com/luyuze95/p/11289143.html</a></p></blockquote>]]></content>
<categories>
<category> 教程 </category>
</categories>
<tags>
<tag> python </tag>
</tags>
</entry>
<entry>
<title>Markdown使用方法</title>
<link href="/2022/10/21/006-Markdown%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/"/>
<url>/2022/10/21/006-Markdown%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/</url>
<content type="html"><![CDATA[<blockquote><p>Markdown是一种轻量级标记语言,排版语法简洁,让人们更多地关注内容本身而非排版。它使用易读易写的纯文本格式编写文档,可与HTML混编,可导出 HTML、PDF 以及本身的 .md 格式的文件。因简洁、高效、易读、易写,Markdown被大量使用,如Github、Wikipedia、简书等。</p></blockquote><span id="more"></span><h2 id="基本语法"><a href="#基本语法" class="headerlink" title="基本语法"></a>基本语法</h2><h3 id="【标题】"><a href="#【标题】" class="headerlink" title="【标题】"></a>【标题】</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># 这是 H1 </span><br><span class="line">## 这是 H2 </span><br><span class="line">### 这是 H3 </span><br><span class="line">#### 这是 H4 </span><br><span class="line">##### 这是 H5 </span><br><span class="line">###### 这是 H6 </span><br></pre></td></tr></table></figure><p><code><span id="jump"></code><br><strong>预设锚点</strong></p><h3 id="【修辞和强调】"><a href="#【修辞和强调】" class="headerlink" title="【修辞和强调】"></a>【修辞和强调】</h3><p>使用星号和底线来标记需要强调的区段<br><strong>加粗</strong><br><strong>加粗</strong><br><em>斜体</em><br><em>斜体</em><br>==变红==</p><h3 id="【删除线】"><a href="#【删除线】" class="headerlink" title="【删除线】"></a>【删除线】</h3><p><del>要删掉的内容</del></p><h3 id="【下划线】"><a href="#【下划线】" class="headerlink" title="【下划线】"></a>【下划线】</h3><p><code><u></code>带下划线文本<code></u></code></p><h3 id="【列表】"><a href="#【列表】" class="headerlink" title="【列表】"></a>【列表】</h3><p><strong>无序列表</strong> 使用星号、加号和减号来做为列表的项目标记</p><ul><li>Candy.</li><li>Gum.</li></ul><ul><li>Booze.</li></ul><ul><li>Booze.</li></ul><ul><li><p>Booze.</p><ul><li>嵌套</li></ul><ul><li>嵌套</li></ul></li></ul><p><strong>有序列表</strong>则是使用一般的数字接着一个英文句点作为项目标记</p><ol><li>hello</li><li>hello2</li><li>hello3</li></ol><h3 id="【待办事项】"><a href="#【待办事项】" class="headerlink" title="【待办事项】"></a>【待办事项】</h3><p>可以使用复选框来标记某个项目各项任务的完成情况[x] A[ ] B</p><ul><li><input checked="" disabled="" type="checkbox"> 已选中</li><li><input disabled="" type="checkbox"> 未选中</li></ul><h3 id="【链接】"><a href="#【链接】" class="headerlink" title="【链接】"></a>【链接】</h3><p><a href="https://www.baidu.com/">baidu</a></p><!--超链接在新窗口打开--><p><a href="https://king-hcj.github.io/">example</a>{:target=’_blank’}</p><p>[跳转到”Python基础.md”](★★★ Python常用库范例/• Python基础.md)</p><h3 id="【图片】"><a href="#【图片】" class="headerlink" title="【图片】"></a>【图片】</h3><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901095832.png" alt="11月的肖邦"></p><h3 id="【表格】"><a href="#【表格】" class="headerlink" title="【表格】"></a>【表格】</h3><table><thead><tr><th align="left">Item</th><th align="right">Value</th><th align="center">Qty</th></tr></thead><tbody><tr><td align="left">Computer</td><td align="right">1600 USD</td><td align="center">5</td></tr><tr><td align="left">Phone</td><td align="right">12 USD</td><td align="center">12</td></tr><tr><td align="left">Pipe</td><td align="right">1 USD</td><td align="center">234</td></tr></tbody></table><table><thead><tr><th align="left">左对齐****</th><th align="right">右对齐****</th><th align="center">居中对齐****</th></tr></thead><tbody><tr><td align="left">单元格</td><td align="right">单元格</td><td align="center">单元格</td></tr><tr><td align="left">单元格</td><td align="right">单元格</td><td align="center">单元格</td></tr></tbody></table><table><thead><tr><th>Header1</th><th>Header2</th></tr></thead><tbody><tr><td>item 1</td><td>1. one<br />2. two<br />3. three</td></tr></tbody></table><h3 id="【引用】"><a href="#【引用】" class="headerlink" title="【引用】"></a>【引用】</h3><blockquote><p>这里是一段引用</p></blockquote><h3 id="【分割线】"><a href="#【分割线】" class="headerlink" title="【分割线】"></a>【分割线】</h3><hr><h3 id="【Markdown-区块】"><a href="#【Markdown-区块】" class="headerlink" title="【Markdown 区块】"></a>【Markdown 区块】</h3><blockquote><p>区块引用</p><blockquote><p>菜鸟教程</p></blockquote><blockquote><blockquote><p>学的不仅是技术更是梦想</p></blockquote></blockquote></blockquote><h3 id="【换行】"><a href="#【换行】" class="headerlink" title="【换行】"></a>【换行】</h3><p>只需要两个以上的空格然后回车</p><p>我是首行</p><p>我换行了</p><h2 id="Markdown高级用法"><a href="#Markdown高级用法" class="headerlink" title="Markdown高级用法"></a>Markdown高级用法</h2><h3 id="转义"><a href="#转义" class="headerlink" title="转义"></a>转义</h3><p>Markdown 使用了很多特殊符号来表示特定的意义,如果需要显示特定的符号则需要使用转义字符,Markdown 使用反斜杠转义特殊字符:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">**文本加粗** </span><br><span class="line">\*\* 正常显示星号 \*\*</span><br></pre></td></tr></table></figure><p>效果如下:</p><ul><li>** 正常显示星号 **</li></ul><h3 id="Markdown-文章篇内目录"><a href="#Markdown-文章篇内目录" class="headerlink" title="Markdown 文章篇内目录"></a>Markdown 文章篇内目录</h3><ul><li>在 amWiki 中,仅抽取 h2、h3 且按出现顺序转换为目录,h4 以下可以自由安排</li><li>在 amWiki 中,h1 不参与目录,因为 h1 只建议作为大标题使用一次</li><li>如果您的标题不写序号,生成目录第时候,将在标题文字前自动添加一个数字序号</li><li>如果您的标题是由序号开始,则不再额外添加序号</li><li>以下标题类型将识别为已经带有序号,除此外不会识别:<ul><li>数字序号示范<ul><li>4.1 示范</li><li>(4.1) 示范</li></ul></li><li>中文序号示范<ul><li>第一章 示范</li><li>第二节 示范</li><li>三、示范</li><li>(四) 示范</li><li>(十二)示范</li><li>【一百五十六】示范</li><li>【壹佰伍拾陆】示範</li></ul></li></ul></li></ul><h3 id="Markdown-脚注"><a href="#Markdown-脚注" class="headerlink" title="Markdown 脚注"></a>Markdown 脚注</h3><p>文章正文某处<a href="%E8%BF%99%E6%98%AF%E8%84%9A%E6%B3%A8%E8%A7%A3%E9%87%8A%E5%86%85%E5%AE%B9%EF%BC%88%E8%A6%81%E6%94%BE%E5%88%B0%E6%96%87%E7%AB%A0%E6%9C%80%E5%90%8E%EF%BC%8C%E5%90%A6%E5%88%99%E4%BC%9A%E5%AF%BC%E8%87%B4%E6%8E%92%E5%BA%8F%E6%B7%B7%E4%B9%B1%EF%BC%89">^1</a>文章正文</p><h3 id="Markdown-图片大小与对齐"><a href="#Markdown-图片大小与对齐" class="headerlink" title="Markdown 图片大小与对齐"></a>Markdown 图片大小与对齐</h3><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901095833.gif" alt="测试gif图片"></p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901095834.png" alt="图片简介" /> <h3 id="Markdown-流程图"><a href="#Markdown-流程图" class="headerlink" title="Markdown 流程图"></a>Markdown 流程图</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">graph LR;</span><br><span class="line"> A-->B</span><br><span class="line"> B-->C</span><br><span class="line"> C-->D</span><br><span class="line"> D-->A</span><br></pre></td></tr></table></figure><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">pie title Dante RegCtrl层UT code完成度(2022/7/14)</span><br><span class="line">"已完成": 62.7</span><br><span class="line">"未完成": 37</span><br></pre></td></tr></table></figure><blockquote><p>流程图部分参考:</p><ul><li><p><a href="https://blog.csdn.net/whatday/article/details/88655461">https://blog.csdn.net/whatday/article/details/88655461</a></p></li><li><p><a href="https://sspai.com/post/63055#">https://sspai.com/post/63055#</a>!</p></li><li><p><a href="https://cloud.tencent.com/developer/article/1334691">https://cloud.tencent.com/developer/article/1334691</a></p></li><li><p><a href="https://blog.csdn.net/qq_42491125/article/details/114004341">https://blog.csdn.net/qq_42491125/article/details/114004341</a></p></li></ul></blockquote><h3 id="markdown折叠内容语法"><a href="#markdown折叠内容语法" class="headerlink" title="markdown折叠内容语法"></a>markdown折叠内容语法</h3><details> <summary>内容的标题</summary> 要隐藏的内容! hello world jimmy </details><h3 id="Markdown页内跳转实现方法(设置锚点的方式)"><a href="#Markdown页内跳转实现方法(设置锚点的方式)" class="headerlink" title="Markdown页内跳转实现方法(设置锚点的方式)"></a>Markdown页内跳转实现方法(设置锚点的方式)</h3><p><a href="#jump">点击跳转到“指定锚点”</a></p><h3 id="Markdown-文字设置"><a href="#Markdown-文字设置" class="headerlink" title="Markdown 文字设置"></a>Markdown 文字设置</h3><h4 id="设置文字属性"><a href="#设置文字属性" class="headerlink" title="设置文字属性"></a>设置文字属性</h4><table><tr><td bgcolor="#FFFF00">==__我要变成#7FFF00背景色__==</td></tr></table> <div style="background-color: #FFFF00"><span style="color: #FF0000;font-size: 28px;">As you think, so shall you become.</span></div> <td style="background-color: #FFFF00"><span style="color: #FF0000;font-size: 28px;">As you think, so shall you become.</span></td><table><tr><td bgcolor="#FFFF00"><span style="color: #FF0000;font-size: 18px;">__As you think, so shall you become.__</span></td></tr></table> <tr><td bgcolor="#FFFF00"><span style="color: #FF0000;font-size: 18px;">__As you think, so shall you become.__</span></td></tr> <span style="color: #696969;font-size: 28px;text-shadow: black 0.1em 0.1em 0.2em">在 Markdown 中,为文字设置其他属性</span> <span style="color: #ef4136;font-size: 28px;text-shadow: 0 0 0.2em #2edfa3, 0 0 0.2em #FF8877">天意怜芳草,人间重晚晴。</span> <span style="font-size: 28px;background-image: linear-gradient(to right bottom, rgb(255,0,0), rgb(255,128,0), rgb(255,255,0), rgb(0,255,0), rgb(0,255,128), rgb(0,255,255), rgb(0,128,255), rgb(0,0,255), rgb(128,0,255), rgb(255,0,255), rgb(255,0,128)); -webkit-background-clip: text;color: transparent;">悲莫悲兮生别离, 乐莫乐兮新相知。</span><div style="background-color: #cccccc"><span style="color: #C8C8C8;font-size: 28px;text-shadow: 1px 1px white, -1px -1px #444444;">As you think, so shall you become.</span></div><h4 id="改变文字背景颜色"><a href="#改变文字背景颜色" class="headerlink" title="改变文字背景颜色"></a>改变文字背景颜色</h4><table><tr><td bgcolor="#7FFF00">我要变成#7FFF00背景色</td></tr></table> <table><tr><td bgcolor="#D2691E">我要变成#D2691E背景色</td></tr></table> <table><tr><td bgcolor="#6495ED">我要变成#6495ED背景色</td></tr></table> <table><tr><td bgcolor="#FFF8DC">我要变成#FFF8DC背景色</td></tr></table> <table><tr><td bgcolor="#008B8B">我要变成#008B8B背景色</td></tr></table> <table><tr><td bgcolor="#A9A9A9">我要变成#A9A9A9背景色</td></tr></table> <table><tr><td bgcolor="#8FBC8F">我要变成#8FBC8F背景色</td></tr></table><h3 id="markdown中插入特殊字符"><a href="#markdown中插入特殊字符" class="headerlink" title="markdown中插入特殊字符"></a>markdown中插入特殊字符</h3><p><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901095835.png"></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">|| </span><br><span class="line">`` </span><br><span class="line">]] </span><br><span class="line">[#91; </span><br><span class="line">>> </span><br><span class="line"><< </span><br><span class="line">@@ </span><br><span class="line">## </span><br><span class="line">-- </span><br></pre></td></tr></table></figure><h3 id="markdown中插入html代码"><a href="#markdown中插入html代码" class="headerlink" title="markdown中插入html代码"></a>markdown中插入html代码</h3><svg width="200" height="200" style="background-color: #398439" version="1.1" xmlns="http://www.w3.org/2000/svg"><h3 id="markdown嵌入音频、视频"><a href="#markdown嵌入音频、视频" class="headerlink" title="markdown嵌入音频、视频"></a>markdown嵌入音频、视频</h3><h4 id="markdown嵌入音频"><a href="#markdown嵌入音频" class="headerlink" title="markdown嵌入音频"></a>markdown嵌入音频</h4><audio id="audio" controls="" preload="none"> <source id="mp3" src="https://www.runoob.com/try/demo_source/horse.mp3"> </audio><audio id="audio" controls="" preload="none"> <source id="mp3" src="https://www.runoob.com/try/demo_source/horse.mp3"> </audio><h4 id="markdown嵌入视频"><a href="#markdown嵌入视频" class="headerlink" title="markdown嵌入视频"></a>markdown嵌入视频</h4><p><video src="https://www.runoob.com/try/demo_source/movie.mp4" width="320px" height="240px" controls="controls"></video> </p><h3 id="html语法"><a href="#html语法" class="headerlink" title="html语法"></a>html语法</h3><h4 id="文字"><a href="#文字" class="headerlink" title="文字"></a>文字</h4><ul><li><p><font size="6">6</font><br><font size="4">4</font><br><font color="red" size="5">红色的5</font><br><font face="黑体">黑体的字</font> </p></li><li><p><b>Bold</b><br><i>italic</i><br><u>underline</u> </p></li><li></li><li><h1>HTML 30分钟教程</h1><h2>什么是HTML</h2><h3>HTML是什么样的</h3></li></ul>]]></content>
<categories>
<category> 软件 </category>
</categories>
<tags>
<tag> Markdown </tag>
</tags>
</entry>
<entry>
<title>foldersync同步软件使用介绍</title>
<link href="/2022/10/20/004-foldersync%E5%90%8C%E6%AD%A5%E8%BD%AF%E4%BB%B6/"/>
<url>/2022/10/20/004-foldersync%E5%90%8C%E6%AD%A5%E8%BD%AF%E4%BB%B6/</url>
<content type="html"><![CDATA[<h2 id="foldersync简介"><a href="#foldersync简介" class="headerlink" title="foldersync简介"></a>foldersync简介</h2><blockquote><p> FolderSync pro是一款功能非常强大的设备本地存储(包括SD卡)文件/文件夹与云存储同步应用。它可以将手机中的文件自动同步到云端空间,支持包括 FTP、WebDAV、Dropbox、 Google Docs 在内的众多空间。</p><p> FolderSync Pro 支持各种不同的云服务商和文件协议,并且不断增加对更多平台的支持。在 root 设备上支持根文件访问。这款软件目前支持多个Google Drive,Dropbox,Amazon S3,SugarSync,Box.net,OneDrive,FTP,FTPS,SFTP,WebDAV和Windows共享帐户。</p><p> FolderSync Pro 支持将音乐、图片和其他重要文件从手机备份到您的云存储或其他方式。使用起来十分舒爽简便。而且借助于 Tasker 和类似程序的自动化支持可对您的同步进行更准确精细的控制。它包含一个完整的文件管理器,使您可以在本地和云中管理文件。复制,移动和删除云/远程帐户中的文件。支持在Amazon S3中创建/删除存储。从手机上载和下载文件。</p></blockquote><span id="more"></span><h3 id="软件功能"><a href="#软件功能" class="headerlink" title="软件功能"></a>软件功能</h3><blockquote><p>一款同步app,支持windows电脑和安卓手机之间文件夹、文件同步,需要有云盘(坚果云)作为server。</p><p>总体来说,还是一款很不错的软件。</p></blockquote><ul><li>==经验总结:==<ul><li>坚果云,不可以短时间内多次同步,会出现无法连接的情况(连接持续30s左右后不成功)。</li><li>连接参数配置很关键,出错的话,无法实现双向同步。我的参数配置如下图:<ul><li>TBD(在小米平板上,待补充!)</li></ul></li></ul></li></ul><h3 id="支持的云盘"><a href="#支持的云盘" class="headerlink" title="支持的云盘"></a>支持的云盘</h3><ul><li>```<br>Amazon S3 Simple Storage Service, Box, CloudMe, Dropbox, Google Drive, HiDrive, Livedrive Premium, MyDrive.ch, MyKolab, NetDocuments, OneDrive, OneDrive for Business, OwnCloud, pCloud, Storegate, SugarSync, WEB.DE, Yandex Disk<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">### 支持的协议</span><br><span class="line"></span><br><span class="line">- ```</span><br><span class="line"> FTP / FTPES / FTPS</span><br><span class="line"> SFTP</span><br><span class="line"> WebDAV</span><br><span class="line"> Samba / SMB / CIFS(仅SMB1)</span><br><span class="line"> SMB2(实验性)</span><br></pre></td></tr></table></figure></li></ul><h2 id="foldersync下载"><a href="#foldersync下载" class="headerlink" title="foldersync下载"></a>foldersync下载</h2><ul><li>官网地址:<a href="https://www.tacit.dk/foldersync">https://www.tacit.dk/foldersync</a></li><li>网络资源:<a href="https://pan.qian.blue/share_exp_1ove_ml/Android-APP/FolderSync/">https://pan.qian.blue/share_exp_1ove_ml/Android-APP/FolderSync/</a></li></ul><h2 id="foldersync使用方法"><a href="#foldersync使用方法" class="headerlink" title="foldersync使用方法"></a>foldersync使用方法</h2><h3 id="foldersync配置"><a href="#foldersync配置" class="headerlink" title="foldersync配置"></a>foldersync配置</h3><ul><li><strong>点击【帐户】-【添加账户】-【WebDAV】</strong><ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100314.png" alt="image-20220831112839160" style="zoom:50%;" /></li></ul></li><li><strong>填写服务器信息</strong><ul><li>step1:获取坚果云WebDAV信息、服务器信息、用户名、密码:<ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100315.png" alt="image-20220831154942174"></li></ul></li><li>step2:配置foldersync参数:<ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100316.png" alt="image-20220831155045745"></li><li>点击测试按钮,可以连接成功即可。</li></ul></li></ul></li></ul><h3 id="foldersync搭配坚果云"><a href="#foldersync搭配坚果云" class="headerlink" title="foldersync搭配坚果云"></a>foldersync搭配坚果云</h3><ul><li><p>FolderSync主界面,点击右下角的“+”号-选择“坚果云”</p><ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100317.png" alt="image-20220831155202869" style="zoom:50%;" /></li></ul></li><li><p>选择同步类型,设置远程文件夹路径和本地文件夹路径</p><ul><li><p>到远程文件夹(仅上传到云端)</p></li><li><p>到本地文件夹(仅同步到本地)</p></li><li><p>双向(同步文件夹功能)</p><blockquote><p>此处以双向同步</p></blockquote></li></ul></li><li><p>选择远程文件夹、本地文件夹(可以自己新建一个)</p></li><li><p>计划任务(定时自动同步sync)可填可不填。</p><ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220901100318.png" alt="image-20220831155543956"></li><li>点击同步即可进行同步。</li></ul></li></ul><h2 id="参考教程"><a href="#参考教程" class="headerlink" title="参考教程"></a>参考教程</h2><ul><li><a href="https://content.jianguoyun.com/36693.html">手机与电脑文件同步 - 好用的网盘坚果云 (jianguoyun.com)</a></li><li><a href="https://www.qian.blue/archives/foldersync-pro.html">FolderSync Pro介绍与各版本版集合下载 - 勿埋我心 (qian.blue)</a></li></ul>]]></content>
<categories>
<category> 软件 </category>
</categories>
<tags>
<tag> foldersync </tag>
</tags>
</entry>
<entry>
<title>docker hexo评论系统waline服务器及数据库搭建</title>
<link href="/2022/10/12/005-%E5%AE%89%E8%A3%85hexo%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9Fwaline%E7%9A%84%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%8F%8A%E6%95%B0%E6%8D%AE%E5%BA%93/"/>
<url>/2022/10/12/005-%E5%AE%89%E8%A3%85hexo%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9Fwaline%E7%9A%84%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%8F%8A%E6%95%B0%E6%8D%AE%E5%BA%93/</url>
<content type="html"><![CDATA[<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20221012171211.png" alt="image-20221012171211527" style="zoom:67%;" /><p>先吐槽一下<a href="https://waline.js.org/guide/server/databases.html">waline官网教程</a>,浪费了我3day时间去debug。</p><p>目前,官网推荐的:</p><ul><li>vercel(服务器)<!--NG--></li><li>leancloud(数据库)NG</li></ul><p>我目前使用的方法:docker服务器端 + sqlite数据库,下面分享下我的做法。</p><span id="more"></span><h2 id="安装docker、docker-compose环境123"><a href="#安装docker、docker-compose环境123" class="headerlink" title="安装docker、docker compose环境123"></a>安装docker、docker compose环境123</h2><ul><li><p><strong>安装docker:</strong></p><ul><li>国内:<code>curl -sSL https://get.daocloud.io/docker | sh</code></li><li>国外:<code>curl -sSL https://get.docker.com/ | sh</code></li></ul></li><li><p><strong>安装docker compose:</strong></p><ul><li><p>国内:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">curl -L https://get.daocloud.io/docker/compose/releases/download/v2.2.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose</span><br><span class="line">chmod +x /usr/local/bin/docker-compose</span><br></pre></td></tr></table></figure></li><li><p>国外:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">curl -L "https://github.com/docker/compose/releases/download/2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose</span><br><span class="line">chmod +x /usr/local/bin/docker-compose</span><br></pre></td></tr></table></figure></li></ul></li><li><p>检查是否安装成功:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker -v</span><br><span class="line">docker-compose -v</span><br></pre></td></tr></table></figure></li></ul><blockquote><p>docker compose作用:</p><blockquote><p>用来负责对Docker容器集群的快速编排,</p><p>由一组关联的应用容器组成的一个完整业务单元,在docker-compose.yml文件当中进行定义</p></blockquote></blockquote><ul><li><p><strong>最小docker compse使用范例:</strong></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建目录</span></span><br><span class="line">mkdir hello</span><br><span class="line">cd hello</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">新建docker-compose.yml文件</span></span><br><span class="line">vim docker-compose.yml</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">写入内容(这里在vim当中编辑yml文件挺难受的,可以在idea当中编辑远程主机的文件)</span></span><br><span class="line">version: "3.0" # 指定compose的版本</span><br><span class="line">services: # 指定服务</span><br><span class="line"> tomcat: # 单个服务</span><br><span class="line"> image: tomcat:9.0.27-jdk8 # 服务镜像</span><br><span class="line"> ports:</span><br><span class="line"> - 8081:8080 # 暴露对应的端口</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">保持文件内容后进行启动compose</span></span><br><span class="line">docker-compose up</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">服务启动之后,可以直接进行访问8081端口</span></span><br><span class="line">http://远程主机ip/8081</span><br></pre></td></tr></table></figure><blockquote><p>参考:<a href="https://blog.csdn.net/qq_44973159/article/details/121357388">https://blog.csdn.net/qq_44973159/article/details/121357388</a></p></blockquote></li></ul><h2 id="安装waline服务器及数据库"><a href="#安装waline服务器及数据库" class="headerlink" title="安装waline服务器及数据库"></a>安装waline服务器及数据库</h2><h4 id="step1:创建测试目录:"><a href="#step1:创建测试目录:" class="headerlink" title="step1:创建测试目录:"></a><strong>step1:创建测试目录:</strong></h4><ul><li><p>执行如下命令:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">cd /root</span><br><span class="line">mkdir composetest</span><br><span class="line">cd composetest</span><br></pre></td></tr></table></figure></li></ul><h4 id="step2:拉取镜像:"><a href="#step2:拉取镜像:" class="headerlink" title="step2:拉取镜像:"></a><strong>step2:拉取镜像:</strong></h4><ul><li><code>docker pull lizheming/waline</code></li></ul><h4 id="step3:在-composetest-目录下创建docker-compose-yml文件,内容如下:"><a href="#step3:在-composetest-目录下创建docker-compose-yml文件,内容如下:" class="headerlink" title="step3:在 composetest 目录下创建docker-compose.yml文件,内容如下:"></a><strong>step3:在 composetest 目录下创建docker-compose.yml文件,内容如下:</strong></h4><ul><li><p>写入如下内容:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">version: '3'</span><br><span class="line"></span><br><span class="line">services:</span><br><span class="line"> waline:</span><br><span class="line"> container_name: waline</span><br><span class="line"> image: lizheming/waline:latest</span><br><span class="line"> restart: always</span><br><span class="line"> ports:</span><br><span class="line"> - 8360:8360</span><br><span class="line"> volumes:</span><br><span class="line"> - ${PWD}/data:/app/data</span><br><span class="line"> environment:</span><br><span class="line"> TZ: 'Asia/Shanghai'</span><br><span class="line"> SQLITE_PATH: '/app/data'</span><br><span class="line"> JWT_TOKEN: 'Your token'</span><br><span class="line"> SITE_NAME: 'Your site name'</span><br><span class="line"> SITE_URL: 'https://example.com'</span><br><span class="line"> SECURE_DOMAINS: 'example.com'</span><br><span class="line"> AUTHOR_EMAIL: '[email protected]'</span><br></pre></td></tr></table></figure></li></ul><h4 id="step4:在-composetest-目录下创建-data-目录,下载-waline-sqlite-这个数据库文件:"><a href="#step4:在-composetest-目录下创建-data-目录,下载-waline-sqlite-这个数据库文件:" class="headerlink" title="step4:在 composetest 目录下创建 data 目录,下载 waline.sqlite 这个数据库文件:"></a><strong>step4:在 composetest 目录下创建 data 目录,下载 <a href="https://github.com/walinejs/waline/blob/main/assets/waline.sqlite">waline.sqlite</a> 这个数据库文件:</strong></h4><ul><li><p>命令如下:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">cd /root/composetest</span><br><span class="line">mkdir data</span><br><span class="line">cd data</span><br><span class="line">wget https://raw.githubusercontent.com/walinejs/waline/main/assets/waline.sqlite</span><br></pre></td></tr></table></figure></li></ul><h4 id="step5:使用-Compose-命令构建和运行"><a href="#step5:使用-Compose-命令构建和运行" class="headerlink" title="step5:使用 Compose 命令构建和运行"></a><strong>step5:使用 Compose 命令构建和运行</strong></h4><ul><li><p>命令如下:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd /root/composetest</span><br><span class="line">docker-compose up -d</span><br></pre></td></tr></table></figure></li><li><p>列出所有运行的容器:<code>docker-compose ps</code></p></li></ul><h4 id="step6:-访问-ip-端口:"><a href="#step6:-访问-ip-端口:" class="headerlink" title="step6: 访问 ip:端口:"></a><strong>step6: 访问 <code>ip:端口</code>:</strong></h4><ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20221012173410.png" alt="image-20221012173410742" style="zoom:50%;" /></li></ul><h2 id="参考教程"><a href="#参考教程" class="headerlink" title="参考教程"></a>参考教程</h2><blockquote><ol><li><p><a href="https://blog.csdn.net/weixin_43943642/article/details/126678317">Waline评论服务docker自部署手册 + 无需备案域名配置</a></p></li><li><p><a href="https://009898.xyz/post/docker-ji-lu/">Docker 记录 | Mark (009898.xyz)</a></p></li><li><p><a href="https://waline.js.org/guide/server/databases.html">多数据库服务支持 | Waline</a></p></li></ol></blockquote>]]></content>
<categories>
<category> 软件 </category>
</categories>
<tags>
<tag> docker </tag>
<tag> hexo </tag>
<tag> waline </tag>
</tags>
</entry>
<entry>
<title>dsyncnorize使用教</title>
<link href="/2022/09/29/003-dsyncnorize%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/"/>
<url>/2022/09/29/003-dsyncnorize%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/</url>
<content type="html"><![CDATA[<blockquote><p>一款自动备份、传递数据的软件,</p><p>支持win to win的定时备份、双向传递。</p></blockquote><span id="more"></span><h2 id="使用方法-amp-基础设定"><a href="#使用方法-amp-基础设定" class="headerlink" title="使用方法&基础设定"></a>使用方法&基础设定</h2><ul><li><img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220916112432.png" alt="image-20220916112432857" style="zoom: 50%;" /><ul><li><p>使用前一定要在checkbox上打勾,处于选中状态才能进行同步sync。</p></li><li><p>设定部分参考上面的截图。</p></li><li><p>如果需要双向同步,选择:bidirectional sync。</p></li></ul></li></ul><h2 id="特性分析"><a href="#特性分析" class="headerlink" title="特性分析"></a>特性分析</h2><h3 id="单向同步:"><a href="#单向同步:" class="headerlink" title="单向同步:"></a>单向同步:</h3><ul><li>过程:同步source的新增、删除。</li><li>结果:目标文件夹会与源文件夹一模一样。</li></ul><h3 id="双向同步:"><a href="#双向同步:" class="headerlink" title="双向同步:"></a>双向同步:</h3><ul><li>过程:双向同步新增或缺失的文件,不能同步删除动作。</li><li>结果:增量同步,两个文件夹叠加结果。</li></ul><h3 id="如何实现双向同步新增、同步删除?"><a href="#如何实现双向同步新增、同步删除?" class="headerlink" title="如何实现双向同步新增、同步删除?"></a>如何实现双向同步新增、同步删除?</h3><ul><li>平时使用时,选择双向同步。</li><li>如果需要同步删除怎么操作?<ul><li>step1:双向同步一次。</li><li>step2:在source端,删除目标文件夹、文件。</li><li>step3:在source端,单向同步到远端。</li><li>step4:改为双向同步。</li></ul></li></ul><h2 id="使用感受"><a href="#使用感受" class="headerlink" title="使用感受"></a>使用感受</h2><ul><li>大文件同步的时候,软件会进入假死状态!</li></ul>]]></content>
<categories>
<category> 软件 </category>
</categories>
<tags>
<tag> 工具 </tag>
<tag> NAS相关 </tag>
</tags>
</entry>
<entry>
<title>Python字符串小技巧</title>
<link href="/2022/09/27/002-Python%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B0%8F%E6%8A%80%E5%B7%A7/"/>
<url>/2022/09/27/002-Python%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B0%8F%E6%8A%80%E5%B7%A7/</url>
<content type="html"><![CDATA[<img src="https://hello-jimmy.oss-cn-beijing.aliyuncs.com/20220927171316.jpeg" alt="Free photos of Vintage pocket watch" style="zoom:50%;" /><blockquote><p>python字符串是最常用的功能,无论是办公自动化还是变成代码,字符串都是必不可少的技能。</p><p>本文将介绍python字符串的常用功能、转移字符。</p></blockquote><span id="more"></span><h2 id="Python的转义字符"><a href="#Python的转义字符" class="headerlink" title="Python的转义字符"></a>Python的转义字符</h2><p>Python 转义字符列表我们将在这里介绍三个实际的转义字符用例, 如果你想了解更多关于转义字符的信息,可以在此处(<a href="https://python-reference.readthedocs.io/en/latest/docs/str/escapes.html)%E6%89%BE%E5%88%B0%E5%AE%8C%E6%95%B4%E7%9A%84%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6%E5%88%97%E8%A1%A8%E3%80%82">https://python-reference.readthedocs.io/en/latest/docs/str/escapes.html)找到完整的转义字符列表。</a></p><ul><li>\n – 换行</li><li>\ – 文字反斜杠</li><li>‘ – 单引号</li><li>\” – 双引号</li></ul><p><strong>换行符</strong></p><p>有时我们可能想要打印多行字符串,我们可以通过使用单个打印语句结合换行符 \n 将字符串分成多行来实现这一点。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">print</span>(<span class="string">"this is a long sentence\nand we need to print it\non multiple lines!"</span>)</span><br><span class="line">this <span class="keyword">is</span> a long sentence</span><br><span class="line"><span class="keyword">and</span> we need to <span class="built_in">print</span> it</span><br><span class="line">on multiple lines!</span><br></pre></td></tr></table></figure><p><strong>单引号和双引号</strong></p><p>在字符串中使用引号的一种方法是对字符串和实际的引号部分使用不同的引号。如下例所示,如果我们对字符串使用单引号,那么我们将不得不对引号使用双引号,反之亦然。</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">print</span>(<span class="string">'he say, "hello world"'</span>)</span><br><span class="line">he say, <span class="string">"hello world"</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">print</span>(<span class="string">"python's awesome!"</span>)</span><br><span class="line">python<span class="string">'s awesome!</span></span><br></pre></td></tr></table></figure><h2 id="字符串常用函数"><a href="#字符串常用函数" class="headerlink" title="字符串常用函数"></a>字符串常用函数</h2><h3 id="split"><a href="#split" class="headerlink" title="split()"></a><strong>split()</strong></h3><p>看单词意思就可以知道,这个方法是用来分割字符串的,它接受参数,参数就是用来分割的标识,默认是空格分割,看个代码:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>s = <span class="string">"abc bcd"</span></span><br><span class="line"><span class="meta">>>> </span>s.split()</span><br><span class="line">[<span class="string">'abc'</span>, <span class="string">'bcd'</span>]</span><br></pre></td></tr></table></figure><h3 id="strip"><a href="#strip" class="headerlink" title="strip()"></a><strong>strip()</strong></h3><p>这个函数用来去掉字符串的空格,它还有两个兄弟函数,rstrip(),lstrip()分别是去掉字符串右边空格和去掉左边空格,代码如下:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>s = <span class="string">" abc "</span></span><br><span class="line"><span class="meta">>>> </span>s.strip()</span><br><span class="line"><span class="string">'abc'</span></span><br><span class="line">>>></span><br><span class="line"><span class="meta">>>> </span>s.rstrip()</span><br><span class="line"><span class="string">' abc'</span></span><br><span class="line"><span class="meta">>>> </span>s.lstrip()</span><br><span class="line"><span class="string">'abc</span></span><br></pre></td></tr></table></figure><h3 id="replace"><a href="#replace" class="headerlink" title="replace()"></a><strong>replace()</strong></h3><p>这个函数可以进行字符串的替换,接收2个参数,一个是要被替换的串和替换完的串,</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>s = <span class="string">"I'm zhangsan"</span></span><br><span class="line"><span class="meta">>>> </span>s.replace(<span class="string">"zhangsan"</span>, <span class="string">"lisi"</span>)</span><br><span class="line"><span class="string">"I'm lisi"</span></span><br><span class="line">>>></span><br><span class="line"><span class="meta">>>> </span>s</span><br><span class="line"><span class="string">"I'm zhangsan"</span></span><br><span class="line"><span class="meta">>>> </span>s1 = s.replace(<span class="string">"zhangsan"</span>, <span class="string">"lisi"</span>)</span><br><span class="line"><span class="meta">>>> </span><span class="built_in">print</span>(s1)</span><br><span class="line">I<span class="string">'m lisi</span></span><br></pre></td></tr></table></figure><h3 id="join"><a href="#join" class="headerlink" title="join()"></a><strong>join()</strong></h3><p>这个函数可以将列表拼接成一个字符串的形式,</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>mylist = [<span class="string">'a'</span>,<span class="string">'b'</span>,<span class="string">'c'</span>,<span class="string">'d'</span>]</span><br><span class="line"><span class="meta">>>> </span>s = <span class="string">""</span>.join(mylist)</span><br><span class="line"><span class="meta">>>> </span>s</span><br><span class="line"><span class="string">'abcd'</span></span><br></pre></td></tr></table></figure><p>引号不写内容,默认直接将字符拼接到一起,如果写上分割字符,比如逗号,拼接起来后是这样的:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span>s = <span class="string">","</span>.join(mylist)</span><br><span class="line"><span class="meta">>>> </span>s</span><br><span class="line"><span class="string">'a,b,c,d'</span></span><br></pre></td></tr></table></figure><h3 id="startswith-endswith"><a href="#startswith-endswith" class="headerlink" title="startswith(),endswith()"></a><strong>startswith(),endswith()</strong></h3><p>这2个方法经常用在条件判断中, 来判断字符串是否以某个字符开头或以某个字符结尾,举例:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span><span class="built_in">str</span> = <span class="string">"hello, python"</span></span><br><span class="line"><span class="meta">>>> </span><span class="keyword">if</span> <span class="built_in">str</span>.startswith(<span class="string">"h"</span>):</span><br><span class="line"><span class="meta">... </span> <span class="built_in">print</span>(<span class="string">"字符串以h开头"</span>)</span><br><span class="line">...</span><br><span class="line">字符串以h开头</span><br></pre></td></tr></table></figure><p>同理,可以判断字符串以某个字符结尾:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span><span class="keyword">if</span> <span class="built_in">str</span>.endswith(<span class="string">"n"</span>):</span><br><span class="line"><span class="meta">... </span> <span class="built_in">print</span>(<span class="string">"字符串以n结尾"</span>)</span><br><span class="line">...</span><br><span class="line">字符串以n结尾</span><br></pre></td></tr></table></figure><h3 id="upper-,lower"><a href="#upper-,lower" class="headerlink" title="upper(),lower()"></a><strong>upper(),lower()</strong></h3><p>upper可以将字符串转成大写,lower将字符串转成小写,这个2个方法一般用带字符判断前,进行字符串转换,转换完毕后再进行判断,比如用户输入的字符,输入Y还是y都可以,你就需要将这些输入后台都转成小写然后进行后续代码的执行:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">>>> </span><span class="built_in">str</span> = <span class="string">"Hello,Python!!"</span></span><br><span class="line">>>></span><br><span class="line"><span class="meta">>>> </span><span class="built_in">str</span>.upper()</span><br><span class="line"><span class="string">'HELLO,PYTHON!!'</span></span><br><span class="line"><span class="meta">>>> </span><span class="built_in">str</span>.lower()</span><br><span class="line"><span class="string">'hello,python!!'</span></span><br></pre></td></tr></table></figure>]]></content>
<categories>
<category> 编程 </category>
</categories>
<tags>
<tag> python </tag>
<tag> python字符串 </tag>
</tags>
</entry>
<entry>
<title>ADB(Android Debug Bridge)用法总结</title>
<link href="/2022/09/27/001-%E7%94%B5%E8%84%91%E6%8E%A7%E5%88%B6%E6%89%8B%E6%9C%BA%E6%A8%A1%E5%9D%97ADB/"/>
<url>/2022/09/27/001-%E7%94%B5%E8%84%91%E6%8E%A7%E5%88%B6%E6%89%8B%E6%9C%BA%E6%A8%A1%E5%9D%97ADB/</url>
<content type="html"><![CDATA[<p><strong>ADB(Android Debug Bridge)用法总结</strong> </p><blockquote><p>作用:让win电脑通过命令行控制手机的各种行为。</p><p>亲测有效。</p></blockquote><span id="more"></span><h2 id="软件资源"><a href="#软件资源" class="headerlink" title="软件资源"></a>软件资源</h2><h3 id="ADB软件资源"><a href="#ADB软件资源" class="headerlink" title="ADB软件资源"></a>ADB软件资源</h3><p>链接:<a href="https://pan.baidu.com/s/1EkmwKrR0sNI1_FpQlObBeg">https://pan.baidu.com/s/1EkmwKrR0sNI1_FpQlObBeg</a> </p><p>提取码:zcf6 </p><p>注意要设置“系统环境变量”,否则无法使用ADB 命令。</p><h3 id="华为手机驱动软件资源"><a href="#华为手机驱动软件资源" class="headerlink" title="华为手机驱动软件资源"></a>华为手机驱动软件资源</h3><p>链接:<a href="https://pan.baidu.com/s/1xjyV11HKdF-Tj0MB3DbUCQ">https://pan.baidu.com/s/1xjyV11HKdF-Tj0MB3DbUCQ</a> </p><p>提取码:j3jw </p><h3 id="参考教程:"><a href="#参考教程:" class="headerlink" title="参考教程:"></a>参考教程:</h3><p>[adb下载安装及使用]<a href="https://blog.csdn.net/weixin_43927138/article/details/90477966">https://blog.csdn.net/weixin_43927138/article/details/90477966</a> </p><p>[adb 模拟点击时间的命令]<a href="https://blog.csdn.net/stronking/article/details/100559801">https://blog.csdn.net/stronking/article/details/100559801</a> </p><h2 id="ADB启动系统命令:"><a href="#ADB启动系统命令:" class="headerlink" title="ADB启动系统命令:"></a>ADB启动系统命令:</h2><p>启动 adb server 命令:adb start-server </p><p>停止 adb server 命令:adb kill-server </p><p>查询已连接设备/模拟器:adb devices </p><h2 id="手机USB连接:"><a href="#手机USB连接:" class="headerlink" title="手机USB连接:"></a>手机USB连接:</h2><p>在手机“设置”-“关于手机”连续点击“版本号”7 次,可以进入到开发者模式;</p><p>然后可以到“设置”-“开发者选项”-“调试”里打开USB调试以及允许ADB的一些权限;</p><p>连接时手机会弹出“允许HiSuite通过HDB连接设备”点击允许/接受即可; </p><p><strong>查看是否有root权限:</strong></p><ul><li><p>输入adb shell,</p></li><li><p>输入su KaTeX parse error: Expected ‘EOF’, got ‘#’ at position 5: </p></li><li><p>如果变为#̲则成功,如果仍为则未有root权限;</p></li><li><p>恢复命令:adb unroot</p></li></ul><h2 id="ADB操作手机系统性命令:"><a href="#ADB操作手机系统性命令:" class="headerlink" title="ADB操作手机系统性命令:"></a>ADB操作手机系统性命令:</h2><p><strong>查看所有应用列表</strong>:adb shell pm list packages </p><p><strong>查看系统应用列表</strong>:adb shell pm list packages -s </p><p><strong>查看第三方应用列表</strong>:adb shell pm list packages -3: </p><p><strong>安装apk</strong>:adb install “-lrtsdg” “path_to_apk” </p><ul><li><p>```<br> “-lrtsdg”: </p><p> -l:将应用安装到保护目录 /mnt/asec; </p><p> -r:允许覆盖安装; </p><p> -t:允许安装 AndroidManifest.xml 里 application 指定 android:testOnly=“true” 的应用; </p><p> -s:将应用安装到 sdcard; </p><p> -d:允许降级覆盖安装; </p><p> -g:授予所有运行时权限; </p><p> path_to_apk:apk的绝对路径。</p> <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">**示例安装淘宝apk**:adb install -l /data/local/tmp/taobao.apk </span><br><span class="line"></span><br><span class="line">**卸载apk**:adb uninstall -k “packagename” </span><br><span class="line"></span><br><span class="line">“packagename”:表示应用的包名,以下相同; </span><br><span class="line"></span><br><span class="line">-k 参数可选,表示卸载应用但保留数据和缓存目录。 </span><br><span class="line"></span><br><span class="line">示例卸载 手机淘宝:adb uninstall com.taobao.taobao </span><br><span class="line"></span><br><span class="line">查看应用详细信息命令:adb shell dumpsys package “packagename” </span><br><span class="line"></span><br><span class="line">调起 Activity命令格式:adb shell am start [options] </span><br><span class="line"></span><br><span class="line">例如:adb shell am start -n com.tencent.mm/.ui.LauncherUI表示调起微信主界面 </span><br><span class="line"></span><br><span class="line">强制停止应用命令:adb shell am force-stop “packagename” </span><br><span class="line"></span><br><span class="line">例如强制停止淘宝:adb shell am force-stop com.taobao.taobao </span><br><span class="line"></span><br><span class="line">查看设备信息型号命令:adb shell getprop ro.product.model </span><br><span class="line"></span><br><span class="line">电池状况命令:adb shell dumpsys battery </span><br><span class="line"></span><br><span class="line">显示屏参数:adb shell dumpsys window displays </span><br><span class="line"></span><br><span class="line">android_id查看命令:adb shell settings get secure android_id </span><br><span class="line"></span><br><span class="line">查看Android 系统版本:adb shell getprop ro.build.version.release </span><br><span class="line"></span><br><span class="line">查看设备ip地址:adb shell ifconfig | grep Mask或者adb shell netcfg </span><br><span class="line"></span><br><span class="line">查看CPU 信息命令:adb shell cat /proc/cpuinfo </span><br><span class="line"></span><br><span class="line">查看内存信息命令:adb shell cat /proc/meminfo </span><br><span class="line"></span><br><span class="line">如果PC要想同时控制多台Android手机,必须在adb 后面添加-s </span><br><span class="line"></span><br><span class="line">例如:adb -s 13b6e4c4 shell input tap 400 400 </span><br><span class="line"></span><br><span class="line">表示对13b6e4c4这台Android手机进行在屏幕上(400,400)坐标位置进行模拟的点击事件。 </span><br><span class="line"></span><br><span class="line"> </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## ADB操作手机常用功能: </span><br><span class="line"></span><br><span class="line">滑动解锁:如果锁屏没有密码,是通过滑动手势解锁,那么可以通过 input swipe 来解锁。 </span><br><span class="line"></span><br><span class="line">命令:adb shell input swipe 300 1000 300 500 </span><br><span class="line"></span><br><span class="line">(其中参数 300 1000 300 500 分别表示起始点x坐标 起始点y坐标 结束点x坐标 结束点y坐标。) </span><br><span class="line"></span><br><span class="line">adb shell input swipe </span><br><span class="line"></span><br><span class="line">这条命令模拟Android手机从屏幕坐标(X1,Y1)滑动到坐标(X2,Y2)的操作 </span><br><span class="line"></span><br><span class="line">adb shell input tap </span><br><span class="line"></span><br><span class="line">这条命令模拟Android手机在屏幕坐标(X,Y)处进行了点击操作。 </span><br><span class="line"></span><br><span class="line">输入文本:在焦点处于某文本框时,可以通过 input 命令来输入文本。 </span><br><span class="line"></span><br><span class="line">命令:adb shell input text *** (***即为输入内容) </span><br><span class="line"></span><br><span class="line">屏幕分辨率命令:adb shell wm size </span><br><span class="line"></span><br><span class="line">截图保存到电脑:adb shell screencap -p /sdcard/autojump.png </span><br><span class="line"></span><br><span class="line">然后将 png 文件导出到电脑:adb pull /sdcard/autojump.png . </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## ADB操作手机不常用功能: </span><br><span class="line"></span><br><span class="line">模拟按键/输入:adb shell input keyevent keycode 不同的 keycode有不同的功能: </span><br><span class="line"></span><br><span class="line">keycode含义 </span><br><span class="line"></span><br><span class="line">3HOME 键 </span><br><span class="line"></span><br><span class="line">4返回键 </span><br><span class="line"></span><br><span class="line">5打开拨号应用 </span><br><span class="line"></span><br><span class="line">6挂断电话 </span><br><span class="line"></span><br><span class="line">26电源键 </span><br><span class="line"></span><br><span class="line">27拍照(需要在相机应用里) </span><br><span class="line"></span><br><span class="line">61Tab键 </span><br><span class="line"></span><br><span class="line">64打开浏览器 </span><br><span class="line"></span><br><span class="line">67退格键 </span><br><span class="line"></span><br><span class="line">80拍照对焦键 </span><br><span class="line"></span><br><span class="line">82菜单键 </span><br><span class="line"></span><br><span class="line">85播放/暂停 </span><br><span class="line"></span><br><span class="line">86停止播放 </span><br><span class="line"></span><br><span class="line">92向上翻页键 </span><br><span class="line"></span><br><span class="line">93向下翻页键 </span><br><span class="line"></span><br><span class="line">111ESC键 </span><br><span class="line"></span><br><span class="line">112删除键 </span><br><span class="line"></span><br><span class="line">122移动光标到行首或列表顶部 </span><br><span class="line"></span><br><span class="line">123移动光标到行末或列表底部 </span><br><span class="line"></span><br><span class="line">124插入键 </span><br><span class="line"></span><br><span class="line">164静音 </span><br><span class="line"></span><br><span class="line">176打开系统设置 </span><br><span class="line"></span><br><span class="line">207打开联系人 </span><br><span class="line"></span><br><span class="line">208打开日历 </span><br><span class="line"></span><br><span class="line">209打开音乐 </span><br><span class="line"></span><br><span class="line">220降低屏幕亮度 </span><br><span class="line"></span><br><span class="line">221提高屏幕亮度 </span><br><span class="line"></span><br><span class="line">223系统休眠 </span><br><span class="line"></span><br><span class="line">224点亮屏幕 </span><br><span class="line"></span><br><span class="line">224点亮屏幕 </span><br><span class="line"></span><br><span class="line">224点亮屏幕 </span><br><span class="line"></span><br><span class="line">231打开语音助手 </span><br><span class="line"></span><br><span class="line">276如果没有 wakelock 则让系统休眠 </span><br><span class="line"></span><br><span class="line">0 --> "KEYCODE_UNKNOWN" </span><br><span class="line"></span><br><span class="line">1 --> "KEYCODE_MENU" </span><br><span class="line"></span><br><span class="line">2 --> "KEYCODE_SOFT_RIGHT" </span><br><span class="line"></span><br><span class="line">3 --> "KEYCODE_HOME" </span><br><span class="line"></span><br><span class="line">4 --> "KEYCODE_BACK" </span><br><span class="line"></span><br><span class="line">5 --> "KEYCODE_CALL" </span><br><span class="line"></span><br><span class="line">6 --> "KEYCODE_ENDCALL" </span><br><span class="line"></span><br><span class="line">7 --> "KEYCODE_0" </span><br><span class="line"></span><br><span class="line">8 --> "KEYCODE_1" </span><br><span class="line"></span><br><span class="line">9 --> "KEYCODE_2" </span><br><span class="line"></span><br><span class="line">10 --> "KEYCODE_3" </span><br><span class="line"></span><br><span class="line">11 --> "KEYCODE_4" </span><br><span class="line"></span><br><span class="line">12 --> "KEYCODE_5" </span><br><span class="line"></span><br><span class="line">13 --> "KEYCODE_6" </span><br><span class="line"></span><br><span class="line">14 --> "KEYCODE_7" </span><br><span class="line"></span><br><span class="line">15 --> "KEYCODE_8" </span><br><span class="line"></span><br><span class="line">16 --> "KEYCODE_9" </span><br><span class="line"></span><br><span class="line">17 --> "KEYCODE_STAR" </span><br><span class="line"></span><br><span class="line">18 --> "KEYCODE_POUND" </span><br><span class="line"></span><br><span class="line">19 --> "KEYCODE_DPAD_UP" </span><br><span class="line"></span><br><span class="line">20 --> "KEYCODE_DPAD_DOWN" </span><br><span class="line"></span><br><span class="line">21 --> "KEYCODE_DPAD_LEFT" </span><br><span class="line"></span><br><span class="line">22 --> "KEYCODE_DPAD_RIGHT" </span><br><span class="line"></span><br><span class="line">23 --> "KEYCODE_DPAD_CENTER" </span><br><span class="line"></span><br><span class="line">24 --> "KEYCODE_VOLUME_UP" </span><br><span class="line"></span><br><span class="line">25 --> "KEYCODE_VOLUME_DOWN" </span><br><span class="line"></span><br><span class="line">26 --> "KEYCODE_POWER" </span><br><span class="line"></span><br><span class="line">27 --> "KEYCODE_CAMERA" </span><br><span class="line"></span><br><span class="line">28 --> "KEYCODE_CLEAR" </span><br><span class="line"></span><br><span class="line">29 --> "KEYCODE_A" </span><br><span class="line"></span><br><span class="line">30 --> "KEYCODE_B" </span><br><span class="line"></span><br><span class="line">31 --> "KEYCODE_C" </span><br><span class="line"></span><br><span class="line">32 --> "KEYCODE_D" </span><br><span class="line"></span><br><span class="line">33 --> "KEYCODE_E" </span><br><span class="line"></span><br><span class="line">34 --> "KEYCODE_F" </span><br><span class="line"></span><br><span class="line">35 --> "KEYCODE_G" </span><br><span class="line"></span><br><span class="line">36 --> "KEYCODE_H" </span><br><span class="line"></span><br><span class="line">37 --> "KEYCODE_I" </span><br><span class="line"></span><br><span class="line">38 --> "KEYCODE_J" </span><br><span class="line"></span><br><span class="line">39 --> "KEYCODE_K" </span><br><span class="line"></span><br><span class="line">40 --> "KEYCODE_L" </span><br><span class="line"></span><br><span class="line">41 --> "KEYCODE_M" </span><br><span class="line"></span><br><span class="line">42 --> "KEYCODE_N" </span><br><span class="line"></span><br><span class="line">43 --> "KEYCODE_O" </span><br><span class="line"></span><br><span class="line">44 --> "KEYCODE_P" </span><br><span class="line"></span><br><span class="line">45 --> "KEYCODE_Q" </span><br><span class="line"></span><br><span class="line">46 --> "KEYCODE_R" </span><br><span class="line"></span><br><span class="line">47 --> "KEYCODE_S" </span><br><span class="line"></span><br><span class="line">48 --> "KEYCODE_T" </span><br><span class="line"></span><br><span class="line">49 --> "KEYCODE_U" </span><br><span class="line"></span><br><span class="line">50 --> "KEYCODE_V" </span><br><span class="line"></span><br><span class="line">51 --> "KEYCODE_W" </span><br><span class="line"></span><br><span class="line">52 --> "KEYCODE_X" </span><br><span class="line"></span><br><span class="line">53 --> "KEYCODE_Y" </span><br><span class="line"></span><br><span class="line">54 --> "KEYCODE_Z" </span><br><span class="line"></span><br><span class="line">55 --> "KEYCODE_COMMA" </span><br><span class="line"></span><br><span class="line">56 --> "KEYCODE_PERIOD" </span><br><span class="line"></span><br><span class="line">57 --> "KEYCODE_ALT_LEFT" </span><br><span class="line"></span><br><span class="line">58 --> "KEYCODE_ALT_RIGHT" </span><br><span class="line"></span><br><span class="line">59 --> "KEYCODE_SHIFT_LEFT" </span><br><span class="line"></span><br><span class="line">60 --> "KEYCODE_SHIFT_RIGHT" </span><br><span class="line"></span><br><span class="line">61 --> "KEYCODE_TAB" </span><br><span class="line"></span><br><span class="line">62 --> "KEYCODE_SPACE" </span><br><span class="line"></span><br><span class="line">63 --> "KEYCODE_SYM" </span><br><span class="line"></span><br><span class="line">64 --> "KEYCODE_EXPLORER" </span><br><span class="line"></span><br><span class="line">65 --> "KEYCODE_ENVELOPE" </span><br><span class="line"></span><br><span class="line">66 --> "KEYCODE_ENTER" </span><br><span class="line"></span><br><span class="line">67 --> "KEYCODE_DEL" </span><br><span class="line"></span><br><span class="line">68 --> "KEYCODE_GRAVE" </span><br><span class="line"></span><br><span class="line">69 --> "KEYCODE_MINUS" </span><br><span class="line"></span><br><span class="line">70 --> "KEYCODE_EQUALS" </span><br><span class="line"></span><br><span class="line">71 --> "KEYCODE_LEFT_BRACKET" </span><br><span class="line"></span><br><span class="line">72 --> "KEYCODE_RIGHT_BRACKET" </span><br><span class="line"></span><br><span class="line">73 --> "KEYCODE_BACKSLASH" </span><br><span class="line"></span><br><span class="line">74 --> "KEYCODE_SEMICOLON" </span><br><span class="line"></span><br><span class="line">75 --> "KEYCODE_APOSTROPHE" </span><br><span class="line"></span><br><span class="line">76 --> "KEYCODE_SLASH" </span><br><span class="line"></span><br><span class="line">77 --> "KEYCODE_AT" </span><br><span class="line"></span><br><span class="line">78 --> "KEYCODE_NUM" </span><br><span class="line"></span><br><span class="line">79 --> "KEYCODE_HEADSETHOOK" </span><br><span class="line"></span><br><span class="line">80 --> "KEYCODE_FOCUS" </span><br><span class="line"></span><br><span class="line">81 --> "KEYCODE_PLUS" </span><br><span class="line"></span><br><span class="line">82 --> "KEYCODE_MENU" </span><br><span class="line"></span><br><span class="line">83 --> "KEYCODE_NOTIFICATION" </span><br><span class="line"></span><br><span class="line">84 --> "KEYCODE_SEARCH" </span><br><span class="line"></span><br><span class="line">85 --> "TAG_LAST_KEYCODE" </span><br><span class="line"></span><br><span class="line">录制屏幕:adb shell screenrecord /sdcard/filename.mp4 </span><br><span class="line"></span><br><span class="line">录制屏幕以 mp4 格式保存到 /sdcard,需要停止时按 Ctrl-C,默认录制时间和最长录制时间都是 180 秒。 </span><br><span class="line"></span><br><span class="line">如果需要导出到电脑:adb pull /sdcard/filename.mp4 . </span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 使用python脚本自动运行cmd 命令 </span><br><span class="line"></span><br><span class="line">**在adb文件夹下建立一个python文件** </span><br><span class="line"></span><br><span class="line">```python3 </span><br><span class="line">#运行脚本,发现与在命令行输入相同语句有同样的效果。 </span><br><span class="line">import os </span><br><span class="line">os.system('adb shell input tap 100 100'); </span><br></pre></td></tr></table></figure></li></ul><p><strong>可以使用subprocess.Popen,最简单使用方式如下,设置shell=True,就不会弹出cmd框</strong> </p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">process = subprocess.Popen('adb shell input tap 14 1402',shell=True) </span><br></pre></td></tr></table></figure>]]></content>
<categories>
<category> 软件 </category>
</categories>
<tags>
<tag> 工具 </tag>
</tags>
</entry>
</search>