-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal-search.xml
2207 lines (1061 loc) · 526 KB
/
local-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
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>GitHub page 备份到 cloudflare page</title>
<link href="/2024/10/06/GitHub%20page%20%E5%A4%87%E4%BB%BD%E5%88%B0%20cloudflare%20page/"/>
<url>/2024/10/06/GitHub%20page%20%E5%A4%87%E4%BB%BD%E5%88%B0%20cloudflare%20page/</url>
<content type="html"><![CDATA[<p>cloudflare page 只需要连接 github的仓库就可以了,不需要配置任何密匙,并且可以绑定自己的域名</p><p>zeroandone.pages.dev</p><p>pl.zeroandone.eu.org</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>GitHub page</tag>
<tag>cloudflare page</tag>
</tags>
</entry>
<entry>
<title>adb连接TCL75Q10GPro</title>
<link href="/2024/09/16/adb%E8%BF%9E%E6%8E%A5TCL75Q10GPro/"/>
<url>/2024/09/16/adb%E8%BF%9E%E6%8E%A5TCL75Q10GPro/</url>
<content type="html"><![CDATA[<h2 id="前言">前言</h2><p>苦于无法在电视上设置网络的网关,所以采用迂回的办法:通过adb修改电视的http代理设置。</p><h2 id="电视上打开adb">电视上打开adb</h2><pre><code class=" mermaid">graph LR A[设置] --> B[关于] --> C[本机信息] --> D[依次按遥控器上下左右键]</code></pre><p>然后就可以看到adb的选项,打开即可</p><h2 id="在电脑上通过adb连接">在电脑上通过adb连接</h2><p>安装adb自行百度,在同一局域网下 <figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-attribute">adb</span> connect 电视ip:<span class="hljs-number">5555</span><br></code></pre></td></tr></table></figure>电视上会跳出权限对话框,选择一律允许连接即可连接成功</p><p>添加proxy的命令:</p><figure class="highlight livecodeserver"><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><code class="hljs livecodeserver"><span class="hljs-comment">#To Add Proxy</span><br>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_in">put</span> <span class="hljs-built_in">global</span> http_proxy <span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.120</span>:<span class="hljs-number">10809</span><br><br><span class="hljs-comment">#To Remove Proxy</span><br>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_in">put</span> <span class="hljs-built_in">global</span> http_proxy :<span class="hljs-number">0</span><br></code></pre></td></tr></table></figure><p>修改为自己dns的命令 <figure class="highlight livecodeserver"><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><code class="hljs livecodeserver"><span class="hljs-comment">#设置私有dns模式为hostname模式</span><br>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_in">put</span> <span class="hljs-built_in">global</span> private_dns_mode hostname<br><span class="hljs-comment">#设置hostname的dot地址,注意必须是域名,ip地址无效</span><br>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_in">put</span> <span class="hljs-built_in">global</span> private_dns_specifier yourid.nextdns.io<br><span class="hljs-comment">#关闭私有dns</span><br>adb <span class="hljs-built_in">shell</span> settings <span class="hljs-built_in">put</span> <span class="hljs-built_in">global</span> private_dns_mode off<br></code></pre></td></tr></table></figure> ## 后记openwrt的ssrplus只能提供socks代理,并不提供http代理,而adb好像只能设置http代理,所以需要将op的socks代理转为http代理。</p><p>利用<code>privoxy</code>实现,具体参考<ahref="https://blog.csdn.net/u011005745/article/details/132383080">使用Privoxy为Openwrt的ssrplus开启http代理服务器_openwrt代理服务器-CSDN博客</a>,如果不能安装privoxy的话,可以先更换一下opkg的源再安装就没问题了。</p><h2 id="系统更新后有惊喜">系统更新后有惊喜</h2><p>9月份系统更新版本v8-t653t11-lf1v320.002164后,国庆节期间偶然发现wifi里面可以手动设置ip地址、dns服务器和<strong>网关</strong>了!!!!</p><p>留坑待填:如何禁止系统更新或者寻找该系统的固件备用(t653t11代表机器芯片型号)</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>openwrt</tag>
<tag>adb</tag>
</tags>
</entry>
<entry>
<title>自动部署Hexo</title>
<link href="/2024/08/01/%E8%87%AA%E5%8A%A8%E9%83%A8%E7%BD%B2Hexo/"/>
<url>/2024/08/01/%E8%87%AA%E5%8A%A8%E9%83%A8%E7%BD%B2Hexo/</url>
<content type="html"><![CDATA[<h2 id="创建两个github仓库">创建两个Github仓库</h2><p>在 Github 网站建立两个仓库,名称任意。其中一个仓库用于存放 Blog文件的源码(以下称<strong>仓库A</strong>),另一个用于存放生成以后的静态内容,即<code>public</code> 目录下的内容(以下称 <strong>仓库B</strong>)。</p><p><a href="https://hui-shao.com/hexo-github-action-vervel/">使用 GithubAction + Vercel 为 Hexo 的 Pandoc 渲染器提供支持 | Hui-Shao'sBlog</a></p><h2id="创建个人访问令牌personal-access-token">创建个人访问令牌(PersonalAccess Token)</h2><p>因为我们需要在 <strong>Hexo 项目仓库A</strong> 执行 <strong>GithubActions</strong> 向 <strong>username.github.io仓库B</strong>推送代码,由于 Github 权限限制,我们需要在 GitHub账户中创建一个具有足够权限的<strong>个人访问令牌(Personal AccessToken,简称 PAT)</strong>。这个令牌需要有足够的权限来修改仓库。然后在secrects 里面添加 PERSONAL_TOKEN</p><p><ahref="https://hackergavin.com/2024/01/11/hexo-automate-deploy/">利用GitHub Actions 实现自动化部署 Hexo 到 Github Pages(hackergavin.com)</a></p><h2 id="创建-github-actions-脚本">创建 Github Actions 脚本</h2><ol type="1"><li>在你的 Hexo 项目仓库A根目录下创建一个<strong>.github/workflows</strong> 文件夹(如果尚未存在)。</li><li>在该文件夹内创建一个新的 <strong>YAML</strong> 文件(例如hexo-deploy.yml),用于定义 <strong>GitHub Actions</strong>工作流。</li><li>复制如下配置到 <strong>YAML</strong> 文件</li></ol><figure class="highlight yaml"><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></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-attr">name:</span> <span class="hljs-string">Deploy</span> <span class="hljs-string">Hexo</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span><br><br><span class="hljs-attr">on:</span><br> <span class="hljs-attr">push:</span><br> <span class="hljs-attr">branches:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">master</span> <span class="hljs-comment"># 或你使用的默认分支名称</span><br><br><span class="hljs-attr">jobs:</span><br> <span class="hljs-attr">deploy:</span><br> <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span><br><br> <span class="hljs-attr">steps:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Checkout</span> <span class="hljs-string">blog</span> <span class="hljs-string">source</span><br> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v2</span><br> <span class="hljs-attr">with:</span><br> <span class="hljs-attr">path:</span> <span class="hljs-string">blog</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Set</span> <span class="hljs-string">up</span> <span class="hljs-string">Node.js</span><br> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/setup-node@v1</span><br> <span class="hljs-attr">with:</span><br> <span class="hljs-attr">node-version:</span> <span class="hljs-string">"16"</span> <span class="hljs-comment"># 设置 Node.js 版本</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Cache</span> <span class="hljs-string">dependencies</span><br> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/cache@v2</span><br> <span class="hljs-attr">with:</span><br> <span class="hljs-attr">path:</span> <span class="hljs-string">node_modules</span><br> <span class="hljs-attr">key:</span> <span class="hljs-string">${{</span> <span class="hljs-string">runner.os</span> <span class="hljs-string">}}-node-${{</span> <span class="hljs-string">hashFiles('**/package-lock.json')</span> <span class="hljs-string">}}</span><br> <span class="hljs-attr">restore-keys:</span> <span class="hljs-string">|</span><br> <span class="hljs-string">${{</span> <span class="hljs-string">runner.os</span> <span class="hljs-string">}}-node-</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Install</span> <span class="hljs-string">dependencies</span><br> <span class="hljs-attr">run:</span> <span class="hljs-string">npm</span> <span class="hljs-string">install</span><br> <span class="hljs-attr">working-directory:</span> <span class="hljs-string">./blog</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Install</span> <span class="hljs-string">Hexo</span> <span class="hljs-string">CLI</span><br> <span class="hljs-attr">run:</span> <span class="hljs-string">npm</span> <span class="hljs-string">install</span> <span class="hljs-string">-g</span> <span class="hljs-string">hexo-cli</span><br> <span class="hljs-attr">working-directory:</span> <span class="hljs-string">./blog</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Setup</span> <span class="hljs-string">pandoc</span><br> <span class="hljs-attr">uses:</span> <span class="hljs-string">nikeee/setup-pandoc@v1</span> <span class="hljs-comment"># 可选项,如果是用pandoc渲染的话,需要安装这个</span><br> <br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Generate</span> <span class="hljs-string">static</span> <span class="hljs-string">pages</span><br> <span class="hljs-attr">run:</span> <span class="hljs-string">hexo</span> <span class="hljs-string">generate</span><br> <span class="hljs-attr">working-directory:</span> <span class="hljs-string">./blog</span><br><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Deploy</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span><br> <span class="hljs-attr">uses:</span> <span class="hljs-string">peaceiris/actions-gh-pages@v3</span><br> <span class="hljs-attr">with:</span><br> <span class="hljs-attr">personal_token:</span> <span class="hljs-string">${{</span> <span class="hljs-string">secrets.PERSONAL_TOKEN</span> <span class="hljs-string">}}</span><br> <span class="hljs-attr">publish_dir:</span> <span class="hljs-string">./blog/public</span><br> <span class="hljs-attr">external_repository:</span> <span class="hljs-string">andyppang/andyppang.github.io</span> <span class="hljs-comment"># 更改为你的 GitHub Pages 仓库</span><br> <span class="hljs-attr">publish_branch:</span> <span class="hljs-string">master</span> <span class="hljs-comment"># GitHub Pages 分支</span><br><br></code></pre></td></tr></table></figure><h2 id="大功告成">大功告成</h2><ol type="1"><li><p>提交本地的 Hexo 项目代码到对应 Github 仓库即可触发 <strong>GithubActions</strong> 工作流实现自动部署,然后访问你的<strong>username.github.io</strong> !</p></li><li><p>或者直接在github仓库A的source/_posts文件夹下添加文件,开始写博客,写完就会自动部署到仓库B</p></li></ol>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>hexo</tag>
<tag>github actions</tag>
</tags>
</entry>
<entry>
<title>Github actions 测试发送</title>
<link href="/2024/08/01/Github%20actions%20%E6%B5%8B%E8%AF%95%E5%8F%91%E9%80%81/"/>
<url>/2024/08/01/Github%20actions%20%E6%B5%8B%E8%AF%95%E5%8F%91%E9%80%81/</url>
<content type="html"><![CDATA[<h1 id="测试文">测试文</h1><h2 id="测试文-1">测试文</h2><h3 id="测试文-2">测试文</h3>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>github actions</tag>
</tags>
</entry>
<entry>
<title>截图识别数学公式为latex代码</title>
<link href="/2023/05/29/%E6%88%AA%E5%9B%BE%E8%AF%86%E5%88%AB%E6%95%B0%E5%AD%A6%E5%85%AC%E5%BC%8F%E4%B8%BAlatex%E4%BB%A3%E7%A0%81/"/>
<url>/2023/05/29/%E6%88%AA%E5%9B%BE%E8%AF%86%E5%88%AB%E6%95%B0%E5%AD%A6%E5%85%AC%E5%BC%8F%E4%B8%BAlatex%E4%BB%A3%E7%A0%81/</url>
<content type="html"><![CDATA[<h2 id="实现的几种途径">实现的几种途径</h2><ul><li><p>商用的最有名的Mathpix</p></li><li><p>免费的:https://simpletex.cn</p></li><li><p>开源的两个项目:</p><p><ahref="https://github.com/lukas-blecher/LaTeX-OCR">lukas-blecher/LaTeX-OCR:pix2tex: Using a ViT to convert images of equations into LaTeX code.(github.com)</a></p><p><a href="https://github.com/breezedeus/Pix2Text">breezedeus/Pix2Text:Pix In, Latex & Text Out. Recognize Chinese, English Texts, and MathFormulas from Images. (github.com)</a></p></li></ul><p>本文主要介绍开源的两个项目的安装使用</p><h2 id="latex-ocrpix2tex">LaTex-OCR:pix2tex</h2><p>该项目的目标是创建一个基于学习的系统,它可以接收一张数学公式的图片,并返回相应的LaTeX代码。</p><ol type="1"><li><p><strong>系统已经安装Python3.7+</strong></p></li><li><p>国内网络环境建议更换pip源</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">pip install -i https:<span class="hljs-regexp">//</span>pypi.tuna.tsinghua.edu.cn/simple pip --trusted-host<br></code></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></pre></td><td class="code"><pre><code class="hljs shell">pip install pix2tex[gui]<br></code></pre></td></tr></table></figure></li><li><p>在终端输入命令<code>latexocr</code>就会调用应用程序,对公式截图即可自动转换并且自动复制latex代码,其中界面当中的参数<code>Temperature</code>调整是公式识别的精度</p></li></ol><p>安装过程中如果出现各种错误,善用各种搜索引擎和各种AI,感觉可以和chatgpt媲美的Perplexity.ai</p><p>自己安装过程中总是提示找不到PyQt的各种包,也许有用的一个命令</p><figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-attribute">pip</span> install PyQt<span class="hljs-number">6</span>-WebEngine==<span class="hljs-number">6</span>.<span class="hljs-number">5</span>.<span class="hljs-number">0</span><br></code></pre></td></tr></table></figure><p>还有调用api的用法,请参看项目主页</p><h2 id="pix2text">pix2text</h2><p>从名字来看,这是pix2tex项目的加强版,pix2tex只能识别数学公式,而pix2text希望能识别文字和公式混合的场景,从使用的效果来看,还有很大的进步空间</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">pip install pix2text -i https:<span class="hljs-regexp">//</span>pypi.doubanio.com/simple<br></code></pre></td></tr></table></figure><p>如果电脑中从未安装过 <code>PyTorch</code>,<code>OpenCV</code>python包,初次安装可能会遇到不少问题,善用各种搜索引擎和AI</p><p>各种使用方式看项目主页即可,我使用的是本机<ahref="https://github.com/breezedeus/Pix2Text#%E8%84%9A%E6%9C%AC%E8%BF%90%E8%A1%8C">脚本运行</a></p>]]></content>
<categories>
<category>数学</category>
</categories>
<tags>
<tag>latex-ocr</tag>
</tags>
</entry>
<entry>
<title>手动搭建chatgpt-mirai-qqbot对接AI和聊天软件</title>
<link href="/2023/05/25/%E6%89%8B%E5%8A%A8%E6%90%AD%E5%BB%BAchatgpt-mirai-qqbot%E5%AF%B9%E6%8E%A5AI%E5%92%8C%E8%81%8A%E5%A4%A9%E8%BD%AF%E4%BB%B6/"/>
<url>/2023/05/25/%E6%89%8B%E5%8A%A8%E6%90%AD%E5%BB%BAchatgpt-mirai-qqbot%E5%AF%B9%E6%8E%A5AI%E5%92%8C%E8%81%8A%E5%A4%A9%E8%BD%AF%E4%BB%B6/</url>
<content type="html"><![CDATA[<h2 id="说明">说明</h2><p>前面用docker-compose一键搭建过,为了方便调试各种错误,这次手动一步步搭建,也顺便学习一些新东西。</p><h2 id="准备工作">准备工作</h2><ul><li><p>两个qq账号</p></li><li><p>一个微信账号</p></li><li><p>一个tg账号:<ahref="https://www.dengnz.com/2020/11/23/telegram-%E6%9C%BA%E5%99%A8%E4%BA%BA%E7%9A%84%E7%94%B3%E8%AF%B7%E5%92%8C%E8%AE%BE%E7%BD%AE%E5%9B%BE%E6%96%87%E6%95%99%E7%A8%8B/">新建bot获取token</a>,<ahref="https://cloud.tencent.com/developer/article/1948136">获取chatid</a></p></li><li><p>一个chatgpt账号<ahref="https://chatgpt-qq.lss233.com/pei-zhi-wen-jian-jiao-cheng/jie-ru-ai-ping-tai/jie-ru-openai-de-chatgpt">获取accesstoken</a></p></li><li><p>一个bing账号<ahref="https://chatgpt-qq.lss233.com/pei-zhi-wen-jian-jiao-cheng/jie-ru-ai-ping-tai/jie-ru-new-bing-sydney">获取cookie</a></p></li><li><p>一个Google bard账户<ahref="https://chatgpt-qq.lss233.com/pei-zhi-wen-jian-jiao-cheng/jie-ru-ai-ping-tai/jie-ru-google-bard">获取cookie</a></p></li><li><p>国内和国外vps各一台(国外vps负责接入AI,国内vps负责挂qq和微信)</p></li><li><p>国外vps安装Python3.11及以上版本(chatgpt-mirai-qqbot需要的要求)</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><code class="hljs shell"><span class="hljs-meta">#</span><span class="bash"> 以下是Debian10或11安装Python3.11的命令</span><br><br>sudo apt update && sudo apt upgrade<br><br>sudo apt install wget build-essential libncursesw5-dev libssl-dev \<br> libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev<br> <br>wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tgz<br><br>tar xzf Python-3.11.3.tgz<br><br>cd Python-3.11.3<br><br>./configure --enable-optimizations<br><br>make altinstall<br><br>python3.11 -V<br><span class="hljs-meta">#</span><span class="bash"> 如果系统有多个版本的python,注意看默认使用的版本是不是3.11</span><br></code></pre></td></tr></table></figure></li></ul><h2 id="项目地址">项目地址</h2><ul><li><ahref="https://github.com/lss233/chatgpt-mirai-qq-bot">lss233/chatgpt-mirai-qq-bot:🚀 一键部署!真正的 AI聊天机器人!支持ChatGPT、文心一言、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送| 支持 QQ、Telegram、Discord、微信 等平台 (github.com)</a></li><li><a href="https://github.com/Mrs4s/go-cqhttp">Mrs4s/go-cqhttp:cqhttp的golang实现,轻量、原生跨平台. (github.com)</a></li><li><a href="https://github.com/lcjqyml/wechatbot">lcjqyml/wechatbot: Achatbot for wechat. (github.com)</a></li></ul><h2 id="搭建项目本体">搭建项目本体</h2><p>在国外vps上:</p><figure class="highlight awk"><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><code class="hljs awk">git clone https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/lss233/</span>chatgpt-mirai-qq-bot<br>cd chatgpt-mirai-qq-bot<br>pip3 install -r requirements.txt<br></code></pre></td></tr></table></figure><h2 id="接入各种ai">接入各种AI</h2><p>调整配置文件config.cfg,没有就自己创建,如果不需要接入那么多的ai和聊天软件就注释或删除</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><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><code class="hljs python">[onebot]<br>qq=小号qq<br>manager_qq=管理员qq<br><span class="hljs-comment"># 此处保持默认设置,无需修改</span><br>reverse_ws_host = <span class="hljs-string">"0.0.0.0"</span><br>reverse_ws_port = <span class="hljs-number">8554</span><br><br>[telegram]<br><span class="hljs-comment"># 这个 token 是找 BotFather 要的</span><br>bot_token = <span class="hljs-string">""</span><br><span class="hljs-comment"># 如果部署在国内,就填这个设置代理</span><br><span class="hljs-comment"># 不填的话就会读取系统的代理设置</span><br><span class="hljs-comment"># proxy = "http://localhost:1080"</span><br><span class="hljs-comment"># 管理员的 chat id</span><br>manager_chat = <br><br>[openai]<br>[[openai.accounts]]<br>access_token = <span class="hljs-string">"换成自己的"</span><br><br>[bing]<br><span class="hljs-comment"># 开启 Bing 画图功能</span><br>use_drawing = true<br>[[bing.accounts]]<br>cookie_content = <span class="hljs-string">'换成自己的'</span><br><br><span class="hljs-comment">#[poe]</span><br><span class="hljs-comment">#[[poe.accounts]]</span><br><span class="hljs-comment"># 登陆 poe.com 网站后,通过开发者工具查看Cookie获取</span><br><span class="hljs-comment">#p_b = "这个秒封,不建议接入"</span><br><br>[bard]<br>[[bard.accounts]]<br>cookie_content = <span class="hljs-string">'换成自己的'</span><br><br>[http]<br>host = <span class="hljs-string">"0.0.0.0"</span><br><span class="hljs-comment"># 填写提供服务的端口,此端口用来接入微信</span><br>port = <span class="hljs-number">8234</span><br><span class="hljs-comment"># 是否开启调试</span><br>debug = false<br><br></code></pre></td></tr></table></figure><h2 id="接入聊天软件">接入聊天软件</h2><p>在国内vps上</p><h3id="安装go-cqhttp接入qq最困难的一步先看再动">安装go-cqhttp接入qq(最困难的一步,先看再动)</h3><ol type="1"><li><p><ahref="https://github.com/Mrs4s/go-cqhttp/releases">下载</a>最新版适合自己vps的软件包</p></li><li><p>解压包 <code>tar -xzvf [文件名]</code></p></li><li><p>cd 进入解压目录</p></li><li><p>输入 <code>./go-cqhttp</code>回车运行,选择3反向WebSocket,生成配置文件</p></li><li><p>按下述样例修改配置:最简配置可只关注account和servers两项</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><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br></pre></td><td class="code"><pre><code class="hljs shell"><span class="hljs-meta">#</span><span class="bash"> go-cqhttp 默认配置文件</span><br><br>account: # 账号相关<br> uin: # QQ账号<br> password: '' # 密码为空时使用扫码登录,如果device.json里面的protocol选择的是2也就是watch在线,就留空扫码登录,需要手机端qq和vps在同一ip才能扫码<br> encrypt: false # 是否开启密码加密<br> status: 17 # 在线状态(任意都行) 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态<br> relogin: # 重连设置<br> delay: 3 # 首次重连延迟, 单位秒<br> interval: 3 # 重连间隔<br> max-times: 0 # 最大重连次数, 0为无限制<br><br><span class="hljs-meta"> #</span><span class="bash"> 是否使用服务器下发的新地址进行重连</span><br><span class="hljs-meta"> #</span><span class="bash"> 注意, 此设置可能导致在海外服务器上连接情况更差</span><br> use-sso-address: true<br><span class="hljs-meta"> #</span><span class="bash"> 是否允许发送临时会话消息</span><br> allow-temp-session: false<br><br>heartbeat:<br><span class="hljs-meta"> #</span><span class="bash"> 心跳频率, 单位秒</span><br><span class="hljs-meta"> #</span><span class="bash"> -1 为关闭心跳</span><br> interval: 5<br><br>message:<br><span class="hljs-meta"> #</span><span class="bash"> 上报数据类型</span><br><span class="hljs-meta"> #</span><span class="bash"> 可选: string,array</span><br> post-format: string<br><span class="hljs-meta"> #</span><span class="bash"> 是否忽略无效的CQ码, 如果为假将原样发送</span><br> ignore-invalid-cqcode: false<br><span class="hljs-meta"> #</span><span class="bash"> 是否强制分片发送消息</span><br><span class="hljs-meta"> #</span><span class="bash"> 分片发送将会带来更快的速度</span><br><span class="hljs-meta"> #</span><span class="bash"> 但是兼容性会有些问题</span><br> force-fragment: false<br><span class="hljs-meta"> #</span><span class="bash"> 是否将url分片发送</span><br> fix-url: false<br><span class="hljs-meta"> #</span><span class="bash"> 下载图片等请求网络代理</span><br> proxy-rewrite: ''<br><span class="hljs-meta"> #</span><span class="bash"> 是否上报自身消息</span><br> report-self-message: false<br><span class="hljs-meta"> #</span><span class="bash"> 移除服务端的Reply附带的At</span><br> remove-reply-at: false<br><span class="hljs-meta"> #</span><span class="bash"> 为Reply附加更多信息</span><br> extra-reply-data: false<br><span class="hljs-meta"> #</span><span class="bash"> 跳过 Mime 扫描, 忽略错误数据</span><br> skip-mime-scan: false<br><span class="hljs-meta"> #</span><span class="bash"> 是否自动转换 WebP 图片</span><br> convert-webp-image: false<br><br>output:<br><span class="hljs-meta"> #</span><span class="bash"> 日志等级 trace,debug,info,warn,error</span><br> log-level: warn<br><span class="hljs-meta"> #</span><span class="bash"> 日志时效 单位天. 超过这个时间之前的日志将会被自动删除. 设置为 0 表示永久保留.</span><br> log-aging: 15<br><span class="hljs-meta"> #</span><span class="bash"> 是否在每次启动时强制创建全新的文件储存日志. 为 <span class="hljs-literal">false</span> 的情况下将会在上次启动时创建的日志文件续写</span><br> log-force-new: true<br><span class="hljs-meta"> #</span><span class="bash"> 是否启用日志颜色</span><br> log-colorful: true<br><span class="hljs-meta"> #</span><span class="bash"> 是否启用 DEBUG</span><br> debug: false # 开启调试模式<br><br><span class="hljs-meta">#</span><span class="bash"> 默认中间件锚点</span><br>default-middlewares: &default<br><span class="hljs-meta"> #</span><span class="bash"> 访问密钥, 强烈推荐在公网的服务器设置</span><br> access-token: ''<br><span class="hljs-meta"> #</span><span class="bash"> 事件过滤器文件目录</span><br> filter: ''<br><span class="hljs-meta"> #</span><span class="bash"> API限速设置</span><br><span class="hljs-meta"> #</span><span class="bash"> 该设置为全局生效</span><br><span class="hljs-meta"> #</span><span class="bash"> 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配</span><br><span class="hljs-meta"> #</span><span class="bash"> 目前该限速设置为令牌桶算法, 请参考:</span><br><span class="hljs-meta"> #</span><span class="bash"> https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin</span><br> rate-limit:<br> enabled: false # 是否启用限速<br> frequency: 1 # 令牌回复频率, 单位秒<br> bucket: 1 # 令牌桶大小<br><br>database: # 数据库相关设置<br> leveldb:<br> # 是否启用内置leveldb数据库<br> # 启用将会增加10-20MB的内存占用和一定的磁盘空间<br> # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能<br> enable: true<br> sqlite3:<br> # 是否启用内置sqlite3数据库<br> # 启用将会增加一定的内存占用和一定的磁盘空间<br> # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能<br> enable: false<br> cachettl: 3600000000000 # 1h<br><br><span class="hljs-meta">#</span><span class="bash"> 连接服务列表</span><br>servers:<br><span class="hljs-meta"> #</span><span class="bash"> 添加方式,同一连接方式可添加多个,具体配置说明请查看文档</span><br><span class="hljs-meta"> #</span><span class="bash">- http: <span class="hljs-comment"># http 通信</span></span><br><span class="hljs-meta"> #</span><span class="bash">- ws: <span class="hljs-comment"># 正向 Websocket</span></span><br><span class="hljs-meta"> #</span><span class="bash">- ws-reverse: <span class="hljs-comment"># 反向 Websocket</span></span><br><span class="hljs-meta"> #</span><span class="bash">- pprof: <span class="hljs-comment">#性能分析服务器</span></span><br><span class="hljs-meta"> #</span><span class="bash"> 反向WS设置</span><br> - ws-reverse:<br> # 反向WS Universal 地址<br> # 注意 设置了此项地址后下面两项将会被忽略<br> universal: ws://国外vps的ip:8554/ws<br> # # 反向WS API 地址<br> # api: ws://your_websocket_api.server<br> # # 反向WS Event 地址<br> # event: ws://your_websocket_event.server<br> # # 重连间隔 单位毫秒<br> # reconnect-interval: 3000<br> # middlewares:<br> # <<: *default # 引用默认中间件<br></code></pre></td></tr></table></figure></li><li><p>再次运行 <code>./go-cqhttp</code> 生成随机设备信息<ahref="https://docs.go-cqhttp.org/guide/config.html#%E8%AE%BE%E5%A4%87%E4%BF%A1%E6%81%AF">device.json</a></p></li><li><p>根据需要修改device.json中的protocol为2</p></li><li><p>再次运行 <code>./go-cqhttp</code>,如果你没有配置qq密码就会让你扫码登录,这就要求你的手机qq登录时用的是国外vps的地址,两者必须在同一ip下才能扫码登录成功。<strong>解决这个问题,可以是在本地电脑端下载对应版本的go-cqhttp,按照上述配置成功扫码登录以后,将本地的config.yml和device.json以及session.token上传到vps,然后vps就可以直接登录qq了,目前来看这样操作比较稳当。</strong></p></li><li><p><ahref="https://docs.go-cqhttp.org/guide/config.html#%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF">项目的配置说明</a>,如果遇到问题多看项目issue或提问</p></li><li><p>登录成功以后,有概率碰到qq号被冻结的情况,申诉可解封</p></li></ol><h3 id="接入微信">接入微信</h3><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs routeros">docker <span class="hljs-builtin-name">run</span> -e <span class="hljs-attribute">CHATBOT_PROXY</span>=<span class="hljs-string">"http://国外vps的ip:8234"</span> lcjqyml/wechatbot:latest<br></code></pre></td></tr></table></figure><p>端口是安装chatgpt-mirai-qqbot时设置的 <code>config.cfg</code>里面的http项的端口</p><p>启动后扫码登陆即可:</p><ul><li><strong>扫码的微信号需要进过实名认证,否则会异常。</strong></li><li>尽量避免国外登陆或者异地登陆,防止封号。</li><li>若二维码不清晰,可将二维码上方的链接copy至浏览器打开扫码,或者将二维码复制粘贴到记事本,或者更换终端连接器都可能解决(本人开始使用的是finalshell二维码整个变形了)</li></ul><h2 id="启动主程序">启动主程序</h2><p>国外vps</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><code class="hljs shell">cd chatgpt-mirai-qq-bot<br>python3 bot.py<br></code></pre></td></tr></table></figure><p>注意看报错信息,再去检查各项设置,如果顺利享受各种聊天软件与各种AI的对话吧。</p><h2 id="常用聊天指令">常用聊天指令</h2><figure class="highlight mipsasm"><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><code class="hljs mipsasm"><span class="hljs-comment"># 切换AI</span><br>切换AI chatgpt-web<br>切换AI <span class="hljs-keyword">bing-c</span><br><span class="hljs-keyword">切换AI </span><span class="hljs-keyword">bard</span><br><span class="hljs-keyword"></span><br><span class="hljs-keyword"># </span>切换聊天内容显示方式<br>文本模式<br>图片模式<br>图文混合模式<br></code></pre></td></tr></table></figure><h2 id="后记">后记</h2><ol type="1"><li><p>使用 <code>screen</code> 命令让<code>python3 bot.py</code> 和<code>./go-cqhttp</code>在关闭终端的情况下继续运行:(这玩意就是session的套娃)</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><code class="hljs shell"><span class="hljs-meta">#</span><span class="bash"> 安装命令</span><br>apt install screen<br><br><span class="hljs-meta">#</span><span class="bash"> 新建screen窗口名称为bot,并自动进入</span><br>screen -S bot<br><br><span class="hljs-meta">#</span><span class="bash"> 运行bot</span><br>python3 bot.py<br><br><span class="hljs-meta">#</span><span class="bash"> 退出bot窗口,程序就在窗口中运行了</span><br>Ctrl + A , D<br><br><span class="hljs-meta">#</span><span class="bash"> 显示目前所有的窗口</span><br>screen -ls<br><br><span class="hljs-meta">#</span><span class="bash"> 恢复某个窗口,检查程序运行情况</span><br>screen -r 窗口名称<br><br><span class="hljs-meta">#</span><span class="bash"> 开另一个窗口运行go-cqhttp</span><br>screen -S qq<br></code></pre></td></tr></table></figure></li><li><p>检查<code>go-cqhttp</code>的运行状态,如果失败退出就自动再运行</p><figure class="highlight sh"><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><code class="hljs sh"><span class="hljs-meta">#!/bin/bash</span><br><span class="hljs-keyword">while</span> <span class="hljs-literal">true</span><br><span class="hljs-keyword">do</span><br><span class="hljs-comment"># 检查 go-cqhttp 进程是否正在运行</span><br><span class="hljs-keyword">if</span> ps aux | grep -v grep | grep -q <span class="hljs-string">"go-cqhttp"</span>; <span class="hljs-keyword">then</span><br> <span class="hljs-built_in">echo</span> <span class="hljs-string">"go-cqhttp 进程正在运行,继续监视"</span><br><span class="hljs-keyword">else</span><br> <span class="hljs-built_in">echo</span> <span class="hljs-string">"go-cqhttp 进程未运行,启动进程"</span><br> <span class="hljs-comment"># 运行 go-cqhttp 命令,根据实际情况调整命令路径和参数</span><br> /root/go-cqhttp/go-cqhttp<br> sleep 300<br><span class="hljs-keyword">fi</span><br><span class="hljs-keyword">done</span><br></code></pre></td></tr></table></figure><p>将上述内容保存为<code>autorun.sh</code>,并且<code>chmod +x autorun.sh</code>,存放在go-cqhttp文件夹下,用 <code>bash autorun.sh</code> 代替<code>./go-cqhttp</code>运行,注意如果qq登录失败又反复运行的话,是不是大概率会冻结账号,还在观察中。</p></li></ol>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>gpt, go-cqhttp</tag>
</tags>
</entry>
<entry>
<title>ChatGpt接入QQ</title>
<link href="/2023/05/21/ChatGpt%E6%8E%A5%E5%85%A5QQ/"/>
<url>/2023/05/21/ChatGpt%E6%8E%A5%E5%85%A5QQ/</url>
<content type="html"><![CDATA[<h2 id="准备工具">准备工具</h2><p>一台vps,一个chatgpt账号,chatgpt的access token,2个QQ账号</p><h2 id="项目地址">项目地址</h2><p><ahref="https://github.com/lss233/chatgpt-mirai-qq-bot">lss233/chatgpt-mirai-qq-bot:🚀 一键部署!真正的 AI聊天机器人!支持ChatGPT、文心一言、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送| 支持 QQ、Telegram、Discord、微信 等平台 (github.com)</a></p><h2 id="实操">实操</h2><ol type="1"><li><p>在linux的vps上进入 <code>/opt</code> 目录运行如下命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">bash -c <span class="hljs-string">"<span class="hljs-subst">$(wget -O- https://gist.githubusercontent.com/lss233/2fdd75be3f0724739368d0dcd9d1367d/raw/62a790da4a391af096074b3355c2c2b7ecab3c28/chatgpt-mirai-installer-gocqhttp.sh)</span>"</span><br></code></pre></td></tr></table></figure><p>会自动下载docker, docker-compose, 和建立三个容器</p></li><li><p>输入QQ号(通常是小号)作为机器人,输入密码,管理员QQ,还有chatgpt的accesstoken</p></li><li><p>程序运行结束会显示如下内容,找个地方复制粘贴一下,后续会常用到</p><figure class="highlight awk"><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><code class="hljs awk">程序已被安装在 ./chatgpt-qq 下,<br><br>以下是一些维护的注意事项:<br><br>你需要先 cd ./chatgpt-qq 才能进入到程序的安装目录。<br><br>你可以输入docker-compose logs -f --tail=<span class="hljs-number">100</span> 来观察运行日志。<br><br>修改配置文件后,使用 docker-compose restart 重启程序。<br><br>使用 docker-compose pull && docker-compose up -d 命令来更新程序<br><br>如果你记不住的话,可以把上面这段文字保存到一个文件里面,需要的时候再看。<br><br>如果您遇到问题可以在这里寻找答案:<br><br>https:<span class="hljs-regexp">//</span>chatgpt-qq.lss233.com/<br><br>如果您觉得此脚本对你有帮助的话,欢迎您在爱发电支持作者。<br><br>https:<span class="hljs-regexp">//</span>afdian.net<span class="hljs-regexp">/a/</span>lss233<br><br>再见。<br></code></pre></td></tr></table></figure></li><li><p>按照上述步骤</p><figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli"><span class="hljs-keyword">cd</span> <span class="hljs-string">./chatgpt-qq</span><br>docker-compose logs -f <span class="hljs-params">--tail=100</span><br></code></pre></td></tr></table></figure><p>查看容器运行记录,因为我们的QQ登录是在非常用地址,其中显示登录QQ需要复制出来那个长串的地址,然后在浏览器访问,进行登录验证,无奈我这里总是要循环验证,无解。</p></li><li><p>解决上述问题:</p><p>进入<code>gocqhttp</code> 文件夹,修改 <code>device.json</code> ,将<code>protocol</code> 修改为 <code>3</code> ,也就是MacOS,参看<ahref="https://docs.go-cqhttp.org/guide/config.html#设备信息">配置 |go-cqhttp 帮助中心</a></p><p>然后 <code>docker-compose restart</code>,重复步骤4的操作,我这里就显示QQ登录成功了,如果还不行就用自己的vps的ip在手机或电脑上登录一下QQ,使该ip成为你的常用登录地。如果登录成功,恭喜你过了最难的一关,也具备了基本的与gpt对话的功能。</p></li><li><p>可选操作:接入其它的AI平台和聊天软件,只需要修改<code>chatgpt-qq</code> 下的 <code>config.cfg</code>在里面添加相应的配置即可</p><p><ahref="https://chatgpt-qq.lss233.com/pei-zhi-wen-jian-jiao-cheng/wan-zheng-pei-zhi-wen-jian-yang-li">完整配置文件样例- ChatGPT for QQ 使用文档 (lss233.com)</a></p><p>接入tg需要解决两个问题:</p><ul><li><p>建立机器人参看<ahref="https://blog.csdn.net/whatday/article/details/113747294">telegram创建机器人 bot简介_telegram创建机器人_whatday的博客-CSDN博客</a></p></li><li><p>获取 <code>chat id</code>参看https://cloud.tencent.com/developer/article/1948136</p></li></ul></li><li><p>机器人的管理指令:</p><p><ahref="https://github.com/lss233/chatgpt-mirai-qq-bot/wiki/常用命令列表">常用命令列表· lss233/chatgpt-mirai-qq-bot Wiki (github.com)</a></p></li></ol><h2 id="后记">后记</h2><ul><li>接入poe会封poe的账号!!!我的账号也寄了[<ahref="https://github.com/lss233/chatgpt-mirai-qq-bot/issues/705">BUG]Poe 登录提示 Something went wrong... · Issue #705 ·lss233/chatgpt-mirai-qq-bot (github.com)</a></li></ul>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>chatgpt</tag>
</tags>
</entry>
<entry>
<title>NginxProxyManager安装与使用</title>
<link href="/2023/05/18/NginxProxyManager%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8/"/>
<url>/2023/05/18/NginxProxyManager%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8/</url>
<content type="html"><![CDATA[<h2 id="安装">安装</h2><ol type="1"><li><p>安装 Docker 和 Docker-Compose</p></li><li><p>在/opt/npm文件夹下创建一个类似于下面的 docker-compose.yml文件:</p><figure class="highlight vim"><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></pre></td><td class="code"><pre><code class="hljs vim"><span class="hljs-keyword">version</span>: <span class="hljs-string">'3.8'</span><br>service<span class="hljs-variable">s:</span><br> app:<br> image: <span class="hljs-string">'jc21/nginx-proxy-manager:latest'</span><br> restar<span class="hljs-variable">t:</span> unless-stopped<br> port<span class="hljs-variable">s:</span><br> - <span class="hljs-string">'80:80'</span><br> - <span class="hljs-string">'81:81'</span><br> - <span class="hljs-string">'443:443'</span><br> volume<span class="hljs-variable">s:</span><br> - ./dat<span class="hljs-variable">a:</span>/data<br> - ./letsencryp<span class="hljs-variable">t:</span>/etc/letsencrypt<br></code></pre></td></tr></table></figure></li><li><p>运行容器</p><figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">docker-compose up -d</span><br></code></pre></td></tr></table></figure></li><li><p>登录到管理界面</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">http:<span class="hljs-regexp">//y</span>ourip:<span class="hljs-number">81</span><br></code></pre></td></tr></table></figure><p>默认管理员用户:</p><figure class="highlight avrasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs avrasm"><span class="hljs-symbol">Email:</span> [email protected]<br><span class="hljs-symbol">Password:</span> changeme<br></code></pre></td></tr></table></figure><p>使用此默认用户登录后,系统会立即要求您修改您的详细信息并更改密码。</p></li><li><p>升级</p><figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">docker-compose pull</span><br><span class="hljs-attribute">docker-compose up -d</span><br></code></pre></td></tr></table></figure></li></ol><h2 id="使用">使用</h2><p>添加反代网站add proxy host:</p><ol type="1"><li><p>Details:</p><ul><li>DomainNames:一般要在dns服务商那里先用*解析一个通用的二级域名到本机ip,这里添加你喜欢的二级域名就好</li><li>Scheme:选择https</li><li>Forward Hostname:要反代的ip,如果是docker容器一般填写<code>172.17.0.1</code></li><li>Forward Port:反代的端口</li></ul></li><li><p>Custom locations:与Details应该是并列关系</p><ul><li>Location:填写要反代的网站的文件夹位置,有些网站是建立在二级文件夹下就需要在这里定义</li><li>Scheme:选择https</li><li>Forward Hostname:要反代的ip,如果是docker容器一般填写<code>172.17.0.1</code></li><li>Forward Port:反代的端口</li></ul></li><li><p>SSL Certificate:</p><p>根据需要是否开启SSL和强制ForceSSL,输入邮箱,同意条款就可以自动签发证书了,爽!</p></li></ol>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>docker,nginx</tag>
</tags>
</entry>
<entry>
<title>Macos系统Python多版本管理和Pip管理</title>
<link href="/2023/05/11/Macos%E7%B3%BB%E7%BB%9FPython%E5%A4%9A%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86%E5%92%8CPip%E7%AE%A1%E7%90%86/"/>
<url>/2023/05/11/Macos%E7%B3%BB%E7%BB%9FPython%E5%A4%9A%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86%E5%92%8CPip%E7%AE%A1%E7%90%86/</url>
<content type="html"><![CDATA[<h2 id="系统概况">系统概况</h2><ol type="1"><li><p>macos蒙特雷,系统自带Python3.9.6</p></li><li><p>通过安装包安装了Python3.10</p></li><li><p><code>brew install autojump</code>时作为依赖包安装了Python3.11</p></li><li><p>查看所有安装的Python</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></pre></td><td class="code"><pre><code class="hljs shell">ls /usr/local/bin | grep python3<br><span class="hljs-meta">#</span><span class="bash"> 会列出所有自己安装的版本,但是不包括系统自带的,系统自带的是/usr/bin/python3</span><br><br>/usr/bin/python3 --version<br><span class="hljs-meta">#</span><span class="bash"> 显示系统自带的Python版本</span><br><br>python3 --version<br><span class="hljs-meta">#</span><span class="bash"> 显示现在系统默认使用的Python版本</span><br></code></pre></td></tr></table></figure></li></ol><h2 id="处理">处理</h2><ol type="1"><li><p>卸载多余的3.10版本</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></pre></td><td class="code"><pre><code class="hljs shell">sudo rm -rf /Library/Frameworks/Python.framework/Versions/X.Y.Z<br>sudo rm -rf "/Applications/Python X.Y.Z"<br>sudo rm /usr/local/bin/pydoc3.X<br>sudo rm /usr/local/bin/python3.X<br>sudo rm /usr/local/bin/python3.Xm<br><span class="hljs-meta">#</span><span class="bash"> 其中 `X.Y.Z` 是要卸载的 Python 版本号。例如,如果要卸载 Python 3.8.10,则应将 `X.Y.Z` 替换为 `3.8.10`。请注意,这些命令需要管理员权限才能执行(使用 `sudo` 命令)。</span><br><br><span class="hljs-meta">#</span><span class="bash">(可选)您还可以使用以下命令,删除与卸载的 Python 版本相关的任何残留文件或目录</span><br>sudo rm -rf ~/Library/Python/X.Y<br>sudo rm -rf /Library/Python/X.Y<br><span class="hljs-meta">#</span><span class="bash"> 其中 `X.Y` 是要卸载的 Python 版本号。</span><br></code></pre></td></tr></table></figure></li><li><p>想卸载3.11版本,但是作为<code>autojump</code>的依赖,不知道怎么弄,暂时放弃</p></li><li><p>此时再来<code>python3 --version</code>查看现在系统用的版本,我这里变成了3.11</p></li><li><p>关联命令 <code>python3</code> 为指定版本</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></pre></td><td class="code"><pre><code class="hljs shell">nano ~/.zshrc<br><span class="hljs-meta">#</span><span class="bash"> 根据自己使用的终端程序更改,蒙特雷默认使用的是zsh</span><br><br>alias python3='/usr/bin/python3'<br><span class="hljs-meta">#</span><span class="bash"> 指定为系统自带的3.9.6版本</span><br></code></pre></td></tr></table></figure><p>记得 <code>source ~/.zshrc</code> 使更改生效</p></li><li><p>为了安装 <code>pix2text</code> ,其依赖包 <code>torch</code>版本要求为1.8.0~2.0,使用pip安装时总是找到2.0.1的版本,因此需要使用老版本的Pip,刚好退回到python3.9.6的版本</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs awk">nano <span class="hljs-regexp">/usr/</span>local<span class="hljs-regexp">/bin/</span>pip<br><span class="hljs-comment"># 会看到如下的代码</span><br></code></pre></td></tr></table></figure><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></pre></td><td class="code"><pre><code class="hljs shell"><span class="hljs-meta">#</span><span class="bash">!/usr/<span class="hljs-built_in">local</span>/bin/python3</span><br><span class="hljs-meta">#</span><span class="bash"> -*- coding: utf-8 -*-</span><br>import re<br>import sys<br>from pip._internal.cli.main import main<br>if __name__ == '__main__':<br> sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])<br> sys.exit(main())<br></code></pre></td></tr></table></figure><p>将第一行的 <code>#!/usr/local/bin/python3</code>修改为你想要的Python版本的路径就好了,例如修改为<code>#!/usr/bin/python3</code>这样Pip默认关联的就是系统自带版本的Python也就是3.9.6了。</p><h2 id="后记">后记</h2><p>折腾了一圈,目的其实就是为了安装 <code>torch</code>的1.8版本,貌似直接修改Pip的默认Python就可以了吧,不过顺带清理了一下系统多余的Python版本,也对各个版本的Python安装的位置也有了大概的了解。</p></li></ol>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>pythoh, pip</tag>
</tags>
</entry>
<entry>
<title>Memo的搭建和使用</title>
<link href="/2023/05/05/Memo%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E4%BD%BF%E7%94%A8/"/>
<url>/2023/05/05/Memo%E7%9A%84%E6%90%AD%E5%BB%BA%E5%92%8C%E4%BD%BF%E7%94%A8/</url>
<content type="html"><![CDATA[<p>好的,以下是您需要的Markdown格式博文:</p><h1 id="memos-docker搭建过程记录">Memos Docker搭建过程记录</h1><p>在这篇博文中,我将记录我如何使用Docker搭建Memo应用程序,并使用Git自动备份Memo数据。我还将介绍如何使用crontab定期运行备份脚本。</p><h2 id="docker搭建memos应用程序">Docker搭建Memos应用程序</h2><p>Memo是一个简单的笔记应用程序,可以帮助您轻松记录您的想法和笔记。我选择使用Docker容器来运行Memo,因为这样可以避免与本地环境的冲突,并使部署更加简单。</p><h3 id="步骤">步骤</h3><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">docker run -d --name memos -p <span class="hljs-number">5230</span>:<span class="hljs-number">5230</span> -v <span class="hljs-regexp">/opt/m</span>emos<span class="hljs-regexp">/:/</span>var<span class="hljs-regexp">/opt/m</span>emos ghcr.io<span class="hljs-regexp">/usememos/m</span>emos:latest<br></code></pre></td></tr></table></figure><p>现在,您可以通过访问 <code>http://localhost:5230</code>来访问Memo应用程序。</p><h3 id="说明">说明</h3><ul><li>将/opt/memos替换成你想要映射的文件夹</li><li>注册登录以后,将存储方式从数据库改为本地存储,这样方便增量备份</li></ul><h2 id="使用git自动备份memos数据">使用Git自动备份Memos数据</h2><p>为了确保Memos数据不会丢失,并且方便从服务器之间进行迁移,我使用Git对数据进行自动备份。我将备份脚本编写为Shell脚本,并使用Git命令将备份提交到GitHub。</p><h3 id="步骤-1">步骤</h3><ol type="1"><li>在 <code>memos</code> 目录中创建一个名为 <code>backup.sh</code>的文件,并添加以下内容:</li></ol><figure class="highlight bash"><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></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-meta">#!/bin/bash</span><br><br><span class="hljs-built_in">cd</span> /opt/memos<br><br>git add .<br>git commit -m <span class="hljs-string">"Backup <span class="hljs-subst">$(date)</span>"</span><br>git push<br></code></pre></td></tr></table></figure><p>这个脚本将切换到Memos数据目录,并使用Git命令将备份提交到GitHub。</p><ol start="2" type="1"><li>将脚本标记为可执行:</li></ol><figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs elixir"><span class="hljs-variable">$ </span>chmod +x backup.sh<br></code></pre></td></tr></table></figure><ol start="3" type="1"><li>将该文件夹关联到远程github仓库,要将现有的Memos数据文件夹关联到远程的GitHub仓库,您可以按照以下步骤进行操作:</li></ol><ul><li><p>在GitHub上创建一个新的仓库,用于存储Memos数据备份。</p></li><li><p>进入您的Memos数据文件夹,并初始化一个新的Git仓库:</p></li></ul><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs powershell"><span class="hljs-variable">$</span> <span class="hljs-built_in">cd</span> /opt/memos<br><span class="hljs-variable">$</span> git init<br></code></pre></td></tr></table></figure><ul><li>添加备份文件夹和提交备份文件夹到本地Git仓库:</li></ul><figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs elixir"><span class="hljs-variable">$ </span>git add .<br><span class="hljs-variable">$ </span>git commit -m <span class="hljs-string">"Initial backup"</span><br></code></pre></td></tr></table></figure><ul><li>的Git仓库关联到远程的GitHub仓库:</li></ul><figure class="highlight vim"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs vim">$ git remote <span class="hljs-built_in">add</span> origin git@github.<span class="hljs-keyword">com</span>:<span class="hljs-symbol"><username></span>/<span class="hljs-symbol"><repository></span>.git<br></code></pre></td></tr></table></figure><p>请将 <code><username></code> 和 <code><repository></code>替换为您在GitHub上创建的仓库的用户名和仓库名称。</p><ul><li>地的备份文件夹推送到远程的GitHub仓库:</li></ul><figure class="highlight maxima"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs maxima">$ git <span class="hljs-built_in">push</span> -u <span class="hljs-built_in">origin</span> master<br></code></pre></td></tr></table></figure><p>现在,您的Memos据备份文件夹已经成功关联到远程的GitHub仓库,您可以定期运行备份脚本,将最新的备份文件推送到GitHub仓库中。</p><ol start="4" type="1"><li>运行一次备份脚本,以确保一切正常:</li></ol><figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs elixir"><span class="hljs-variable">$ </span>./backup.sh<br></code></pre></td></tr></table></figure><p>现在,备份应该已经提交到GitHub。</p><h2 id="使用crontab定期运行备份脚本">使用crontab定期运行备份脚本</h2><p>为了确保Memo数据得到及时备份,我使用crontab定期运行备份脚本。我设置crontab每隔2小时运行一次备份脚本。</p><h3 id="步骤-2">步骤</h3><ol type="1"><li>运行以下命令以编辑crontab:</li></ol><figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs elixir"><span class="hljs-variable">$ </span>crontab -e<br></code></pre></td></tr></table></figure><ol start="2" type="1"><li>在打开的编辑器中添加以下行:</li></ol><figure class="highlight basic"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs basic"><span class="hljs-symbol">0 </span>*/<span class="hljs-number">2</span> * * * /opt/memos/backup.sh<br></code></pre></td></tr></table></figure><p>这将在每2个小时的第0分钟运行备份脚本。</p><ol start="3" type="1"><li>保存并关闭编辑器。</li></ol><p>现在,您的Memos数据应该每隔2小时自动备份到GitHub。</p><h2 id="通过raycast发memo">通过Raycast发Memo</h2><p>Raycast是一款Mac上的快速启动应用程序,可以让您通过简单的快捷键访问常用的功能和应用程序。要使用Raycast来发Memo笔记,您可以按照以下步骤进行操作:</p><ol type="1"><li><p>下载并安装Raycast应用程序。</p></li><li><p>在Raycast中搜索并安装“Memo”插件。</p></li><li><p>打开Memo应用程序,并创建一个新的笔记。在笔记中输入您要保存的文本内容。</p></li><li><p>打开Raycast应用程序,并使用快捷键 <code>Cmd + Shift + P</code>来打开命令面板。</p></li><li><p>在命令面板中搜索并选择“Memo: Save New Note”选项。</p></li><li><p>在弹出的窗口中输入您的笔记标题和内容,并按下 <code>Enter</code>键。</p></li><li><p>您的Memo笔记已经成功保存!您可以在Memo应用程序中查看它。</p></li></ol><p>除了保存新的Memo笔记外,Memo插件还支持搜索和查看现有的Memo笔记。通过Raycast和Memo插件,您可以更加高效地记录和查看笔记,提高您的工作效率。</p><h2 id="windowsandroidiosmac客户端">Windows,android,ios,mac客户端</h2><p>https://memos.moe/</p><h2 id="结论">结论</h2><p>在本文中,我介绍了如何使用Docker搭建Memos应用程序,并使用Git自动备份Memos数据。我还介绍了如何使用crontab定期运行备份脚本。现在,您可以放心地记录您的想法和笔记,因为您的数据已经得到了完美的保护!</p><p>P.S. 本文主体是chatgpt写就,在其基础上做了微改</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>Memos,docker,git</tag>
</tags>
</entry>
<entry>
<title>docker安装plex</title>
<link href="/2023/04/25/docker%E5%AE%89%E8%A3%85plex/"/>
<url>/2023/04/25/docker%E5%AE%89%E8%A3%85plex/</url>
<content type="html"><![CDATA[<h2 id="选择适配系统的版本">选择适配系统的版本</h2><p>您需要考虑您的操作系统,因为Docker镜像是针对特定操作系统构建的。您可以在DockerHub上找到适用于您操作系统的Plex镜像。</p><p>例如我要在linux服务器上安装,则应该选择LinuxServer.io的Docker镜像。</p><h2 id="利用docker-compose安装">利用docker compose安装</h2><p>在/opt/plex文件夹下建立docker-compose.yml文件,写入如下内容:</p><figure class="highlight yaml"><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><code class="hljs yaml"><span class="hljs-meta">---</span><br><span class="hljs-attr">version:</span> <span class="hljs-string">"2.1"</span><br><span class="hljs-attr">services:</span><br> <span class="hljs-attr">plex:</span><br> <span class="hljs-attr">image:</span> <span class="hljs-string">lscr.io/linuxserver/plex:latest</span><br> <span class="hljs-attr">container_name:</span> <span class="hljs-string">plex</span><br> <span class="hljs-attr">network_mode:</span> <span class="hljs-string">host</span><br> <span class="hljs-attr">environment:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">PUID=1000</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">PGID=1000</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">VERSION=docker</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">PLEX_CLAIM=换成自己的claim</span><br> <span class="hljs-attr">volumes:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">/opt/plex:/config</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">/opt/aria2/aria2-downloads:/tv</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">/opt/aria2/aria2-downloads:/movies</span><br> <span class="hljs-attr">restart:</span> <span class="hljs-string">unless-stopped</span><br></code></pre></td></tr></table></figure><p>其中claim id在https://plex.com/claim获取,volumes的磁盘映射根据自己的需求更改</p><p>然后<code>docker-compose up -d</code> 就可以玩耍了</p><h2 id="一些常见问题">一些常见问题</h2><ul><li>第一次进入登录账号以后,一般会引导进行设置、添加资料库</li><li>建议开启远程连接,这样当利用多个vps或者nas建立了多个plex服务器时,可以统一在plex的官网进行连接,在左侧会同时显示多个服务器的电影资源</li><li>建议配合aria2和aria2ng共同使用</li></ul>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>docker,plex</tag>
</tags>
</entry>
<entry>
<title>n1小钢炮搬家记</title>
<link href="/2022/10/04/n1%E5%B0%8F%E9%92%A2%E7%82%AE%E6%90%AC%E5%AE%B6%E8%AE%B0/"/>
<url>/2022/10/04/n1%E5%B0%8F%E9%92%A2%E7%82%AE%E6%90%AC%E5%AE%B6%E8%AE%B0/</url>
<content type="html"><![CDATA[<h2 id="一搬迁之前的准备工作">一、搬迁之前的准备工作</h2><ul><li>事先了解搬迁地的网关地址和子网掩码</li><li>进入小钢炮后台 <code>System-Network</code>,选择<code>use Static IP</code>,填入ip地址、网关地址,然后保存</li><li>如果搬迁地没有登录路由或交换机后台的权限,上一步不要选择<code>use DHCP</code>,不然就捞不到小钢炮的ip了</li></ul><h2id="二搬迁后遇到的各种麻烦及解决办法">二、搬迁后遇到的各种麻烦及解决办法</h2><ul><li><p>搬迁地的网段为172.17.0.0/16,和docker0网段冲突</p><p>直接表现就是已建好的容器不能访问了,因此修改docker0网段为172.100.0.0/16</p><p>修改文件 <code>/etc/docker/daemon.json</code> 为以下内容:</p><figure class="highlight json"><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><code class="hljs json">{<br> <span class="hljs-attr">"storage-driver"</span>: <span class="hljs-string">"overlay2"</span>,<br> <span class="hljs-attr">"registry-mirrors"</span>: [<span class="hljs-string">"https://hub-mirror.c.163.com"</span>,<br> <span class="hljs-string">"https://registry.aliyuncs.com"</span>,<br> <span class="hljs-string">"https://registry.docker-cn.com"</span>,<br> <span class="hljs-string">"https://docker.mirrors.ustc.edu.cn"</span>],<br> <span class="hljs-attr">"default-address-pools"</span>:[{<span class="hljs-attr">"base"</span>:<span class="hljs-string">"172.100.0.0/16"</span>,<span class="hljs-attr">"size"</span>:<span class="hljs-number">24</span>}]<br>}<br></code></pre></td></tr></table></figure></li><li><p>docker版本的openwrt更换新版本以后,ssrplus总是无法启动或者谷歌连接测试不通</p><p>经过百般搜索,看到这样一句话:</p><p><code>选 仅常用端口(不走P2P流量到代理) 就无法启动。</code></p><p>改为全部端口就可以启动了</p></li><li><p>openwrt里面的passwall显示谷歌连接测试失败</p><p>解决办法:在高级设置里面,找到<code>TCP 转发端口</code>,将常用改为全部,再来测试就正常了</p></li><li><p>关于docker版本的openwrt安装版本</p><p>由于n1的架构是aarch64,所以在dockerhub中搜索arm64架构的openwrt版本才可以安装</p><p>先后尝试了</p><p><code>unifreq/openwrt-aarch64</code> 最高尝试到<ahref="https://hub.docker.com/layers/unifreq/openwrt-aarch64/r20.10.20/images/sha256-b6370f04bb231867957ee9101e91e5978d4b22dccfca265b16c36f450a4fddc9?context=explore">r20.10.20</a>版本可以正常使用</p><p><code>buddyfly/openwrt-aarch64</code></p><p><code>sulinggg/openwrt</code>版本多,界面美化好,n1可使用registry.cn-shanghai.aliyuncs.com/suling/openwrt:armv8</p></li><li><p>小钢炮自带的transmission提示错误,无法启动</p><p>解决办法:进入 <code>Apps-Transmission-Extra Settings</code> 找到<code>rpc whitelist</code> 添加新的本地网段</p></li><li><p>关于n1无法ping通openwrt容器</p><p>由于openwrt容器采用的是网卡混杂模式macvlan,宿主机与容器之间的网络连接是隔绝的,但是多个混杂模式之间的网络是可以相互访问的,只要在宿主机上再建立一个macvlan,然后修改路由表,使数据经由<strong>宿主机下的macvlan</strong>传输到<strong>容器内的macvlan</strong>即可。</p><ul><li><p>环境:</p><p>宿主机eth0:172.17.18.18/16</p><p>openwrt容器:172.17.18.22/16</p></li><li><p>解决:以下操作均在 <strong>宿主机</strong>中,不是在Docker容器中</p><p>新增一个叫mynet的macvlan接口</p><figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs lasso">ip <span class="hljs-keyword">link</span> add mynet <span class="hljs-keyword">link</span> eth0 <span class="hljs-keyword">type</span> macvlan mode bridge<br></code></pre></td></tr></table></figure><p>为该接口分配ip</p><figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs armasm"><span class="hljs-symbol">ip</span> <span class="hljs-keyword">addr</span> <span class="hljs-keyword">add</span> <span class="hljs-number">172</span>.<span class="hljs-number">17</span>.<span class="hljs-number">18</span>.<span class="hljs-number">222</span> dev mynet<br></code></pre></td></tr></table></figure><p>启用名称为mynet的macvlan</p><figure class="highlight gams"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs gams">ip link <span class="hljs-keyword">set</span> mynet <span class="hljs-comment">up</span><br></code></pre></td></tr></table></figure><p>修改路由表,使宿主机172.17.18.18/16到Openwrt容器172.17.18.22/16的通信全部由mynet中转</p><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs routeros">ip<span class="hljs-built_in"> route </span><span class="hljs-builtin-name">add</span> 172.17.18.22 dev mynet<br></code></pre></td></tr></table></figure><p>该问题解决参考了https://mopo-blog.ddnsfree.com/2021/02/23/n1-eth0-macvlan/</p></li></ul></li></ul>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>n1,docker,openwrt</tag>
</tags>
</entry>
<entry>
<title>哪吒探针监控vps状态</title>
<link href="/2022/09/21/%E5%93%AA%E5%90%92%E6%8E%A2%E9%92%88%E7%9B%91%E6%8E%A7vps%E7%8A%B6%E6%80%81/"/>
<url>/2022/09/21/%E5%93%AA%E5%90%92%E6%8E%A2%E9%92%88%E7%9B%91%E6%8E%A7vps%E7%8A%B6%E6%80%81/</url>
<content type="html"><![CDATA[<h1 id="项目地址">项目地址</h1><p>https://github.com/naiba/nezha</p><h1 id="创建一个oauth-apps">创建一个OAuth Apps</h1><ul><li>先打开:https://github.com/settings/developers,然后点击New OAuthApp按钮</li><li>Homepage URL:http://域名:8088<br /></li><li>Authorization callback URL:http://域名:8008/oauth2/callback</li><li>可能需要用github的手机app进行激活</li><li>记录OAuth Apps的Client ID和Client secrets</li></ul><h1 id="放行防火墙如果需要">放行防火墙(如果需要)</h1><p>开放8008和5555两个端口</p><h1 id="安装命令">安装命令</h1><p>国外vps一键脚本命令:</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">curl -L https:<span class="hljs-regexp">//</span>raw.githubusercontent.com<span class="hljs-regexp">/naiba/</span>nezha<span class="hljs-regexp">/master/</span>script<span class="hljs-regexp">/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./</span>nezha.sh<br></code></pre></td></tr></table></figure><p>国内vps一键脚本命令:</p><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">curl -L https:<span class="hljs-regexp">//</span>jihulab.com<span class="hljs-regexp">/nezha/</span>nezha<span class="hljs-regexp">/-/</span>raw<span class="hljs-regexp">/master/</span>script<span class="hljs-regexp">/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./</span>nezha.sh<br></code></pre></td></tr></table></figure><h1 id="访问地址">访问地址:</h1><p><code>http://域名:8008</code></p><h1 id="后台管理">后台管理</h1><p>增加服务器后,需要在每个被监控的服务器安装Agent客户端,如果是国内vps还是会因为网络问题,不能正常下载到客户端,可以借助于上面国内vps的一键脚本命令后面加上参数,进行安装。</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>vps</tag>
</tags>
</entry>
<entry>
<title>利用warp脚本使任意vps变双栈</title>
<link href="/2022/09/20/%E5%88%A9%E7%94%A8warp%E8%84%9A%E6%9C%AC%E4%BD%BF%E4%BB%BB%E6%84%8Fvps%E5%8F%98%E5%8F%8C%E6%A0%88/"/>
<url>/2022/09/20/%E5%88%A9%E7%94%A8warp%E8%84%9A%E6%9C%AC%E4%BD%BF%E4%BB%BB%E6%84%8Fvps%E5%8F%98%E5%8F%8C%E6%A0%88/</url>
<content type="html"><![CDATA[<h1 id="cloudflare-warp功能">cloudflare warp功能</h1><p>直接搬运p3terx大佬博客的文字:</p><p><a href="https://p3terx.com/go/aHR0cHM6Ly8xLjEuMS4xLw">CloudflareWARP</a> 是 Cloudflare 提供的一项基于 WireGuard的网络流量安全及加速服务,能够让你通过连接到 Cloudflare的边缘节点实现隐私保护及链路优化。之前有很多小伙伴拿来当做某科学的上网工具来使用,应该很熟悉了。不过由于WireGuard 数据传输使用的 UDP 协议,中国大陆的网络运营商会对其进行 QoS,加上很多节点的 IP被封锁,现在可以说几乎处于不可用的状态了。而对于自由网络的地区来说则没有这些限制,加上有国外开发者制作的工具可以生成通用的WireGuard 配置文件,这使得我们可以在安装了某科学的上网工具的海外 VPS上部署它并获得如下作用:</p><ul><li>WARP 网络出入口均为双栈 (IPv4/IPv6),因此单栈 VPS 云服务器可以连接到WARP 网络来获取额外的网络连通性支持:<ul><li>IPv6 Only VPS 可获得 IPv4 网络的访问能力,不再局限于 NAT64/DNS64的束缚,能自定义任意 DNS解析服务器,这对使用某科学的上网工具有奇效。</li><li>IPv4 Only VPS 可获得 IPv6 网络的访问能力,比如可作为 IPv6 Only VPS的 SSH 跳板。此外 WARP 的 IPv6 网络的质量比 <ahref="https://p3terx.com/archives/use-he-tunnel-broker-to-add-public-network-ipv6-support-to-ipv4-vps-for-free.html">HEIPv6 Tunnel Broker</a> 甚至 VPS 自带的都要好,很少绕路。</li></ul></li><li>WARP 对外访问网络的出口 IP 被很多网站视为真实用户,即所谓的原生 IP或私人家庭住宅 IP,可以解除某些网站基于 IP 的封锁限制:<ul><li>解锁 Netflix 非自制剧</li><li>解决 Google 搜索流量异常频繁跳出人机身份验证的问题</li><li>解决无法打开 Google Scholar (谷歌学术) 403 访问限制的问题</li><li>解决 Google 的 IP 定位漂移到中国(送中),无法使用 YouTube Premium的问题</li></ul></li></ul><h1 id="关于wireguard安装问题">关于wireguard安装问题</h1><p>要点:</p><ul><li><p>该教程适用于Debian 10+</p></li><li><p>先执行 <code>uname -r</code> 命令查看内核版本。如果是 5.6及以上内核则已经集成了 WireGuard ,就不需要安装了。</p><p>当然看到这篇教程的小伙伴肯定大多数都不是这个情况,因为目前 Debian 10自带的内核版本是 4.19。所以有如下几个安装方法可供选择:</p><ol type="1"><li>安装版本高于 5.6 的内核</li><li>安装 wireguard 内核模块</li><li>安装 wireguard-go</li></ol><p>理论网络性能:<strong>内核集成</strong> ≥ <strong>内核模块</strong>> <strong>wireguard-go</strong></p></li><li><p>OpenVZ / LXC 等非完整虚拟化 VPS主机,由于是共享宿主机内核,故无法对内核进行修改,就只能安装<strong>wireguard-go</strong>。</p></li></ul><p>详细参考:https://p3terx.com/archives/debian-linux-vps-server-wireguard-installation-tutorial.html</p><h1 id="一键脚本">一键脚本</h1><ul><li><p>适用于除了香港、多伦多以外的vps:https://github.com/fscarmen/warp</p></li><li><p><span class="citation" data-cites="CoiaPrant">@CoiaPrant</span>的 warp-go 一键脚本。使用 CloudFlare-WARP 的各类接口,集成wireguard-go,可以完全替代 WGCF。 救活了香港、多伦多等,让没有官方 WARP的 VPS 也可以获取 WARP IP。</p><p>下载脚本:<code>wget -N https://raw.githubusercontent.com/fscarmen/warp/main/warp-go.sh</code></p></li></ul><h1 id="关于warp-go.sh选项选择问题">关于warp-go.sh选项选择问题</h1><p>经过实测,ipv4的vps选择全局ipv6,如果是选择全局双栈,ssh马上失去连接,只能到网页端重启vps</p><p>好像有修改配置的方法,可以实现全局双栈,后续再研究</p><h1 id="作euserv的跳板">作euserv的跳板</h1><ul><li><p>使用x-ui的dokodemo-door,转发到euserv的ipv6,从而实现ssh连接</p></li><li><p>使用x-ui的dokodemo-door,转发到euserv的ipv6,从而实现shadowsocks连接,vmess协议转发貌似未成功</p></li></ul>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>warp</tag>
</tags>
</entry>
<entry>
<title>docker安装flare个人导航页</title>
<link href="/2022/09/16/docker%E5%AE%89%E8%A3%85flare%E4%B8%AA%E4%BA%BA%E5%AF%BC%E8%88%AA%E9%A1%B5/"/>
<url>/2022/09/16/docker%E5%AE%89%E8%A3%85flare%E4%B8%AA%E4%BA%BA%E5%AF%BC%E8%88%AA%E9%A1%B5/</url>
<content type="html"><![CDATA[<h2 id="利用docker-compose安装">利用docker-compose安装</h2><p>新建文件夹flare,进入新建文件docker-compose.yml,写入以下内容:</p><figure class="highlight yaml"><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><code class="hljs yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3.6'</span><br><br><span class="hljs-attr">services:</span><br> <span class="hljs-attr">flare:</span><br> <span class="hljs-attr">image:</span> <span class="hljs-string">soulteary/flare:0.3.1</span><br> <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br> <span class="hljs-comment"># 默认无需添加任何参数,如有特殊需求</span><br> <span class="hljs-comment"># 可阅读文档 https://github.com/soulteary/docker-flare/blob/main/docs/advanced-startup.md</span><br> <span class="hljs-comment"># command: flare</span><br> <span class="hljs-comment"># 启用账号登陆模式,--visibility=private表示登录才能看到首页</span><br> <span class="hljs-attr">command:</span> <span class="hljs-string">flare</span> <span class="hljs-string">--nologin=0</span> <span class="hljs-string">--visibility=private</span><br> <span class="hljs-attr">environment:</span><br> <span class="hljs-comment"># 如需开启用户登陆模式,需要先设置 `nologin` 启动参数为 `0`</span><br> <span class="hljs-comment"># 如开启 `nologin`,未设置 FLARE_USER,则默认用户为 `flare`</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">FLARE_USER=username</span><br> <span class="hljs-comment"># 指定你自己的账号密码,如未设置 `FLARE_USER`,则会默认生成密码并展示在应用启动日志中</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">FLARE_PASS=passwd</span><br> <span class="hljs-comment"># 是否开启“使用向导”,访问 `/guide`</span><br> <span class="hljs-comment"># - FLARE_GUIDE=1</span><br> <span class="hljs-attr">ports:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-number">5005</span><span class="hljs-string">:5005</span><br> <span class="hljs-attr">volumes:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">./app:/app</span><br></code></pre></td></tr></table></figure><p>然后 <code>docker-compose up -d</code> 启动即可</p><h2 id="编辑书签和应用页面">编辑书签和应用页面</h2><p>通过 <code>/editor</code> 访问编辑页面,在app文件夹下可以通过备份<code>apps.yml</code> 和 <code>bookmarks.yml</code>即可将flare搬迁至其他地方,比如自己的vps上</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>docker,flare</tag>
</tags>
</entry>
<entry>
<title>mac虚拟机安装OpenWrt</title>
<link href="/2022/09/05/mac%E8%99%9A%E6%8B%9F%E6%9C%BA%E5%AE%89%E8%A3%85OpenWrt/"/>
<url>/2022/09/05/mac%E8%99%9A%E6%8B%9F%E6%9C%BA%E5%AE%89%E8%A3%85OpenWrt/</url>
<content type="html"><![CDATA[<h2 id="安装vmware-fusion">安装vmware fusion</h2><p>可以免费申请个人非商业用途许可证,可以参考https://zhuanlan.zhihu.com/p/315035843</p><h2 id="下载openwrt固件">下载OpenWrt固件</h2><p>这里我选择下载esir的固件,googledrive地址为:https://drive.google.com/drive/folders/1dqNUrMf9n7i3y1aSh68U5Yf44WQ3KCuh</p><p>可以选择精品小包或者佛跳墙版本,注意选择引导模式uefi或者传统bios模式</p><h2 id="格式转换">格式转换</h2><p>由于下载的 文件后缀名是.img,如果是.img.gz,可以手动重命名为.img,我们需要转换为.vmdk,这里需要用到qemu工具,<code>brew install qemu</code>,安装好以后,利用命令<code>qemu-img convert -f raw 源文件.img -O vmdk 目标文件.vmdk</code>就可以转换为vmdk格式了</p><h2 id="安装openwrt">安装OpenWrt</h2><p>新建虚拟机,硬盘设置为选择刚转换的vmdk文件,网络选择为桥接网络,以便将此OpenWrt作为macos的旁路由</p><h2 id="启动修改openwrt设置">启动修改OpenWrt设置</h2><ul><li><p>首次登录系统,还没有设置root密码,利用<code>password</code>命令设置root密码</p></li><li><p>修改ip地址:由于我的mac主机ip地址为172.17.18.154,网关为172.17.0.1,子网掩码为255.255.0.0,利用命令<code>vi /etc/config/network</code>,修改openwrt的ip为172.17.18.66,netmask设置为255.255.0.0</p></li><li><p>重启网络服务使修改生效:<code>/etc/init.d/network restart</code></p></li><li><p>(也可以下一步之后再验证)验证设置是否生效:<code>ifconfig</code>查看ip地址,还可以<code>ping 172.17.18.154</code>,<code>ping baidu.com</code></p></li></ul><h2 id="登录后台并修改设置">登录后台并修改设置</h2><p>浏览器登入172.17.18.66,用户名root,密码刚设的登录,找到网络--接口,修改网关为172.17.0.1,以及子网掩码为255.255.0.0,验证设置是否生效:<code>ifconfig</code>查看ip地址,还可以<code>ping 172.17.18.154</code>,<code>ping baidu.com</code>都通过了就表示设置成功了</p><h2 id="mac富强">mac富强</h2><p>修改mac的ip地址为手动:</p><figure class="highlight dns"><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><code class="hljs dns">ip: <span class="hljs-number">172.17.18.154</span><br>网关:<span class="hljs-number">172.17.18.66</span><br>DNS:<span class="hljs-number">114.114.114.114</span><br></code></pre></td></tr></table></figure><p>愉快的玩耍吧,旁路由秒杀所有V2rayX之类的</p><p>哦,对了,设置OpenWrt开机自动启动并且是无界面模式<code>vmrun start /Users/pl/Virtual\ Machines.localized/openwrt.vmwarevm/openwrt.vmx nogui</code></p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>Mac</tag>
<tag>OpenWrt</tag>
</tags>
</entry>
<entry>
<title>全国卷密集出现构造函数比较大小</title>
<link href="/2022/06/09/%E5%85%A8%E5%9B%BD%E5%8D%B7%E5%AF%86%E9%9B%86%E5%87%BA%E7%8E%B0%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0%E6%AF%94%E8%BE%83%E5%A4%A7%E5%B0%8F/"/>
<url>/2022/06/09/%E5%85%A8%E5%9B%BD%E5%8D%B7%E5%AF%86%E9%9B%86%E5%87%BA%E7%8E%B0%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0%E6%AF%94%E8%BE%83%E5%A4%A7%E5%B0%8F/</url>
<content type="html"><![CDATA[<h2 id="新高考全国1卷">2022新高考全国1卷</h2><div class="note note-primary"> <p>7.设<span class="math inline">\(a=0.1e^{0.1},b=\dfrac{1}{9},c=-\ln0.9\)</span>,则</p><p><span class="math inline">\(A.a<b<c\qquad\)</span> <spanclass="math inline">\(B.c<b<a\qquad\)</span> <spanclass="math inline">\(C.c<a<b\qquad\)</span> <spanclass="math inline">\(D.a<c<b\)</span></p> </div><div class="note note-success"> <p>从所给数据来看,可以将三个数处理为对<spanclass="math inline">\(0.1\)</span>的运算:<spanclass="math inline">\(a=0.1e^{0.1},b=\dfrac{0.1}{1-0.1},c=\ln\dfrac{1}{1-0.1}\)</span></p><p>因此可以构造<span class="math inline">\(f(x)=xe^x\)</span>,<spanclass="math inline">\(g(x)=\dfrac{x}{1-x}\)</span>,<spanclass="math inline">\(h(x)=\ln\dfrac{1}{1-x}\)</span></p><p>由<span class="math inline">\(\ln x\le x-1\)</span>得,<spanclass="math inline">\(\ln\dfrac{1}{1-x}\le\dfrac{1}{1-x}-1=\dfrac{x}{1-x}\)</span>,于是<spanclass="math inline">\(b<c\)</span></p><p>由<span class="math inline">\(e^x\ge x+1\)</span>得,<spanclass="math inline">\(e^{-x}\ge 1-x\)</span>,即<spanclass="math inline">\(e^x\le\dfrac{1}{1-x}(x<1)\)</span>,即<spanclass="math inline">\(xe^x\le\dfrac{x}{1-x}\)</span>,于是<spanclass="math inline">\(a<b\)</span></p><p>对于<span class="math inline">\(a,c\)</span>的比较,构造<spanclass="math inline">\(\varphi(x)=xe^x+\ln(1-x)\)</span>,则<spanclass="math inline">\(\varphi'(x)=(x+1)e^x+\dfrac{1}{x-1}=\dfrac{(x^2-1)e^x+1}{x-1}\)</span></p><p>记<span class="math inline">\(m(x)=(x^2-1)e^x+1\)</span>,则<spanclass="math inline">\(m'(x)=(x^2+2x-1)e^x\)</span>,<spanclass="math inline">\(x\in(0,0.1)\)</span>时,<spanclass="math inline">\(m'(x)<0\)</span>,于是<spanclass="math inline">\(m(x)\)</span>在<spanclass="math inline">\((0,0.1)\)</span>单减,则<spanclass="math inline">\(m(x)<m(0)=0\)</span>,于是<spanclass="math inline">\(\varphi'(x)>0\)</span>,即<spanclass="math inline">\(\varphi(x)\)</span>在<spanclass="math inline">\((0,0.1)\)</span>单增,则<spanclass="math inline">\(\varphi(x)>\varphi(0)=0\)</span>,于是<spanclass="math inline">\(a>c\)</span></p> </div><h2 id="新课标2卷12题">2022新课标2卷12题:</h2><div class="note note-primary"> <p>12.已知<span class="math inline">\(a=\dfrac{31}{32}\)</span>,<spanclass="math inline">\(b=\cos\dfrac{1}{4}\)</span>,<spanclass="math inline">\(c=4\sin\dfrac{1}{4}\)</span>,则</p><p><span class="math inline">\(A.c>b>a\qquad\)</span> <spanclass="math inline">\(B.b>a>c\qquad\)</span> <spanclass="math inline">\(C.a>b>c\qquad\)</span> <spanclass="math inline">\(D.a>c>b\)</span></p> </div><div class="note note-success"> <p>解析:</p><p><spanclass="math inline">\(b-c=\cos\dfrac{1}{4}-4\sin\dfrac{1}{4}=4(\dfrac{1}{4}\cos\dfrac{1}{4}-\sin\dfrac{1}{4})\)</span>,构造<spanclass="math inline">\(f(x)=x\cos x-\sin x\)</span>,则<spanclass="math inline">\(f'(x)=-x\sin x\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,\dfrac{1}{4})\)</span>单减,于是<spanclass="math inline">\(f(x)<f(0)=0\)</span>,即<spanclass="math inline">\(b<c\)</span></p><p>又<spanclass="math inline">\(a=1-\dfrac{1}{2}\cdot(\dfrac{1}{4})^2\)</span>,构造<spanclass="math inline">\(g(x)=1-\dfrac{1}{2}x^2-\cos x\)</span>,则<spanclass="math inline">\(g'(x)=-x+\sin x\)</span>,<spanclass="math inline">\(g''(x)=-1+\cos x\le0\)</span>,于是在<spanclass="math inline">\((0,+\infty)\)</span>上<spanclass="math inline">\(g'(x)\)</span>单减,则<spanclass="math inline">\(g'(x)<g'(0)=0\)</span>,于是<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((0,+\infty)\)</span>单减,则<spanclass="math inline">\(g(x)<g(0)=0\)</span>,即<spanclass="math inline">\(a<b\)</span></p> </div><h2 id="新课标1卷12题">2021新课标1卷12题</h2><div class="note note-primary"> <p>12.设<span class="math inline">\(a=2\ln1.01\)</span>,<spanclass="math inline">\(b=\ln1.02\)</span>,<spanclass="math inline">\(c=\sqrt{1.04}-1\)</span>,则( )</p><p><span class="math inline">\(A.a<b<c\qquad\)</span> <spanclass="math inline">\(B.b<c<a\qquad\)</span> <spanclass="math inline">\(C.b<a<c\qquad\)</span> <spanclass="math inline">\(D.c<a<b\)</span></p> </div><div class="note note-success"> <p>解:<span class="math inline">\(a=\ln1.0201>b\)</span>,比较<spanclass="math inline">\(b\)</span>和<spanclass="math inline">\(c\)</span>,注意到<spanclass="math inline">\(1.04=1.02\times2-1\)</span>,构造<spanclass="math inline">\(f(x)=\ln x-\sqrt{2x-1}+1\)</span></p><p><spanclass="math inline">\(f'(x)=\dfrac{\sqrt{2x-1}-x}{x\sqrt{2x-1}}\le0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\([1,+\infty)\)</span>单减,于是<spanclass="math inline">\(f(1.02)<f(1)=0\)</span>,即<spanclass="math inline">\(b<c\)</span></p><p>比较<span class="math inline">\(a\)</span>和<spanclass="math inline">\(c\)</span>,构造<spanclass="math inline">\(g(x)=2\ln x-\sqrt{4x-3}+1\)</span>,<spanclass="math inline">\(g'(x)=\dfrac{2(\sqrt{4x-3}-x)}{x\sqrt{4x-3}}\)</span></p><p>令<span class="math inline">\(g'(x)>0\)</span>得<spanclass="math inline">\(x\in(1,3)\)</span>,于是<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((1,3)\)</span>单增,则<spanclass="math inline">\(g(1.01)>g(1)=0\)</span>,即<spanclass="math inline">\(a>c\)</span></p> </div>]]></content>
<categories>
<category>数学</category>
<category>导数</category>
</categories>
</entry>
<entry>
<title>docker安装joomla</title>
<link href="/2022/06/05/docker%E5%AE%89%E8%A3%85joomla/"/>
<url>/2022/06/05/docker%E5%AE%89%E8%A3%85joomla/</url>
<content type="html"><![CDATA[<h1 id="手动安装">手动安装</h1><h2 id="创建数据库和joomla共用网络">创建数据库和joomla共用网络</h2><figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">docker network create mariadb-network</span><br><span class="hljs-attribute">docker inspect mariadb-network</span><br></code></pre></td></tr></table></figure><h2 id="创建映射目录">创建映射目录</h2><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs awk">mkdir <span class="hljs-regexp">/opt/</span>joomla<br>mkdir <span class="hljs-regexp">/opt/m</span>ariadb<br></code></pre></td></tr></table></figure><h2 id="创建mariadb数据库">创建mariadb数据库</h2><figure class="highlight gradle"><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><code class="hljs gradle">docker run -d --name mariadb --network mariadb-network -v <span class="hljs-regexp">/opt/m</span>ariadb:<span class="hljs-regexp">/var/</span>lib/mysql --env MARIADB_ROOT_PASSWORD=yourpassword mariadb:latest<br>docker <span class="hljs-keyword">inspect</span> mariadb | <span class="hljs-keyword">grep</span> -i <span class="hljs-string">'ipaddress'</span><br>docker logs mariadb<br></code></pre></td></tr></table></figure><h2 id="创建joomla">创建joomla</h2><figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs routeros">docker <span class="hljs-builtin-name">run</span> -d --name joomla -p 8080:80 -v /opt/joomla:/var/www/html --network mariadb-network -e <span class="hljs-attribute">JOOMLA_DB_HOST</span>=mariadb -e <span class="hljs-attribute">JOOMLA_DB_USER</span>=root -e <span class="hljs-attribute">JOOMLA_DB_PASSWORD</span>=yourmariadbpassword joomla<br>docker logs joomla<br></code></pre></td></tr></table></figure><h1id="docker-compose数据库一体化安装">docker-compose数据库一体化安装</h1><h2 id="创建docker-compose.yml">创建docker-compose.yml</h2><figure class="highlight yaml"><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><code class="hljs yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3.1'</span><br><br><span class="hljs-attr">services:</span><br> <span class="hljs-attr">joomla:</span><br> <span class="hljs-attr">image:</span> <span class="hljs-string">joomla</span><br> <span class="hljs-attr">container_name:</span> <span class="hljs-string">joomla</span><br> <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br> <span class="hljs-attr">links:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-string">joomladb:mysql</span><br> <span class="hljs-attr">ports:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-number">8080</span><span class="hljs-string">:80</span><br> <span class="hljs-attr">environment:</span><br> <span class="hljs-attr">JOOMLA_DB_HOST:</span> <span class="hljs-string">joomladb</span><br> <span class="hljs-attr">JOOMLA_DB_PASSWORD:</span> <span class="hljs-string">your_password(same</span> <span class="hljs-string">as</span> <span class="hljs-string">below)</span><br><br> <span class="hljs-attr">joomladb:</span><br> <span class="hljs-attr">image:</span> <span class="hljs-string">mysql:5.6</span><br> <span class="hljs-attr">container_name:</span> <span class="hljs-string">mysql</span><br> <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span><br> <span class="hljs-attr">environment:</span><br> <span class="hljs-attr">MYSQL_ROOT_PASSWORD:</span> <span class="hljs-string">your_password(same</span> <span class="hljs-string">as</span> <span class="hljs-string">above)</span><br></code></pre></td></tr></table></figure><h1 id="启动容器">启动容器</h1><figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">docker-compose up -d</span><br></code></pre></td></tr></table></figure><h1 id="查看容器启动日志">查看容器启动日志</h1><figure class="highlight ebnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs ebnf"><span class="hljs-attribute">docker logs joomla</span><br><span class="hljs-attribute">docker logs mysql</span><br></code></pre></td></tr></table></figure><h2 id="查看容器ip">查看容器ip</h2><figure class="highlight handlebars"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs handlebars"><span class="xml">docker inspect -f '</span><span class="hljs-template-variable">{{<span class="hljs-name">range</span> .NetworkSettings.Networks}}</span><span class="hljs-template-variable">{{<span class="hljs-name">.IPAddress</span>}}</span><span class="hljs-template-variable">{{<span class="hljs-name">end</span>}}</span><span class="xml">' <span class="hljs-tag"><<span class="hljs-name">container_name</span>></span></span><br></code></pre></td></tr></table></figure><p>或者查看全面信息</p><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs xml">docker inspect <span class="hljs-tag"><<span class="hljs-name">container_name</span>></span><br></code></pre></td></tr></table></figure><p>查看mysql的ip地址下一步备用</p><figure class="highlight handlebars"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs handlebars"><span class="xml">docker inspect -f '</span><span class="hljs-template-variable">{{<span class="hljs-name">range</span> .NetworkSettings.Networks}}</span><span class="hljs-template-variable">{{<span class="hljs-name">.IPAddress</span>}}</span><span class="hljs-template-variable">{{<span class="hljs-name">end</span>}}</span><span class="xml">' mysql</span><br></code></pre></td></tr></table></figure><h1 id="安装joomla">安装joomla</h1><p>访问<code>http://ip:8080</code>进入安装界面,其中关键的步骤是设置数据库的地址为上一步获取的ip地址,用户名为<code>root</code>,密码为<code>docker-compose</code>里面设置好的密码,其它网站设置根据自己情况填写即可。</p>]]></content>
<tags>
<tag>docker</tag>
</tags>
</entry>
<entry>
<title>cdn.jsdelivr.net被墙</title>
<link href="/2022/06/01/cdn-jsdelivr-net%E8%A2%AB%E5%A2%99/"/>
<url>/2022/06/01/cdn-jsdelivr-net%E8%A2%AB%E5%A2%99/</url>
<content type="html"><![CDATA[<p>5月16日,cdn.jsdelivr.net被墙,至此加速github成为历史;</p><p>临时解决方案:将cdn.jsdelivr.net更改为fastly.jsdelivr.net,不知道会不会留活口给jsdelivr</p><p>同时受到影响的还有静态资源mathjax的解析服务,目前替换为了https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.1</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>cdn</tag>
</tags>
</entry>
<entry>
<title>2021T8联考数学22导数题</title>
<link href="/2022/05/13/2021T8%E8%81%94%E8%80%83%E6%95%B0%E5%AD%A622%E5%AF%BC%E6%95%B0%E9%A2%98/"/>
<url>/2022/05/13/2021T8%E8%81%94%E8%80%83%E6%95%B0%E5%AD%A622%E5%AF%BC%E6%95%B0%E9%A2%98/</url>
<content type="html"><![CDATA[<div class="note note-primary"> <p>已知函数<span class="math inline">\(f(x)=a\ln x-\sinx+x\)</span>,其中<span class="math inline">\(a\)</span>为非零常数.</p><p>(1)若函数<span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,+\infty)\)</span>上单调递增,求<spanclass="math inline">\(a\)</span>的取值范围;</p><p>(2)设<spanclass="math inline">\(\theta\in(\pi,\dfrac{3}{2}\pi)\)</span>,且<spanclass="math inline">\(\cos\theta=1+\theta\sin\theta\)</span>,证明:当<spanclass="math inline">\(\theta^2\sin\theta<a<0\)</span>时,函数<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,2\pi)\)</span>上恰有两个极值点.</p> </div><div class="note note-success"> <p><font color=deepskyblue>解析:</font>(2)<spanclass="math inline">\(f'(x)=\dfrac{a}{x}-\cos x+1=\dfrac{a-x\cosx+x}{x}\)</span></p><p>设<span class="math inline">\(g(x)=x\cos{x}-x\)</span>,注意到<spanclass="math inline">\(g(0)=g(2\pi)=0\)</span>,并且<spanclass="math inline">\(g(\theta)=\theta\cos\theta-\theta=\theta^2\sin\theta\)</span>,该值恰好是条件<span class="math inline">\(\theta^2\sin\theta<a<0\)</span>的端点值,为了使得<spanclass="math inline">\(g(x)=a\)</span>有两个解,因此我们推测<spanclass="math inline">\(g(x)\)</span>的图像应该如图所示:</p><p><img src="https://cdn.jsdelivr.net/gh/andyppang/mdpic/pic/20220513235040.png" style="zoom:67%;" /></p><p>于是需要说明<span class="math inline">\(g(x)\)</span>在<spanclass="math inline">\((0,\theta)\)</span>单减,<spanclass="math inline">\((\theta,2\pi)\)</span>单增,为此研究<spanclass="math inline">\(g'(x)=\cos x-x\sin x-1\)</span>,注意到<spanclass="math inline">\(g'(0)=g'(2\pi)=0\)</span>,<spanclass="math inline">\(g'(\theta)=\cos\theta-\theta\sin\theta-1=0\)</span>,因此我们推测<spanclass="math inline">\(g'(x)\)</span>的图象应该如图所示:</p><p><img src="https://cdn.jsdelivr.net/gh/andyppang/mdpic/pic/20220513235246.png" style="zoom:67%;" /></p><p>于是需要说明<spanclass="math inline">\(x\in(0,\theta)\)</span>时,<spanclass="math inline">\(g'(x)<0\)</span>,<spanclass="math inline">\(x\in(\theta,2\pi)\)</span>时,<spanclass="math inline">\(g'(x)>0\)</span>.但是我们只能方便证明<spanclass="math inline">\(x\in(0,\pi)\)</span>时,<spanclass="math inline">\(g'(x)=\cos x-1-x\sinx<0\)</span>,为了证明其它区间<spanclass="math inline">\(g'(x)\)</span>的符号,需要结合<spanclass="math inline">\(g'(x)\)</span>的单调性,也就是要说明<spanclass="math inline">\(g'(x)\)</span>在<spanclass="math inline">\((0,x_1)\)</span>单减,<spanclass="math inline">\((x_1,x_2)\)</span>单增,<spanclass="math inline">\((x_2,2\pi)\)</span>单减,为此研究<spanclass="math inline">\(g''(x)=-2\sin x-x\cosx\)</span>,注意到<spanclass="math inline">\(g''(0)=0,g''(\dfrac{3\pi}{2})=2,g''(2\pi)=-2\pi\)</span>,因此我们推测<spanclass="math inline">\(g''(x)\)</span>的图象应该如图所示:</p><p><imgsrc="https://cdn.jsdelivr.net/gh/andyppang/mdpic/pic/20220513235328.png" /></p><p>当<spanclass="math inline">\(x\in(\pi,\dfrac{3\pi}{2})\)</span>时,<spanclass="math inline">\(g''(x)=-2\sin x-x\cosx>0\)</span>,于是<spanclass="math inline">\(g'(x)\)</span>在<spanclass="math inline">\((\pi,\dfrac{3\pi}{2})\)</span>单增,由于<spanclass="math inline">\(g'(\theta)=0\)</span>,那么<spanclass="math inline">\(x\in(\pi,\theta)\)</span>时,<spanclass="math inline">\(g'(\theta)<0\)</span>,<spanclass="math inline">\(x\in(\theta,\dfrac{3\pi}{2})\)</span>时,<spanclass="math inline">\(g'(\theta)>0\)</span>,至此<spanclass="math inline">\(x\in(0,\theta)\)</span>时,<spanclass="math inline">\(g'(x)<0\)</span>说明完毕,接下来只需要证明<spanclass="math inline">\(x\in(\dfrac{3\pi}{2},2\pi)\)</span>时,<spanclass="math inline">\(g'(x)>0\)</span>即可,只需要说明<spanclass="math inline">\(g'(x)\)</span>在<spanclass="math inline">\((\dfrac{3\pi}{2},x_2)\)</span>单增,亦即<spanclass="math inline">\(g''(x)>0\)</span>, <spanclass="math inline">\(g'(x)\)</span>在<spanclass="math inline">\((x_2,2\pi)\)</span>单减,亦即<spanclass="math inline">\(g''(x)<0\)</span>,于是需要借助<spanclass="math inline">\(g''(x)\)</span>的单调性,再次求导<spanclass="math inline">\(g'''(x)=-3\cos x+x\sinx\)</span>,惊喜发现<spanclass="math inline">\(x\in(\dfrac{3\pi}{2},2\pi)\)</span>时,<spanclass="math inline">\(g'''(x)<0\)</span>,因此<spanclass="math inline">\(g''(x)\)</span>在<spanclass="math inline">\(x\in(\dfrac{3\pi}{2},2\pi)\)</span>单减,由于<spanclass="math inline">\(g''(\dfrac{3\pi}{2})=2,g''(2\pi)=-2\pi\)</span>,于是<spanclass="math inline">\(\existsx_2\in(\dfrac{3\pi}{2},2\pi)\)</span>使得<spanclass="math inline">\(g''(x_2)=0\)</span>,至此思路全部打通。</p><p>最终正常顺序简述为:</p><p><imgsrc="https://cdn.jsdelivr.net/gh/andyppang/mdpic/pic/20220513235609.png" /></p><p>本题以单调性为主线(红色部分),采取分段证明的策略,每次求导都能容易看到在部分区间上导数的符号(绿色部分),然后结合特殊点处的函数值(黄色部分),判断各导函数是否存在零点,从而决定上级导函数的单调性。</p> </div>]]></content>
<categories>
<category>数学</category>
<category>导数</category>
</categories>
<tags>
<tag>导数</tag>
<tag>零点问题</tag>
</tags>
</entry>
<entry>
<title>因式分解背后的主元思想</title>
<link href="/2022/03/14/%E5%9B%A0%E5%BC%8F%E5%88%86%E8%A7%A3%E8%83%8C%E5%90%8E%E7%9A%84%E4%B8%BB%E5%85%83%E6%80%9D%E6%83%B3/"/>
<url>/2022/03/14/%E5%9B%A0%E5%BC%8F%E5%88%86%E8%A7%A3%E8%83%8C%E5%90%8E%E7%9A%84%E4%B8%BB%E5%85%83%E6%80%9D%E6%83%B3/</url>
<content type="html"><![CDATA[<p>题目:若<span class="math inline">\(f(x)=\dfrac{1}{2}x^2+b\lnx+ax\)</span>在<spanclass="math inline">\((1,2)\)</span>内有两个极值点,则<spanclass="math inline">\(b(3a+b+9)\)</span>的取值范围是___</p><p><font color=deepskyblue>解析:</font> <spanclass="math inline">\(f'(x)=\dfrac{x^2+ax+b}{x}\)</span>,则<spanclass="math inline">\(x^2+ax+b=0\)</span>在<spanclass="math inline">\((1,2)\)</span>有两个不相等的实数根,设为<spanclass="math inline">\(x_1,x_2\)</span>,于是 <spanclass="math display">\[\begin{cases}x_1+x_2=-a\\x_1x_2=b\end{cases}\]</span> 则<spanclass="math inline">\(b(3a+b+9)=x_1x_2(-3x_1-3x_2+x_1x_2+9)\)</span></p><p>由于注意到<span class="math inline">\(x_1,x_2\)</span>是可以在<spanclass="math inline">\((1,2)\)</span>内任意互不影响的任意发生变化的,也就是说二者是相互独立的变量,因此对于上式就是一个<strong>独立双变量的范围问题</strong>,那么就可以采用<strong>主元法</strong>进行求解,不妨<strong>选定<spanclass="math inline">\(x_1\)</span>为主元对上式进行整理</strong>: <spanclass="math display">\[\begin{aligned}&\quad x_1x_2(-3x_1-3x_2+x_1x_2+9)\\&=(x_2^2-3x_2)x_1^2-(3x_2^2-9x_2)x_1\\&=x_2(x_2-3)x_1^2-3x_2(x_2-3)x_1\\&=x_2(x_2-3)(x_1^2-3x_1)\\&=(x_2^2-3x_2)(x_1^2-3x_1)\end{aligned}\]</span> 没想到整理出来了一个<spanclass="math inline">\(x_1,x_2\)</span>不再缠绵的一个式子,那就只需要求出各自的范围就好了</p><p>由于<span class="math inline">\(x_1\in(1,2)\)</span>,则<spanclass="math inline">\(x_1^2-3x_1\in[-\dfrac{9}{4},-2)\)</span>,同理<spanclass="math inline">\(x_2^2-3x_2\in[-\dfrac{9}{4},-2)\)</span>,但是由于<spanclass="math inline">\(x_1\ne x_2\)</span></p><p>则<spanclass="math inline">\((x_2^2-3x_2)(x_1^2-3x_1)\in(4,\dfrac{81}{16})\)</span></p>]]></content>
<categories>
<category>数学</category>
</categories>
<tags>
<tag>主元法</tag>
</tags>
</entry>
<entry>
<title>相关系数</title>
<link href="/2022/03/03/%E7%9B%B8%E5%85%B3%E7%B3%BB%E6%95%B0/"/>
<url>/2022/03/03/%E7%9B%B8%E5%85%B3%E7%B3%BB%E6%95%B0/</url>
<content type="html"><![CDATA[<p><strong>相关系数的引入理解</strong></p><p>对于成对数据的相关性强弱问题,可以从定性的角度观察散点图直观的感知,当然定量进行研究就需要引入一个新的量——相关系数</p><p>对于数据</p><p><span class="math display">\[(x_1,y_1),(x_2,y_2),...,(x_n,y_n)\]</span></p><ul><li>进行“中心化”处理:先将其平移到以<spanclass="math inline">\((\overline{x},\overline{y})\)</span>为中心的坐标系下,得到一组新的数据</li></ul><p><span class="math display">\[(x_1-\overline{x},y_1-\overline{y}),(x_2-\overline{x},y_2-\overline{y}),...,(x_n-\overline{x},y_n-\overline{y})\]</span></p><ul><li><p>中心化处理对散点图的影响:正相关的散点图平移后,大部分点分布在一、三象限;负相关的散点图平移后,大部分点分布在二、四象限。</p></li><li><p>中心化处理对回归直线的影响:由于回归直线一定经过<spanclass="math inline">\((\overline{x},\overline{y})\)</span>,则平移后的回归直线一定经过原点<spanclass="math inline">\((0,0)\)</span>,假设所有的点都在回归直线上,即相关性最强(函数关系),因此有</p></li></ul><p><span class="math display">\[y_i-\overline{y}=k(x_i-\overline{x})\]</span></p><p>也就是说对于以下两个<spanclass="math inline">\(n\)</span>维向量共线</p><p><span class="math display">\[\overrightarrow{X}=(x_1-\overline{x},x_2-\overline{x},...,x_n-\overline{x})\\\overrightarrow{Y}=(y_1-\overline{y},y_2-\overline{y},...,y_n-\overline{y})\]</span></p><p>倘若有些点不在回归直线上,则会造成以上两个向量的不共线,使得两个向量之间产生夹角<spanclass="math inline">\(\theta\)</span>,因此我们可以用夹角<spanclass="math inline">\(\theta\)</span>大小来衡量相关程度的强弱:显然若<spanclass="math inline">\(\theta=0^{\circ}\)</span>,则正相关性最强;若<spanclass="math inline">\(\theta=180^{\circ}\)</span>,则负相关性最强</p><p><span class="math display">\[r=\cos\theta=\dfrac{\sum\limits_{i=1}^n(x_i-\overline{x})(y_i-\overline{y})}{\sqrt{\sum\limits_{i=1}^n(x_i-\overline{x})^2}\cdot\sqrt{\sum\limits_{i=1}^n(y_i-\overline{y})^2}}\]</span></p><p><strong>相关系数的取值范围及意义:</strong></p><p><span class="math inline">\(r\in[-1,1]\)</span></p><p><span class="math inline">\(r=0\)</span>表示没有相关关系</p><p><span class="math inline">\(|r|=1\)</span>表示函数关系</p><p><span class="math inline">\(|r|\)</span>越大,则相关性越强</p><p><strong>相关系数与回归直线斜率<spanclass="math inline">\(\widehat{b}\)</span>的关系:</strong></p><p><span class="math display">\[\widehat{b}=\dfrac{\overrightarrow{X}\cdot\overrightarrow{Y}}{|\overrightarrow{X}|^2}=\dfrac{|\overrightarrow{X}||\overrightarrow{Y}|\cos\theta}{|\overrightarrow{X}|^2}=r\cdot \dfrac{\sigma_y}{\sigma_x}\]</span></p>]]></content>
<categories>
<category>数学</category>
</categories>
<tags>
<tag>回归分析</tag>
</tags>
</entry>
<entry>
<title>测试Windows下写博客</title>
<link href="/2022/03/01/testwindows/"/>
<url>/2022/03/01/testwindows/</url>
<content type="html"><![CDATA[<p>这是windows7环境下,安装了git + nodejs + pandoc + hexo,然后写下的测试篇。</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>windows</tag>
</tags>
</entry>
<entry>
<title>远程桌面控制软件Rustdesk</title>
<link href="/2021/07/09/%E8%BF%9C%E7%A8%8B%E6%A1%8C%E9%9D%A2%E6%8E%A7%E5%88%B6%E8%BD%AF%E4%BB%B6Rustdesk/"/>
<url>/2021/07/09/%E8%BF%9C%E7%A8%8B%E6%A1%8C%E9%9D%A2%E6%8E%A7%E5%88%B6%E8%BD%AF%E4%BB%B6Rustdesk/</url>
<content type="html"><![CDATA[<h2 id="下载地址">下载地址</h2><p>在控制端和主机端都下载好</p><p>1.如果是windows桌面版需要先下载dll动态库</p><p><ahref="https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.win/x64/sciter.dll">点击下载</a></p><p>2.下载软件本体</p><p><ahref="https://github.com/rustdesk/rustdesk/releases">点击下载</a></p><h2 id="使用教程">使用教程</h2><p>1.将下载到的sciter.dll放入 <code>c:\windows\system32</code>文件夹下</p><p>2.打开主程序,找到id和密码就可以连接了,密码可以修改为自己的</p><p>3.如果是手机端控制直接<ahref="https://github.com/rustdesk/rustdesk/releases/download/1.1.6/rustdesk-1.1.6.apk">下载apk</a>即可</p><h2 id="横向比较">横向比较</h2><p>目前在用的是 <code>zerotier</code>,如果是就在本市家里和公司连接的话,还是非常快的,基本没有卡顿感,也就是说rustdesk的连接速度稍逊一筹,其公用主机的地址目前有3个:首尔,新加坡,达拉斯,支持自定义自己的服务器。但是作为备胎,替换掉原来的备胎<code>Todesk</code> 。</p><h2 id="github项目地址">Github项目地址</h2><p><a href="https://github.com/rustdesk/rustdesk">github项目地址</a></p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>Rustdesk</tag>
</tags>
</entry>
<entry>
<title>2021全国乙卷第12,20,21题解</title>
<link href="/2021/06/26/2021%E5%85%A8%E5%9B%BD%E4%B9%99%E5%8D%B7%E7%AC%AC12%EF%BC%8C20%EF%BC%8C21%E9%A2%98%E8%A7%A3/"/>
<url>/2021/06/26/2021%E5%85%A8%E5%9B%BD%E4%B9%99%E5%8D%B7%E7%AC%AC12%EF%BC%8C20%EF%BC%8C21%E9%A2%98%E8%A7%A3/</url>
<content type="html"><![CDATA[<h2 id="全国乙卷">2021全国乙卷</h2><p>12.设<span class="math inline">\(a=2\ln1.01\)</span>,<spanclass="math inline">\(b=\ln1.02\)</span>,<spanclass="math inline">\(c=\sqrt{1.04}-1\)</span>,则( )</p><p><span class="math inline">\(A.a<b<c\qquad\)</span> <spanclass="math inline">\(B.b<c<a\qquad\)</span> <spanclass="math inline">\(C.b<a<c\qquad\)</span> <spanclass="math inline">\(D.c<a<b\)</span></p><p>解:<span class="math inline">\(a=\ln1.0201>b\)</span>,比较<spanclass="math inline">\(b\)</span>和<spanclass="math inline">\(c\)</span>,注意到<spanclass="math inline">\(1.04=1.02\times2-1\)</span>,构造<spanclass="math inline">\(f(x)=\ln x-\sqrt{2x-1}+1\)</span></p><p><spanclass="math inline">\(f'(x)=\dfrac{\sqrt{2x-1}-x}{x\sqrt{2x-1}}\le0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\([1,+\infty)\)</span>单减,于是<spanclass="math inline">\(f(1.02)<f(1)=0\)</span>,即<spanclass="math inline">\(b<c\)</span></p><p>比较<span class="math inline">\(a\)</span>和<spanclass="math inline">\(c\)</span>,构造<spanclass="math inline">\(g(x)=2\ln x-\sqrt{4x-3}+1\)</span>,<spanclass="math inline">\(g'(x)=\dfrac{2(\sqrt{4x-3}-x)}{x\sqrt{4x-3}}\)</span></p><p>令<span class="math inline">\(g'(x)>0\)</span>得<spanclass="math inline">\(x\in(1,3)\)</span>,于是<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((1,3)\)</span>单增,则<spanclass="math inline">\(g(1.01)>g(1)=0\)</span>,即<spanclass="math inline">\(a>c\)</span></p><p>20.设函数<spanclass="math inline">\(f(x)=\ln(a-x)\)</span>,已知<spanclass="math inline">\(x=0\)</span>是函数<spanclass="math inline">\(y=xf(x)\)</span>的极值点.</p><p>(1)求<span class="math inline">\(a\)</span>;</p><p>(2)设函数<spanclass="math inline">\(g(x)=\dfrac{x+f(x)}{xf(x)}\)</span>,证明<spanclass="math inline">\(g(x)<1\)</span></p><p>解:(1)<span class="math inline">\(a=1\)</span></p><p>(2)<span class="math inline">\(g(x)\)</span>的定义域是<spanclass="math inline">\((-\infty,0)\cup (0,1)\)</span>,即证<spanclass="math inline">\(\dfrac{x+\ln(1-x)}{x\ln(1-x)}<1\)</span>,注意到<spanclass="math inline">\(x\ln(1-x)<0\)</span></p><p>即证<spanclass="math inline">\(x+(1-x)\ln(1-x)>0\)</span>,即证<spanclass="math inline">\(h(x)=\dfrac{x}{1-x}+\ln(1-x)>0\)</span></p><p><spanclass="math inline">\(h'(x)=\dfrac{x}{(1-x)^2}\)</span>,则<spanclass="math inline">\(h(x)\)</span>在<spanclass="math inline">\((-\infty,0)\)</span>单减,<spanclass="math inline">\((0,1)\)</span>单增,而<spanclass="math inline">\(h(0)=0\)</span></p><p>则当<spanclass="math inline">\(x\in(-\infty,0)\cup(0,1)\)</span>时,<spanclass="math inline">\(h(x)>0\)</span>,得证</p><p>21.已知抛物线<spanclass="math inline">\(C:x^2=2py(p>0)\)</span>的焦点为<spanclass="math inline">\(F\)</span>,且<spanclass="math inline">\(F\)</span>与圆<spanclass="math inline">\(M:x^2+(y+4)^2=1\)</span>上点的距离的最小值为4</p><p>(1)求<span class="math inline">\(p\)</span>;</p><p>(2)若点<span class="math inline">\(P\)</span>在<spanclass="math inline">\(M\)</span>上,<spanclass="math inline">\(PA,PB\)</span>是<spanclass="math inline">\(C\)</span>的两条切线,<spanclass="math inline">\(A,B\)</span>是切点,求<spanclass="math inline">\(\triangle PAB\)</span>面积的最大值.</p><p>解:(1)<span class="math inline">\(p=2\)</span></p><p><img src="https://gitee.com/andypl/imagehost/raw/master/img/Snipaste_2021-06-25_15-12-47.png" style="zoom:67%;" /></p><p>(2)设<spanclass="math inline">\(A(x_1,\dfrac{1}{4}x_1^2),B(x_2,\dfrac{1}{4}x_2^2)\)</span>,过<spanclass="math inline">\(A\)</span>的切线<spanclass="math inline">\(l_1:y=\dfrac{1}{2}x_1x-\dfrac{1}{4}x_1^2\)</span></p><p>同理过<span class="math inline">\(B\)</span>的切线<spanclass="math inline">\(l_2:y=\dfrac{1}{2}x_2x-\dfrac{1}{4}x_2^2\)</span>,联立求得<spanclass="math inline">\(P(\dfrac{x_1+x_2}{2},\dfrac{1}{4}x_1x_2)\)</span></p><p>又过<span class="math inline">\(A\)</span>B的直线方程为<spanclass="math inline">\(y=\dfrac{\frac{1}{4}x_2^2-\frac{1}{4}x_1^2}{x_2-x_1}(x-x_1)+\dfrac{1}{4}x_1^2\)</span>,即<spanclass="math inline">\(y=\dfrac{1}{4}(x_1+x_2)x-\dfrac{1}{4}x_1x_2\)</span></p><p>则<span class="math inline">\(AB\)</span>中点为<spanclass="math inline">\(M(\dfrac{x_1+x_2}{2},\dfrac{x_1^2+x_2^2}{8})\)</span>,连接<spanclass="math inline">\(PM\)</span>,则</p><p><span class="math inline">\(S_{\trianglePAB}=\dfrac{1}{2}|PM|\cdot|x_2-x_1|=\dfrac{(x_2-x_1)^3}{16}\)</span></p><p>记<spanclass="math inline">\(P(\dfrac{x_1+x_2}{2},\dfrac{1}{4}x_1x_2)=(x_0,y_0)\)</span>,则<spanclass="math inline">\((x_2-x_1)^2=(x_1+x_2)^2-4x_1x_2=4x_0^2-16y_0\)</span></p><p>由于<span class="math inline">\(x_0^2+(y_0+4)^2=1\)</span>,则<spanclass="math inline">\(4x_0^2-16y_0=-4y_0^2-48y_0-60\)</span></p><p>于是<span class="math inline">\(S_{\trianglePAB}=\dfrac{(x_2-x_1)^3}{16}=\dfrac{(-4y_0^2-48y_0-60)^\frac{3}{2}}{16},y_0\in[-5,-3]\)</span></p><p>则当<span class="math inline">\(y_0=-5\)</span>时,<spanclass="math inline">\(S_{\triangle PAB}\)</span>的最大值为<spanclass="math inline">\(20\sqrt5\)</span></p>]]></content>
<categories>
<category>数学</category>
<category>高考题</category>
</categories>
<tags>
<tag>高考题</tag>
</tags>
</entry>
<entry>
<title>2021新高考2卷部分试题解析</title>
<link href="/2021/06/22/2021%E6%96%B0%E9%AB%98%E8%80%832%E5%8D%B7%E9%83%A8%E5%88%86%E8%AF%95%E9%A2%98%E8%A7%A3%E6%9E%90/"/>
<url>/2021/06/22/2021%E6%96%B0%E9%AB%98%E8%80%832%E5%8D%B7%E9%83%A8%E5%88%86%E8%AF%95%E9%A2%98%E8%A7%A3%E6%9E%90/</url>
<content type="html"><![CDATA[<h2 id="新高考全国2卷">2021新高考全国2卷</h2><p>11.已知直线<spanclass="math inline">\(l:ax+by-r^2=0\)</span>与圆<spanclass="math inline">\(C:x^2+y^2=r^2\)</span>,点<spanclass="math inline">\(A(a,b)\)</span>,则下列说法正确的是( )</p><p><span class="math inline">\(A.\)</span>若点<spanclass="math inline">\(A\)</span>在圆<spanclass="math inline">\(C\)</span>上,则直线<spanclass="math inline">\(l\)</span>与圆<spanclass="math inline">\(C\)</span>相切</p><p><span class="math inline">\(B.\)</span>若点<spanclass="math inline">\(A\)</span>在圆<spanclass="math inline">\(C\)</span>内,则直线<spanclass="math inline">\(l\)</span>与圆<spanclass="math inline">\(C\)</span>相离</p><p><span class="math inline">\(C.\)</span>若点<spanclass="math inline">\(A\)</span>在圆<spanclass="math inline">\(C\)</span>外,则直线<spanclass="math inline">\(l\)</span>与圆<spanclass="math inline">\(C\)</span>相离</p><p><span class="math inline">\(D.\)</span>若点<spanclass="math inline">\(A\)</span>在直线<spanclass="math inline">\(l\)</span>上,则直线<spanclass="math inline">\(l\)</span>与圆<spanclass="math inline">\(C\)</span>相切</p><p>解:<span class="math inline">\(ABD\)</span></p><p>12.设正整数<spanclass="math inline">\(n=a_0\cdot2^0+a_1\cdot2+\cdots+a_{k-1}\cdot2^{k-1}+a_k\cdot2^k\)</span>,其中<spanclass="math inline">\(a_i\in\{0,1\}\)</span>,记<spanclass="math inline">\(\omega(n)=a_0+a_1+\cdots+a_k\)</span>,则( )</p><p><span class="math inline">\(A.\omega(2n)=\omega(n)\qquad\)</span><spanclass="math inline">\(B.\omega(2n+3)=\omega(n)+1\qquad\)</span></p><p><spanclass="math inline">\(C.\omega(8n+5)=\omega(4n+3)\qquad\)</span> <spanclass="math inline">\(D.\omega(2^n-1)=n\)</span></p><p>解:方法一:取二进制的特殊值,利用运算验证,略</p><p>方法二:<spanclass="math inline">\(n=a_0\cdot2^0+a_1\cdot2+\cdots+a_{k-1}\cdot2^{k-1}+a_k\cdot2^k=(a_ka_{k-1}...a_{0})_2\)</span></p><p>对于<span class="math inline">\(A\)</span>,<spanclass="math inline">\(2n=0\cdot2^0+a_0\cdot2+a_1\cdot2^2+\cdots+a_{k-1}\cdot2^k+a_k\cdot2^{k+1}=(a_ka_{k-1}a_00)_2\)</span>,则<spanclass="math inline">\(A\)</span>正确</p><p>对于<span class="math inline">\(B\)</span>,<spanclass="math inline">\(2n+3=1\cdot2^0+(a_0+1)\cdot2+a_1\cdot2^2+\cdots+a_{k-1}\cdot2^k+a_k\cdot2^{k+1}\)</span>,若<spanclass="math inline">\(a_0=0\)</span>,则<spanclass="math inline">\(\omega(2n+3)=\omega(n)+2\)</span>,<spanclass="math inline">\(B\)</span>错</p><p>对于<span class="math inline">\(C\)</span>,<spanclass="math inline">\(8n+5=1\cdot2^0+0\cdot2^1+1\cdot2^2+a_0\cdot2^3+a_1\cdot2^4+\cdots+a_{k-1}\cdot2^{k+2}+a_k\cdot2^{k+3}=(a_ka_{k-1}...a_0101)_2\)</span></p><p><spanclass="math inline">\(4n+3=1\cdot2^0+1\cdot2^1+a_0\cdot2^2+a_1\cdot2^3+\cdots+a_{k-1}\cdot2^{k+1}+a_k\cdot2^{k+2}=(a_ka_{k-1}...a_011)_2\)</span>,则<spanclass="math inline">\(C\)</span>正确</p><p>对于<span class="math inline">\(D\)</span>,<spanclass="math inline">\(2^n-1=2^0+2^1+2^2+\cdots+2^{n-1}=(11...1)_2\)</span>,则<spanclass="math inline">\(D\)</span>正确</p><p>直接从二进制运算的角度理解:</p><p>从<spanclass="math inline">\(n=a_0\cdot2^0+a_1\cdot2+\cdots+a_{k-1}\cdot2^{k-1}+a_k\cdot2^k=(a_ka_{k-1}...a_{0})_2\)</span></p><p><spanclass="math inline">\(2n=0\cdot2^0+a_0\cdot2+a_1\cdot2^2+\cdots+a_{k-1}\cdot2^k+a_k\cdot2^{k+1}=(a_ka_{k-1}a_00)_2\)</span></p><p><spanclass="math inline">\(4n=0\cdot2^0+0\cdot2^1+a_0\cdot2^2+a_1\cdot2^3+\cdots+a_{k-1}\cdot2^{k+1}+a_k\cdot2^{k+2}=(a_ka_{k-1}a_000)_2\)</span></p><p>可以看出对于二进制数,每次乘以2以后,就在后面加了个0,因此<spanclass="math inline">\(\omega(n)=\omega(2n)=\cdots=\omega(2^kn),k\in\mathbb{N}\)</span></p><p>对于<span class="math inline">\(C\)</span>,<spanclass="math inline">\(8n+5=(...000)_2+(101)_2=(...101)_2\)</span>,则<spanclass="math inline">\(\omega(8n+5)=\omega(8n)+2=\omega(n)+2\)</span></p><p><spanclass="math inline">\(4n+3=(...00)_2+(11)_2=(...11)_2\)</span>,则<spanclass="math inline">\(\omega(4n+3)=\omega(4n)+2=\omega(n)+2\)</span></p><p>对于<span class="math inline">\(D\)</span>,<spanclass="math inline">\(2^n-1=(1后面n个0)_2-(1)_2=(n个1)_2\)</span>,则<spanclass="math inline">\(\omega(2^n-1)=n\)</span></p><p>对于<span class="math inline">\(B\)</span>,若<spanclass="math inline">\(n=2t\)</span>,则<spanclass="math inline">\(2n+3=4t+3=(...00)_2+(11)_2=(...11)_2\)</span>,</p><p>因此<spanclass="math inline">\(\omega(2n+3)=\omega(2n)+2=\omega(n)+2\)</span></p><p>若<span class="math inline">\(n=2t-1\)</span>,则<spanclass="math inline">\(2n+3=4t+1=(...00)_2+(1)_2=(...01)_2\)</span>,</p><p>因此<spanclass="math inline">\(\omega(2n+3)=\omega(4t)+1=\omega(t)+1\)</span>,若<spanclass="math inline">\(\omega(t)+1=\omega(n)+1=\omega(2t-1)+1\)</span>,则<spanclass="math inline">\(t=1\)</span>时<spanclass="math inline">\(B\)</span>才正确</p><p>15.已知向量<spanclass="math inline">\(\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c}=0\)</span>,<spanclass="math inline">\(|\overrightarrow{a}|=1,|\overrightarrow{b}|=|\overrightarrow{c}|=2\)</span>,<spanclass="math inline">\(\overrightarrow{a}\cdot\overrightarrow{b}+\overrightarrow{b}\cdot\overrightarrow{c}+\overrightarrow{c}\cdot\overrightarrow{a}=\)</span>_____</p><p>解:平方即可,<span class="math inline">\(-\dfrac{9}{2}\)</span></p><p>16.已知函数<span class="math inline">\(f(x)=|e^x-1|\)</span>,<spanclass="math inline">\(x_1<0,x_2>0\)</span>,函数<spanclass="math inline">\(f(x)\)</span>的图像在点<spanclass="math inline">\(A(x_1,f(x_1))\)</span>和点<spanclass="math inline">\(B(x_2,f(x_2))\)</span>的两条切线互相垂直,且分别交<spanclass="math inline">\(y\)</span>轴于<spanclass="math inline">\(M,N\)</span>两点,则<spanclass="math inline">\(\dfrac{|AM|}{|BN|}\)</span>的取值范围是______</p><p>解:利用垂直可以得<spanclass="math inline">\(x_1+x_2=0\)</span>,常规计算或者利用几何关系得<spanclass="math inline">\(\dfrac{|AM|}{|BN|}=\sqrt{e^{x_1}}\in(0,1)\)</span></p><p>20.已知椭圆<span class="math inline">\(C\)</span>的方程为<spanclass="math inline">\(\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}=1(a>b>0)\)</span>,右焦点为<spanclass="math inline">\(F(\sqrt2,0)\)</span>,且离心率为<spanclass="math inline">\(\dfrac{\sqrt6}{3}\)</span></p><p>(1)求椭圆<span class="math inline">\(C\)</span>的方程;</p><p>(2)设<span class="math inline">\(M,N\)</span>是椭圆<spanclass="math inline">\(C\)</span>上的两点,直线<spanclass="math inline">\(MN\)</span>与曲线<spanclass="math inline">\(x^2+y^2=b^2(x>0)\)</span>相切,证明:<spanclass="math inline">\(M,N,F\)</span>三点共线的充要条件是<spanclass="math inline">\(|MN|=\sqrt3\)</span></p><p>解:(1)<spanclass="math inline">\(C:\dfrac{x^2}{3}+y^2=1\)</span></p><p>(2)设直线<span class="math inline">\(MN:y=kx+m\)</span>与<spanclass="math inline">\(x^2+y^2=1(x>0)\)</span>相切,则<spanclass="math inline">\(1+k^2=m^2\)</span> ①</p><p>将直线与椭圆联立得<spanclass="math inline">\((1+3k^2)x^2+6kmx+3m^2-3=0\)</span>,由弦长公式得<spanclass="math inline">\(|MN|=\sqrt{1+k^2}\cdot\dfrac{2\sqrt3\cdot\sqrt{3k^2-m^2+1}}{1+3k^2}\)</span>②</p><p>充分性:若<spanclass="math inline">\(|MN|=\sqrt3\)</span>,联立①②可得,<spanclass="math inline">\(\begin{cases}k=1\\ m=-\sqrt2\end{cases}\)</span>或<span class="math inline">\(\begin{cases}k=-1\\m=\sqrt2 \end{cases}\)</span>,显然<spanclass="math inline">\(MN\)</span>过点<spanclass="math inline">\(F\)</span></p><p>必要性:若<span class="math inline">\(MN\)</span>过<spanclass="math inline">\(F\)</span>,则<spanclass="math inline">\(m=-\sqrt2k\)</span>,代入①可得<spanclass="math inline">\(k=\pm1\)</span>,再代入②可求得<spanclass="math inline">\(|MN|=\sqrt3\)</span></p><p>则<span class="math inline">\(M,N,F\)</span>三点共线的充要条件是<spanclass="math inline">\(|MN|=\sqrt3\)</span></p><p>21.一种微生物群体可以经过自身繁殖不断生存下来,设一个这种微生物为第0代,经过一次繁殖后为第1代,再经过一次繁殖后为第2代.......,该微生物每代繁殖的个数是相互独立的,且有相同的分布列,设<spanclass="math inline">\(X\)</span>表示1个微生物个体繁殖下一代的个数,<spanclass="math inline">\(P(X=i)=p_i(i=0,1,2,3)\)</span></p><p>(1)已知<spanclass="math inline">\(p_0=0.4,p_1=0.3,p_2=0.2,p_3=0.1\)</span>,求<spanclass="math inline">\(E(X)\)</span></p><p>(2)设<spanclass="math inline">\(p\)</span>表示该种微生物经过多代繁殖后临近灭绝的概率,<spanclass="math inline">\(p\)</span>是关于<spanclass="math inline">\(x\)</span>的方程:<spanclass="math inline">\(p_0+p_1x+p_2x^2+p_3x^3=x\)</span>的一个最小正实根,求证:当<spanclass="math inline">\(E(X)\le1\)</span>时,<spanclass="math inline">\(p=1\)</span>,当<spanclass="math inline">\(E(X)>1\)</span>时,<spanclass="math inline">\(p<1\)</span></p><p>(3)根据你的理解说明(2)问结论的实际含义</p><p>解:(1)<spanclass="math inline">\(E(x)=0\times0.4+1\times0.3+2\times0.2+3\times0.1=1\)</span></p><p>(2)令<spanclass="math inline">\(f(x)=p_3x^3+p_2x^2+(p_1-1)x+p_0\)</span>,注意<spanclass="math inline">\(f(1)=p_3+p_2+p_1+p_0-1=0\)</span></p><p><spanclass="math inline">\(f'(x)=3p_3x^2+2p_2x+p_1-1\)</span>,<spanclass="math inline">\(f'(1)=3p_3+2p_2+p_1-1=E(x)-1\)</span></p><p>当<span class="math inline">\(E(X)\le1\)</span>时,即<spanclass="math inline">\(f'(1)\le0\)</span>,又<spanclass="math inline">\(f'(0)=p_1-1\le0\)</span>,则由二次函数的性质可知当<spanclass="math inline">\(x\in(0,1)\)</span>时,<spanclass="math inline">\(f'(x)<0\)</span>,即<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>单减,又<spanclass="math inline">\(f(1)=0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>无零点,即<spanclass="math inline">\(p=1\)</span>是<spanclass="math inline">\(f(x)\)</span>的最小零点</p><p>当<span class="math inline">\(E(X)>1\)</span>时,即<spanclass="math inline">\(f'(1)>0\)</span>,又<spanclass="math inline">\(f'(0)\le0\)</span>,结合二次函数的性质知<spanclass="math inline">\(\exists x_0\in(0,1)\)</span>使得<spanclass="math inline">\(f'(x_0)=0\)</span>,故<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,x_0)\)</span>单减,<spanclass="math inline">\((x_0,1)\)</span>单增,则<spanclass="math inline">\(f(0)=p_0>0,f(x_0)<f(1)=0\)</span>,于是<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>内存在零点<spanclass="math inline">\(p\)</span>,即<spanclass="math inline">\(p<1\)</span></p><p>(3)当微生物下代繁殖的期望小于等于1时,该种微生物经过多代繁殖后,必定会临近灭绝</p><p>当微生物下代繁殖的期望大于1时,该种微生物经过多代繁殖后,有可能会临近灭绝</p><p>22.已知函数<spanclass="math inline">\(f(x)=(x-1)e^x-ax^2+b\)</span></p><p>(1)讨论<span class="math inline">\(f(x)\)</span>的单调性;</p><p>(2)从下面两个条件中选一个,证明:<spanclass="math inline">\(f(x)\)</span>有一个零点</p><p>①<spanclass="math inline">\(\dfrac{1}{2}<a\le\dfrac{e^2}{2},b>2a\)</span>;②<span class="math inline">\(0<a<\dfrac{1}{2},b\le2a\)</span></p><p>解:(1)<spanclass="math inline">\(f'(x)=xe^x-2ax=x(e^x-2a)\)</span></p><p>若<span class="math inline">\(a\le0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,0)\)</span>单减,<spanclass="math inline">\((0,+\infty)\)</span>单增</p><p>若<spanclass="math inline">\(0<a<\dfrac{1}{2}\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,\ln2a)\)</span>单增,<spanclass="math inline">\((\ln2a,0)\)</span>单减,<spanclass="math inline">\((0,+\infty)\)</span>单增</p><p>若<span class="math inline">\(a=\dfrac{1}{2}\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,+\infty)\)</span>单增</p><p>若<span class="math inline">\(a>\dfrac{1}{2}\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,0)\)</span>单增,<spanclass="math inline">\((0,\ln2a)\)</span>单减,<spanclass="math inline">\((\ln2a,+\infty)\)</span>单增</p><p>(2)若选①,由(1)知<span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,0)\)</span>单增,<spanclass="math inline">\((0,\ln2a)\)</span>单减,<spanclass="math inline">\((\ln2a,+\infty)\)</span>单增</p><p><spanclass="math inline">\(f(-\sqrt{\dfrac{b}{a}})<0\)</span>,<spanclass="math inline">\(f(0)=b-1>2a-1>0\)</span>,</p><p><spanclass="math inline">\(f(\ln2a)=2a(\ln2a-1)-a\ln^22a+b>2a(\ln2a-1)-a\ln^22a+2a=a\ln2a(2-\ln2a)\ge0\)</span></p><p>故<span class="math inline">\(f(\ln2a)>0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,0)\)</span>内有唯一零点</p><p>若选②,则<span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-\infty,\ln2a)\)</span>单增,<spanclass="math inline">\((\ln2a,0)\)</span>单减,<spanclass="math inline">\((0,+\infty)\)</span>单增</p><p><span class="math inline">\(f(\ln2a)=2a(\ln2a-1)-a\ln^22a+b\le2a(\ln2a-1)-a\ln^22a+2a=a\ln2a(2-\ln2a)<0\)</span></p><p>易证<span class="math inline">\(x>1\)</span>时,<spanclass="math inline">\(e^x>x+1\)</span>,则当<spanclass="math inline">\(x>1\)</span>时,有</p><p><spanclass="math inline">\(f(x)=(x-1)e^x-ax^2+b>(x-1)(x+1)-ax^2+b=(1-a)x^2+b-1\ge(1-a)x^2-|b|-1\)</span></p><p>则<spanclass="math inline">\(f(\sqrt{\dfrac{|b|+1}{1-a}})>0\)</span>,于是<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,+\infty)\)</span>存在唯一零点</p>]]></content>
<categories>
<category>数学</category>
<category>高考题</category>
</categories>
<tags>
<tag>高考题</tag>
</tags>
</entry>
<entry>
<title>2021新高考1卷部分试题解析</title>
<link href="/2021/06/21/2021%E6%96%B0%E9%AB%98%E8%80%831%E5%8D%B7%E9%83%A8%E5%88%86%E8%AF%95%E9%A2%98%E8%A7%A3%E6%9E%90/"/>
<url>/2021/06/21/2021%E6%96%B0%E9%AB%98%E8%80%831%E5%8D%B7%E9%83%A8%E5%88%86%E8%AF%95%E9%A2%98%E8%A7%A3%E6%9E%90/</url>
<content type="html"><![CDATA[<h2 id="新高考全国1卷">2021新高考全国1卷</h2><p>8.有6个相同的球,分别标有数字1,2,3,4,5,6,从中有放回的随机取两次,每次取1个球.甲表示事件“第一次取出的球的数字是1”,乙表示事件“第二次取出的球的数字是2”,丙表示事件“两次取出的球的数字之和是8”,丁表示事件“两次取出的球的数字之和是7”,则()</p><p><span class="math inline">\(A.\)</span>甲与丙相互独立 <spanclass="math inline">\(B.\)</span>甲与丁相互独立 <spanclass="math inline">\(C.\)</span>乙与丙相互独立 <spanclass="math inline">\(D.\)</span>丙与丁相互独立</p><p>解:甲与丙是互斥事件,故不相互独立;<spanclass="math inline">\(P\)</span>(丁|甲)=<spanclass="math inline">\(P\)</span>(丁)=<spanclass="math inline">\(\dfrac{1}{6}\)</span>,故甲与丁相互独立</p><p><span class="math inline">\(P\)</span>(丙)=<spanclass="math inline">\(\dfrac{5}{36}\)</span>,<spanclass="math inline">\(P\)</span>(丙|乙)=<spanclass="math inline">\(\dfrac{1}{6}\)</span>,故乙与丙不相互独立;丙与丁是互斥事件,故丙与丁不相互独立</p><p>12.在正三棱柱<spanclass="math inline">\(ABC-A_1B_1C_1\)</span>中,<spanclass="math inline">\(AB=AA_1=1\)</span>,点<spanclass="math inline">\(P\)</span>满足<spanclass="math inline">\(\overrightarrow{BP}=\lambda\overrightarrow{BC}+\mu\overrightarrow{BB_1}\)</span>,其中<spanclass="math inline">\(\lambda\in[0,1],\mu\in[0,1]\)</span>,则( )</p><p><span class="math inline">\(A.\)</span>当<spanclass="math inline">\(\lambda=1\)</span>时,<spanclass="math inline">\(\triangle AB_1P\)</span>的周长为定值</p><p><span class="math inline">\(B.\)</span>当<spanclass="math inline">\(\mu=1\)</span>时,三棱锥<spanclass="math inline">\(P-A_1BC\)</span>的体积为定值</p><p><span class="math inline">\(C.\)</span>当<spanclass="math inline">\(\lambda=\dfrac{1}{2}\)</span>时,有且仅有一个点<spanclass="math inline">\(P\)</span>,使得<spanclass="math inline">\(A_1P\bot BP\)</span></p><p><span class="math inline">\(D.\)</span>当<spanclass="math inline">\(\mu=\dfrac{1}{2}\)</span>时,有且仅有一个点<spanclass="math inline">\(P\)</span>,使得$A_1B<spanclass="math inline">\(平面\)</span>AB_1P$</p><p><img src="https://gitee.com/andypl/imagehost/raw/master/img/Snipaste_2021-06-20_20-44-49.jpg" style="zoom:70%;" /></p><p>解:对于<span class="math inline">\(A\)</span>,点<spanclass="math inline">\(P\)</span>在线段<spanclass="math inline">\(CC_1\)</span>上,当<spanclass="math inline">\(P\)</span>位于<spanclass="math inline">\(CC_1\)</span>的中点时,<spanclass="math inline">\(AP+B_1P\)</span>最短,故<spanclass="math inline">\(\triangle AB_1P\)</span>的周长不是定值,<spanclass="math inline">\(A\)</span>错</p><p>对于<span class="math inline">\(B\)</span>,点<spanclass="math inline">\(P\)</span>在线段<spanclass="math inline">\(B_1C_1\)</span>上,由于<spanclass="math inline">\(B_1C_1//\)</span>平面<spanclass="math inline">\(A_1BC\)</span>,则<spanclass="math inline">\(B_1C_1\)</span>上任意一点到平面的距离都相等,故<spanclass="math inline">\(B\)</span>对</p><p>对于<span class="math inline">\(C\)</span>,点<spanclass="math inline">\(P\)</span>在线段<spanclass="math inline">\(P_1P_2\)</span>上,当<spanclass="math inline">\(P\)</span>在<spanclass="math inline">\(P_1\)</span>或<spanclass="math inline">\(P_2\)</span>上时,都有<spanclass="math inline">\(A_1P\bot BP\)</span>,<spanclass="math inline">\(C\)</span>错,多选题故<spanclass="math inline">\(D\)</span>正确</p><p>对于<span class="math inline">\(D\)</span>,需满足<spanclass="math inline">\(A_1B\bot PO\)</span>,由于<spanclass="math inline">\(O\)</span>为<spanclass="math inline">\(A_1B\)</span>的中点,即需有<spanclass="math inline">\(PB=PA_1\)</span>,则<spanclass="math inline">\(P\)</span>在线段<spanclass="math inline">\(A_1B\)</span>的中垂面上,而中垂面与<spanclass="math inline">\(P\)</span>所在的线段交点唯一,即<spanclass="math inline">\(CC_1\)</span>的中点</p><p>16.某校学生在研究民间剪纸艺术时,发现剪纸时经常会沿纸的某条对称轴把纸对折,规格为20dm<span class="math inline">\(\times\)</span>12dm的长方形纸,对折1次共可以得到10dm <spanclass="math inline">\(\times\)</span> 12dm,20dm <spanclass="math inline">\(\times\)</span>6dm两种规格的图形,它们的面积之和为 <spanclass="math inline">\(S_1=240dm^2\)</span>,对折2次共可以得到5dm <spanclass="math inline">\(\times\)</span> 12dm,10dm <spanclass="math inline">\(\times\)</span> 6dm,20dm <spanclass="math inline">\(\times\)</span>3dm三种规格的图形,它们的面积之和<spanclass="math inline">\(S_2=180dm^2\)</span>,以此类推,则对折4次共可以得到不同规格图形的种数为_________;如果对折<span class="math inline">\(n\)</span>次,那么<spanclass="math inline">\(\sum _{k=1}^n S_k=\)</span> ____________<spanclass="math inline">\(dm^2\)</span></p><p>解:考察数列错位相减法求和略,5,<spanclass="math inline">\(720-240\cdot\dfrac{n+3}{2^n}\)</span></p><p>19.记<span class="math inline">\(\triangle ABC\)</span>的内角<spanclass="math inline">\(A,B,C\)</span>的对边分别为<spanclass="math inline">\(a,b,c\)</span>.已知<spanclass="math inline">\(b^2=ac\)</span>,点<spanclass="math inline">\(D\)</span>在边<spanclass="math inline">\(AC\)</span>上,<spanclass="math inline">\(BD\sin\angle ABC=a\sin C\)</span>.</p><p>(1)证明:<span class="math inline">\(BD=b\)</span>;</p><p>(2)若<span class="math inline">\(AD=2DC\)</span>,求<spanclass="math inline">\(\cos\angle ABC\)</span>.</p><p>解:(2)由<span class="math inline">\(\cos\angle ADB+\cos\angleCDB=0\)</span>,即<spanclass="math inline">\(\dfrac{\dfrac{4}{9}b^2+b^2-c^2}{2\times\dfrac{2}{3}b^2}+\dfrac{b^2+\dfrac{1}{9}b^2-a^2}{2\times\dfrac{1}{3}b^2}=0\)</span>,</p><p>化简得<span class="math inline">\(3c^2-11ac+6a^2=0\)</span>,即<spanclass="math inline">\(c=3a\)</span>或<spanclass="math inline">\(c=\dfrac{2}{3}a\)</span></p><p>若<span class="math inline">\(c=3a\)</span>,则<spanclass="math inline">\(b=\sqrt3a\)</span>,此时<spanclass="math inline">\(a+b<c\)</span>,不能构成三角i形,舍</p><p>故<span class="math inline">\(c=\dfrac{2}{3}a\)</span>,此时<spanclass="math inline">\(\cos \angleABC=\dfrac{a^2+c^2-ac}{2ac}=\dfrac{7}{12}\)</span></p><p>21.在平面直角坐标系<spanclass="math inline">\(xOy\)</span>中,已知点<spanclass="math inline">\(F_1(-\sqrt{17},0),F_2(\sqrt{17},0)\)</span>,点<spanclass="math inline">\(M\)</span>满足<spanclass="math inline">\(|MF_1|-|MF_2|=2\)</span>.记<spanclass="math inline">\(M\)</span>的轨迹为<spanclass="math inline">\(C\)</span>.</p><p>(1)求<span class="math inline">\(C\)</span>的方程</p><p>(2)设点<span class="math inline">\(T\)</span>在直线<spanclass="math inline">\(x=\dfrac{1}{2}\)</span>上,过<spanclass="math inline">\(T\)</span>的两条直线分别交<spanclass="math inline">\(C\)</span>于<spanclass="math inline">\(A,B\)</span>两点和<spanclass="math inline">\(P,Q\)</span>两点,且<spanclass="math inline">\(|TA|\cdot|TB|=|TP|\cdot|TQ|\)</span>,求直线<spanclass="math inline">\(AB\)</span>的斜率与直线<spanclass="math inline">\(PQ\)</span>的斜率之和.</p><p>解:(1)<spanclass="math inline">\(C:x^2-\dfrac{y^2}{16}=1(x\ge1)\)</span></p><p>(2)方法一:设<spanclass="math inline">\(T(\dfrac{1}{2},n)\)</span>,<spanclass="math inline">\(AB:y=k_1x+m_1\)</span>,<spanclass="math inline">\(PQ:y=k_2x+m_2\)</span>,将<spanclass="math inline">\(AB\)</span>与<spanclass="math inline">\(C\)</span>联立得</p><p><spanclass="math inline">\((16-k_1^2)x^2-2k_1m_1x-m_1^2-16=0\)</span>,设方程的两根为<spanclass="math inline">\(x_1,x_2\)</span></p><p>则<spanclass="math inline">\((16-k_1^2)x^2-2k_1m_1x-m_1^2-16=(16-k_1^2)(x-x_1)(x-x_2)\)</span>,令<spanclass="math inline">\(x=\dfrac{1}{2}\)</span>得</p><p><spanclass="math inline">\((\dfrac{1}{2}-x_1)(\dfrac{1}{2}-x_2)=\dfrac{\dfrac{1}{4}(16-k_1^2)-k_1m-m_1^2-16}{16-k_1^2}=\dfrac{-12-(\dfrac{1}{2}k_1+m_1)^2}{16-k_1^2}=\dfrac{n^2+12}{k_1^2-16}\)</span></p><p>于是<spanclass="math inline">\(|TA|\cdot|TB|=(1+k_1^2)\dfrac{n^2+12}{k_1^2-16}\)</span>,同理<spanclass="math inline">\(|TP|\cdot|TQ|=(1+k_2^2)\dfrac{n^2+12}{k_2^2-16}\)</span></p><p>故<spanclass="math inline">\(\dfrac{1+k_1^2}{k_1^2-16}=\dfrac{1+k_2^2}{k_2^2-16}\)</span>,即<spanclass="math inline">\(1+\dfrac{17}{k_1^2-16}=1+\dfrac{17}{k_2^2-16}\)</span>,</p><p>故<span class="math inline">\(k_1^2=k_2^2\)</span>,由于<spanclass="math inline">\(k_1\ne k_2\)</span>,则<spanclass="math inline">\(k_1=-k_2\)</span>,即<spanclass="math inline">\(k_1+k_2=0\)</span></p><p>方法二:设<spanclass="math inline">\(T(\dfrac{1}{2},n)\)</span>,直线<spanclass="math inline">\(AB\)</span>的参数方程为<spanclass="math inline">\(\begin{cases} x=\dfrac{1}{2}+t\cos\alpha\ \\y=n+t\sin\alpha \end{cases},t\)</span>为参数,与<spanclass="math inline">\(C\)</span>联立得</p><p><spanclass="math inline">\((16\cos^2\alpha-\sin^2\alpha)t^2+(16\cos\alpha-2n\sin\alpha)t-12-n^2=0\)</span></p><p>于是<spanclass="math inline">\(|TA|\cdot|TB|=t_1t_2=\dfrac{-n^2-12}{16\cos^2\alpha-\sin^2\alpha}=\dfrac{-n^2-12}{17\cos^2\alpha-1}\)</span></p><p>设直线<span class="math inline">\(PQ\)</span>的参数方程为<spanclass="math inline">\(\begin{cases} x=\dfrac{1}{2}+t\cos\beta\ \\y=n+t\sin\beta \end{cases},t\)</span>为参数</p><p>同理<spanclass="math inline">\(|TP|\cdot|TQ|=\dfrac{-n^2-12}{16\cos^2\beta-\sin^2\beta}=\dfrac{-n^2-12}{17\cos^2\beta-1}\)</span></p><p>于是<spanclass="math inline">\(\cos^2\alpha=\cos^2\beta\)</span>,由于<spanclass="math inline">\(\alpha\ne\beta\)</span>,则<spanclass="math inline">\(\alpha+\beta=\pi\)</span>,即<spanclass="math inline">\(AB\)</span>与<spanclass="math inline">\(PQ\)</span>的斜率之和为0</p><p>老教材《坐标系与参数方程》选修教材的例题(原例题是椭圆),出现在新高考挺尬的</p><p>22.已知函数<span class="math inline">\(f(x)=x(1-\ln x)\)</span></p><p>(1)讨论<span class="math inline">\(f(x)\)</span>的单调性;</p><p>(2)设<spanclass="math inline">\(a,b\)</span>为两个不相等的正数,且<spanclass="math inline">\(b\ln a-a\ln b=a-b\)</span>,证明:<spanclass="math inline">\(2<\dfrac{1}{a}+\dfrac{1}{b}<e\)</span></p><p>解:(1)<span class="math inline">\(f'(x)=-\lnx\)</span>,则<span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>单增,<spanclass="math inline">\((1,+\infty)\)</span>单减</p><p>(2)<span class="math inline">\(b\ln a-a\ln b=a-b\)</span>即<spanclass="math inline">\(\dfrac{1}{a}(1-\ln\dfrac{1}{a})=\dfrac{1}{b}(1-\ln\dfrac{1}{b})\)</span>,令<spanclass="math inline">\(x_1=\dfrac{1}{a},x_2=\dfrac{1}{b}\)</span></p><p>即<span class="math inline">\(f(x_1)=f(x_2)\)</span>,<spanclass="math inline">\(x_1\ne x_2\)</span>,证明:<spanclass="math inline">\(2<x_1+x_2<e\)</span></p><p>左侧证明为标准的极值点偏移问题,略,下证明右边</p><p>方法一:仿照极值点偏移的求解,统一变量构造函数</p><p>易知<spanclass="math inline">\(0<x_1<1<x_2<e\)</span>,只需证<spanclass="math inline">\(x_2<e-x_1\)</span>,只需证<spanclass="math inline">\(f(x_2)>f(e-x_1)\)</span>,即证<spanclass="math inline">\(f(x_1)>f(e-x_1)\)</span></p><p>令<span class="math inline">\(g(x)=f(x)-f(e-x)=x(1-\lnx)-(e-x)(1-\ln(e-x))=2x-x\ln x+(e-x)\ln(e-x)-e,x\in(0,1)\)</span></p><p>则<spanclass="math inline">\(g'(x)=-\ln(ex-x^2)\)</span>,记<spanclass="math inline">\(x_0\)</span>为<spanclass="math inline">\(ex-x^2=1\)</span>的小于1的根,则<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((0,x_0)\)</span>单增,<spanclass="math inline">\((x_0,\dfrac{e}{2})\)</span>单减</p><p>又<span class="math inline">\(x\rightarrow 0\)</span>时,<spanclass="math inline">\(g(x)\rightarrow 0\)</span>,结合<spanclass="math inline">\(g(x)>g(\dfrac{e}{2})=0\)</span>知,<spanclass="math inline">\(g(x)>0,x\in(0,1)\)</span>成立</p><p>如果想避免上述极限的写法,考虑对<spanclass="math inline">\(g(x)\)</span>的解析式进行变形,令<spanclass="math inline">\(h(x)=2-\lnx+\dfrac{e-x}{x}\ln(e-x)-\dfrac{e}{x}\)</span></p><p><spanclass="math inline">\(h'(x)=-\dfrac{1}{x^2}[e\ln(e-x)+2x-e]\)</span>,令<spanclass="math inline">\(\varphi(x)=e\ln(e-x)+2x-e\)</span>,注意<spanclass="math inline">\(\varphi(0)=0\)</span></p><p><spanclass="math inline">\(\varphi'(x)=\dfrac{2x-e}{x-e}\)</span>,当<spanclass="math inline">\(x\in(0,\dfrac{e}{2})\)</span>时,<spanclass="math inline">\(\varphi'(x)>0\)</span>,则<spanclass="math inline">\(\varphi(x)>0\)</span>,即<spanclass="math inline">\(h'(x)<0\)</span>,故<spanclass="math inline">\(h(x)\)</span>在<spanclass="math inline">\((0,\dfrac{e}{2})\)</span>单减,则<spanclass="math inline">\(h(x)>h(\dfrac{e}{2})=0\)</span></p><p>方法二:比值换元,统一变量</p><p>令<span class="math inline">\(x_2=tx_1\)</span>,即有<spanclass="math inline">\(\begin{cases}x_1(1-\ln x_1)=x_2(1-\ln x_2)\\x_2=tx_1 \end{cases}\)</span>,解得<span class="math inline">\(\lnx_1=1-\dfrac{t\ln t}{t-1}\)</span></p><p><span class="math inline">\(x_1+x_2<e\)</span>,即证<spanclass="math inline">\((1+t)x_1<e\)</span>,即证<spanclass="math inline">\(\ln(1+t)+\ln x_1<1\)</span>,即证<spanclass="math inline">\(\ln(1+t)-\dfrac{t\lnt}{t-1}<0\)</span>,即证<spanclass="math inline">\(\dfrac{\ln(t+1)}{t}<\dfrac{\lnt}{t-1}\)</span>,</p><p>令<span class="math inline">\(g(t)=\dfrac{\lnt}{t-1}(t>1)\)</span>,则<spanclass="math inline">\(g'(t)=\dfrac{t-1-t\lnt}{t(t-1)}<0\)</span>,于是<spanclass="math inline">\(g(t)\)</span>在<spanclass="math inline">\((1,+\infty)\)</span>单减,则<spanclass="math inline">\(g(t+1)<g(t)\)</span>,得证</p><p>方法三:切线放缩</p><p><span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\(x=e\)</span>处的切线方程为<spanclass="math inline">\(y=-x+e\)</span>,</p><p>令<span class="math inline">\(g(x)=x(1-\ln x)+x-e=2x-x\lnx-e\)</span>,<span class="math inline">\(g'(x)=1-\lnx\)</span>,于是<span class="math inline">\(g(x)\)</span>在<spanclass="math inline">\((0,e)\)</span>单增,<spanclass="math inline">\((e,+\infty)\)</span>单减,即<spanclass="math inline">\(g(x)\le g(e)=0\)</span></p><p>设<span class="math inline">\(x_1(1-\ln x_1)=x_2(1-\lnx_2)=-x_2'+e\)</span>,由于<span class="math inline">\(x_2(1-\lnx_2)<-x_2+e\)</span>,则<spanclass="math inline">\(x_2<x_2'\)</span></p><p>于是<spanclass="math inline">\(x_1+x_2<x_1+x_2'=x_1+[e-x_1(1-\lnx_1)]=e+x_1\ln x_1<e\)</span>成立</p><p>方法四:割线放缩</p><p><span class="math inline">\(f(x)\)</span>经过<spanclass="math inline">\((0,0)\)</span>和<spanclass="math inline">\((1,1)\)</span>两点的割线方程为<spanclass="math inline">\(y=x\)</span></p><p>显然当<span class="math inline">\(x\in(0,1)\)</span>时,<spanclass="math inline">\(x(1-\ln x)>x\)</span></p><p>设<span class="math inline">\(x_1(1-\ln x_1)=x_1'=x_2(1-\lnx_2)\)</span>,由于<span class="math inline">\(x_1(1-\lnx_1)>x_1\)</span>,则<spanclass="math inline">\(x_1'>x_1\)</span></p><p>于是<span class="math inline">\(x_1+x_2<x_1'+x_2=x_2(1-\lnx_2)+x_2=2x_2-x_2\ln x_2\)</span></p><p>令<span class="math inline">\(g(x)=2x-x\lnx,x\in(1,e)\)</span>,则<span class="math inline">\(g'(x)=1-\lnx\)</span>,于是<span class="math inline">\(g(x)\)</span>在<spanclass="math inline">\((1,e)\)</span>单增</p><p>则<span class="math inline">\(g(x)<g(e)=e\)</span>,即<spanclass="math inline">\(2x_2-x_2\ln x_2<e\)</span>,得证</p><p>将法二和法三综合起来,切割线一起放缩:<spanclass="math inline">\(x_1+x_2<x_1'+x_2'=e\)</span></p><p>事实上相当于用对称轴为<spanclass="math inline">\(x=\dfrac{e}{2}\)</span>的函数<spanclass="math inline">\(y=\dfrac{e}{2}-|x-\dfrac{e}{2}|\)</span>拟合了<spanclass="math inline">\(f(x)\)</span>,体现化曲为直的思想</p><p>娱乐一下:当然也可以考虑用对称轴为<spanclass="math inline">\(x=\dfrac{e}{2}\)</span>的二次函数拟合,利用待定系数得<spanclass="math inline">\(y=\dfrac{1}{1-e}(x-\dfrac{e}{2})^2+\dfrac{e^2}{4(e-1)}\)</span></p><p>方法五:野猪wj</p><p><span class="math inline">\(b\ln a-a\ln b=a-b\)</span>即<spanclass="math inline">\(\dfrac{1}{a}(1+\ln a)=\dfrac{1}{b}(1+\lnb)\)</span>,即<span class="math inline">\(\dfrac{1}{a}\lnea=\dfrac{1}{b}\ln eb\)</span>,即<spanclass="math inline">\(\dfrac{1}{ea}\ln \dfrac{1}{ea}=\dfrac{1}{eb}\ln\dfrac{1}{eb}\)</span></p><p>令<spanclass="math inline">\(\dfrac{1}{ea}=x_1,\dfrac{1}{eb}=x_2\)</span>,<spanclass="math inline">\(g(x)=x\ln x\)</span>,即<spanclass="math inline">\(g(x_1)=g(x_2)\)</span>,证明:<spanclass="math inline">\(\dfrac{2}{e}<x_1+x_2<1\)</span></p><p>这样同构的式子变化,使得函数解析式变得更加漂亮,下面证明类似略</p>]]></content>
<categories>
<category>数学</category>
<category>高考题</category>
</categories>
<tags>
<tag>高考题</tag>
</tags>
</entry>
<entry>
<title>Debian延迟1m30s启动的解决</title>
<link href="/2021/06/03/Debian%E5%BB%B6%E8%BF%9F1m30s%E5%90%AF%E5%8A%A8%E7%9A%84%E8%A7%A3%E5%86%B3/"/>
<url>/2021/06/03/Debian%E5%BB%B6%E8%BF%9F1m30s%E5%90%AF%E5%8A%A8%E7%9A%84%E8%A7%A3%E5%86%B3/</url>
<content type="html"><![CDATA[<h2 id="问题现象">问题现象</h2><p>1.启动时显示 <span class="label label-danger">Assuming drive cache: write through</span> ,卡顿30秒以后,显示 <span class="label label-danger">Gave up waiting for suspend/resume device</span></p><p>2.然后又接着显示 <span class="label label-danger">A start job is running for /dev/disk/by-uuid...xxxx(1min 30s)</span> ,等待1min30s以后,才能进入系统</p><h2 id="问题原因">问题原因</h2><p>意思大概是说启动uuid是xxx的设备时,启动失败,通过<span class="label label-info">vim /etc/fstab</span>查看启动设备文件,发现uuid的设备是swap分区,不知怎么搞的,安装系统时安装的swap分区丢失,所以导致这样的错误发生<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-comment"># swap was on /dev/sda6 during installation</span><br><span class="hljs-attribute">UUID</span>=f<span class="hljs-number">68038</span>cb-b<span class="hljs-number">305</span>-<span class="hljs-number">451</span>a-<span class="hljs-number">8</span>c<span class="hljs-number">84</span>-<span class="hljs-number">4</span>dc<span class="hljs-number">6</span>bdb<span class="hljs-number">2</span>b<span class="hljs-number">3</span>b<span class="hljs-number">4</span> none swap sw <span class="hljs-number">0</span> <span class="hljs-number">0</span><br></code></pre></td></tr></table></figure></p><h2 id="问题解决">问题解决</h2><p>针对现象2,只需要将对应的启动设备注释掉 <figure class="highlight vala"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs vala"><span class="hljs-meta"># swap was on /dev/sda6 during installation</span><br><span class="hljs-meta"># UUID=f68038cb-b305-451a-8c84-4dc6bdb2b3b4 none swap sw 0 0</span><br></code></pre></td></tr></table></figure></p><p>重启发现现象1依旧</p><p>解决办法就是修改启动内核参数</p><figure class="highlight vala"><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></pre></td><td class="code"><pre><code class="hljs vala">vim /etc/<span class="hljs-keyword">default</span>/grub<br><span class="hljs-meta"># 找到</span><br>GRUB_CMDLINE_LINUX=<span class="hljs-string">"quiet"</span><br><span class="hljs-meta"># 修改成</span><br>GRUB_CMDLINE_LINUX=<span class="hljs-string">"quiet noresume"</span><br><span class="hljs-meta"># 然后</span><br>update-grub<br></code></pre></td></tr></table></figure><p>重启问题解决</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>debian</tag>
<tag>swap</tag>
</tags>
</entry>
<entry>
<title>试用Gist桌面客户端兼编辑器Lepton</title>
<link href="/2021/06/03/%E8%AF%95%E7%94%A8Gist%E6%A1%8C%E9%9D%A2%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%85%BC%E7%BC%96%E8%BE%91%E5%99%A8Lepton/"/>
<url>/2021/06/03/%E8%AF%95%E7%94%A8Gist%E6%A1%8C%E9%9D%A2%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%85%BC%E7%BC%96%E8%BE%91%E5%99%A8Lepton/</url>
<content type="html"><![CDATA[<h2 id="lepton简介">Lepton简介</h2><p>Lepton is a lean code snippet manager based on GitHub Gist.</p><ul><li>Unlimited public/private snippets</li><li>Unlimited tags</li><li>Language groups</li><li>Markdown/JupyterNotebook support</li><li>GitHub Enterprise support</li><li>Immersive mode</li><li>Customizable</li><li>Light/Dark theme</li><li>macOS/Win/Linux</li><li>Dashboard</li><li>Search</li><li>Proxy</li><li>Free</li></ul><h2 id="仓库及windows-64位下载地址">仓库及windows 64位下载地址</h2><p><a href="https://github.com/hackjutsu/Lepton">Github仓库地址</a></p><p><ahref="https://github.com/hackjutsu/Lepton/releases/download/v1.9.2/Lepton-1.9.2-win.7z">windows64位下载地址</a></p><h2 id="自定配置">自定配置</h2><p>首先 <code>Ctrl + ,</code> 打开 <code>about</code>选项卡,在里面找到配置文件的路径,比如一般都是<code>C:\Users\xx\.leptonrc</code>,如果没有该文件,自己建一个,里面写入配置内容,配置内容示例如下,可根据需要自己调整</p><figure class="highlight json"><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></pre></td><td class="code"><pre><code class="hljs json">{<br> <span class="hljs-attr">"theme"</span>: <span class="hljs-string">"dark"</span>,<br> <span class="hljs-attr">"autoUpdate"</span>: <span class="hljs-literal">false</span>,<br> <span class="hljs-attr">"snippet"</span>: {<br> <span class="hljs-attr">"expanded"</span>: <span class="hljs-literal">true</span>,<br> <span class="hljs-attr">"newSnippetPrivate"</span>: <span class="hljs-literal">true</span>,<br> <span class="hljs-attr">"sorting"</span>: <span class="hljs-string">"updated_at"</span>, <br> <span class="hljs-attr">"sortingReverse"</span>: <span class="hljs-literal">true</span><br> },<br> <span class="hljs-attr">"editor"</span> : {<br> <span class="hljs-attr">"tabSize"</span>: <span class="hljs-number">4</span>,<br> <span class="hljs-attr">"validateFilename"</span>: <span class="hljs-literal">true</span><br> },<br> <span class="hljs-attr">"userPanel"</span>: {<br> <span class="hljs-attr">"hideProfilePhoto"</span>: <span class="hljs-literal">false</span><br> },<br> <span class="hljs-attr">"logger"</span>: {<br> <span class="hljs-attr">"level"</span>: <span class="hljs-string">"debug"</span><br> },<br> <span class="hljs-attr">"proxy"</span>: {<br> <span class="hljs-attr">"enable"</span>: <span class="hljs-literal">true</span>,<br> <span class="hljs-attr">"address"</span>: <span class="hljs-string">"socks://localhost:1081"</span><br> },<br> <span class="hljs-attr">"notifications"</span>: {<br> <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,<br> <span class="hljs-attr">"failure"</span>: <span class="hljs-literal">true</span><br> },<br> <span class="hljs-attr">"shortcuts"</span>: {<br> <span class="hljs-attr">"keyShortcutForSearch"</span>: <span class="hljs-string">"CMD+F"</span>,<br> <span class="hljs-attr">"keyNewGist"</span>: <span class="hljs-string">"CommandOrControl+N"</span>,<br> <span class="hljs-attr">"keyEditGist"</span>: <span class="hljs-string">"CommandOrControl+E"</span>,<br> <span class="hljs-attr">"keySubmitGist"</span>: <span class="hljs-string">"CommandOrControl+S"</span>,<br> <span class="hljs-attr">"keyImmersiveMode"</span>: <span class="hljs-string">"CommandOrControl+I"</span>,<br> <span class="hljs-attr">"keyAboutPage"</span>: <span class="hljs-string">"CommandOrControl+,"</span>,<br> <span class="hljs-attr">"keyDashboard"</span>: <span class="hljs-string">"CommandOrControl+D"</span>,<br> <span class="hljs-attr">"keyEditorExit"</span>: <span class="hljs-string">"CommandOrControl+Escape"</span>,<br> <span class="hljs-attr">"keySyncGists"</span>: <span class="hljs-string">"CommandOrControl+R"</span><br> },<br> <span class="hljs-attr">"enterprise"</span>: {<br> <span class="hljs-attr">"enable"</span>: <span class="hljs-literal">false</span>,<br> <span class="hljs-attr">"host"</span>: <span class="hljs-string">"github_enterprise_host"</span>,<br> <span class="hljs-attr">"token"</span>: <span class="hljs-string">"token_with_gist_enabled"</span>,<br> <span class="hljs-attr">"avatarUrl"</span>: <span class="hljs-string">"optional_avatar_url"</span><br> }<br>}<br><br></code></pre></td></tr></table></figure><p><code>"theme": "dark"</code> 主题选择了黑暗模式,也可以改为<code>"light"</code></p><p><code>"newSnippetPrivate": true</code> 表示默认新建gist为私有</p><p><code>"proxy"</code> 为开启状态</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>gist</tag>
<tag>lepton</tag>
</tags>
</entry>
<entry>
<title>教学〔2020〕1号《教育部关于在部分高校开展基础学科招生改革试点工作的意见》</title>
<link href="/2021/06/03/%E6%95%99%E5%AD%A6%E3%80%942020%E3%80%951%E5%8F%B7%E3%80%8A%E6%95%99%E8%82%B2%E9%83%A8%E5%85%B3%E4%BA%8E%E5%9C%A8%E9%83%A8%E5%88%86%E9%AB%98%E6%A0%A1%E5%BC%80%E5%B1%95%E5%9F%BA%E7%A1%80%E5%AD%A6%E7%A7%91%E6%8B%9B%E7%94%9F%E6%94%B9%E9%9D%A9%E8%AF%95%E7%82%B9%E5%B7%A5%E4%BD%9C%E7%9A%84%E6%84%8F%E8%A7%81%E3%80%8B/"/>
<url>/2021/06/03/%E6%95%99%E5%AD%A6%E3%80%942020%E3%80%951%E5%8F%B7%E3%80%8A%E6%95%99%E8%82%B2%E9%83%A8%E5%85%B3%E4%BA%8E%E5%9C%A8%E9%83%A8%E5%88%86%E9%AB%98%E6%A0%A1%E5%BC%80%E5%B1%95%E5%9F%BA%E7%A1%80%E5%AD%A6%E7%A7%91%E6%8B%9B%E7%94%9F%E6%94%B9%E9%9D%A9%E8%AF%95%E7%82%B9%E5%B7%A5%E4%BD%9C%E7%9A%84%E6%84%8F%E8%A7%81%E3%80%8B/</url>
<content type="html"><![CDATA[<h1id="教育部关于在部分高校开展基础学科招生改革试点工作的意见">教育部关于在部分高校开展基础学科招生改革试点工作的意见</h1><p>各省、自治区、直辖市高等学校招生委员会、教育厅(教委),有关部门(单位)教育司(局),部属有关高等学校:</p><p>为深入贯彻党的十九大和十九届二中、三中、四中全会精神,落实全国教育大会精神,服务国家重大战略需求,加强拔尖创新人才选拔培养,我部决定自2020年起,在部分高校开展基础学科招生改革试点(也称强基计划)。现就有关工作提出如下意见。</p><h2 id="一指导思想和原则">一、指导思想和原则</h2><p>以习近平新时代中国特色社会主义思想为指导,健全立德树人落实机制,探索多维度考核评价模式,着力实现学生成长、国家选才、社会公平的有机统一。服务国家战略,招收一批有志向、有兴趣、有天赋的青年学生进行专门培养,为国家重大战略领域输送后备人才。坚持育人为本,探索在招生中对学生进行全面、综合评价,转变简单以考试成绩评价学生的做法,引导中学更加重视学生成长过程,更加重视培养学生综合素质。加强统筹协调,与加快“双一流”建设、基础学科拔尖学生培养、加强科技创新等改革相衔接,形成改革合力。促进公平公正,着力完善制度规则,切实保障考试招生机会公平、程序公开、结果公正。</p><h2 id="二试点定位">二、试点定位</h2><p>强基计划主要选拔培养有志于服务国家重大战略需求且综合素质优秀或基础学科拔尖的学生。聚焦高端芯片与软件、智能科技、新材料、先进制造和国家安全等关键领域以及国家人才紧缺的人文社会科学领域,由有关高校结合自身办学特色,合理安排招生专业。要突出基础学科的支撑引领作用,重点在数学、物理、化学、生物及历史、哲学、古文字学等相关专业招生。建立学科专业的动态调整机制,根据新形势要求和招生情况,适时调整强基计划招生专业。</p><h2 id="三招生学校和规模">三、招生学校和规模</h2><p>起步阶段,在部分“一流大学”建设高校(见附件1)范围内遴选高校开展试点。相关高校可向我部申请并提交相关专业的招生和人才培养一体化方案。我部组织专家综合考虑高校的办学定位、人才培养质量、科研项目及平台建设情况、招生和人才培养方案等因素,按照“一校一策”的原则,研究确定强基计划招生高校、专业和规模。2020年起,不再组织开展高校自主招生工作。</p><p>高校要与各地教育部门充分沟通协商,统筹考虑国家政策与导向、招生定位和培养要求、各地高考综合改革进程以及中学素质教育推进情况等因素,合理确定在各省(区、市)的强基计划招生名额,并在各省(区、市)的分省计划中安排。</p><h2 id="四招生办法">四、招生办法</h2><p>在保证公平公正的前提下,探索建立多维度考核评价考生的招生模式。高校根据有关拔尖创新人才培养需要,制定强基计划的招生和培养方案。符合高校报考条件的考生可在高考前申请参加强基计划招生。高校依据考生的高考成绩,按在各省(区、市)强基计划招生名额的一定倍数确定参加高校考核的考生名单。考生参加统一高考和高校考核后,高校将考生高考成绩、高校综合考核结果及综合素质评价情况等按比例合成考生综合成绩(其中高考成绩所占比例不得低于85%),根据考生填报志愿,按综合成绩由高到低顺序录取。有关高校要认真研究制定高中学生综合素质评价使用办法,并在招生简章中提前向社会公布。</p><p>对于极少数在相关学科领域具有突出才能和表现的考生,有关高校可制定破格入围高校考核的条件和破格录取的办法、标准,并提前向社会公布。考生参加统一高考后,由高校组织相关学科领域专家对考生进行严格考核,达到录取标准的,经高校招生工作领导小组审定,报生源所在地省级高校招生委员会核准后予以破格录取。破格录取考生的高考成绩原则上不得低于各省(区、市)本科一批录取最低控制分数线(合并录取批次省份应单独划定相应分数线)。</p><h2 id="五培养模式">五、培养模式</h2><p>招生高校要对通过强基计划录取的学生制定单独人才培养方案和激励机制,增强学生的荣誉感和使命感。实施基础学科拔尖学生培养计划的高校,要加强对人才培养的统筹。对通过强基计划录取学生可单独编班,配备一流的师资,提供一流的学习条件,创造一流的学术环境与氛围,实行导师制、小班化等培养模式。畅通成长发展通道,对学业优秀的学生,高校可在免试推荐研究生、直博、公派留学、奖学金等方面予以优先安排。探索建立本—硕—博衔接的培养模式,本科阶段培养要夯实基础学科能力素养,硕博阶段既可在本学科深造,也可探索学科交叉培养。推进科教协同育人,鼓励国家实验室、国家重点实验室、前沿科学中心、集成攻关大平台和协同创新中心等吸纳这些学生参与项目研究,探索建立结合重大科研任务进行人才培养的机制。强化质量保障机制,建立科学化、多阶段的动态进出机制,对进入强基计划的学生进行综合考查、科学分流。建立在校生、毕业生跟踪调查机制和人才成长数据库,根据质量监测和反馈信息不断完善培养方案和培养模式,持续改进招生和培养工作。高校要加强对学生的就业教育和指导,积极为关键领域输送高素质后备人才。教育部将加强对强基计划的政策支持。</p><h2 id="六严格规范管理">六、严格规范管理</h2><p>高校强基计划招生工作全程接受本校纪委监督,并建立申诉途径和举报机制。严格组织高校考核,按照国家教育考试有关要求组织实施。笔试、面试安排在国家教育考试标准化考点进行,试题按机密级事项管理。面试采取专家、考生“双随机”抽签的方式,过程全程录音录像。完善信息公开公示,落实教育部、省级、校级三级信息公开制度,合理设置公开范围,规范公开内容,主动接受监督。严肃查处违规行为,对于违规违纪行为,按照《国家教育考试违规处理办法》《普通高等学校招生违规行为处理暂行办法》严肃处理。对于因疏于管理,造成考场秩序混乱、大规模舞弊、招生严重违规的高校,取消其强基计划招生资格,对相关责任人依法依规严肃处理并追责问责。</p><h2 id="七加强组织领导">七、加强组织领导</h2><p>实施强基计划是服务国家重大战略、选拔培养拔尖创新人才、深化高校考试招生制度改革的重要举措。各省(区、市)教育行政部门和有关高校要充分认识做好强基计划实施工作的重要意义,严格落实主体责任。有关省级高校招生委员会负责监督相关高校在本地开展强基计划录取工作。有关高校是本校强基计划实施工作的责任主体,高校主要负责同志要对本校有关考试招生和培养工作负总责。要统筹兼顾本校实际情况,深入研究,根据文件要求认真制定招生和培养方案,确保相关工作科学规范、公平公正、平稳有序。要加强宣传引导,深入细致地做好强基计划的宣传解读工作,积极开展面向考生和家长的政策咨询,及时回应社会关切,营造良好改革氛围。教育部将强基计划招生及人才培养工作纳入巡视和督导的工作范围,建立动态准入退出机制。</p><h2 id="附件1强基计划试点高校名单">附件1:强基计划试点高校名单</h2><p>北京大学、中国人民大学、清华大学、北京航空航天大学、北京理工大学、中国农业大学、北京师范大学、中央民族大学、南开大学、天津大学、大连理工大学、吉林大学、哈尔滨工业大学、复旦大学、同济大学、上海交通大学、华东师范大学、南京大学、东南大学、浙江大学、中国科学技术大学、厦门大学、山东大学、中国海洋大学、武汉大学、华中科技大学、中南大学、中山大学、华南理工大学、四川大学、重庆大学、电子科技大学、西安交通大学、西北工业大学、兰州大学、国防科技大学</p><h2id="附件2强基计划招生程序及管理要求">附件2:强基计划招生程序及管理要求</h2><h3 id="一制定招生简章">一、制定招生简章</h3><p>有关高校应根据本校的办学定位、学科特色等,制定强基计划招生简章,内容包括领导机构、招生专业及计划、报考条件及方式、入围高校考核的办法、考核程序及办法、学生综合素质评价使用办法、综合成绩折算办法及录取规则、监督机制、咨询及申诉渠道等。招生简章报经教育部核准备案后,于3月底前向社会公布。</p><h3 id="二考生申请报名">二、考生申请报名</h3><p>符合生源所在地当年高考报名条件以及强基计划招生学校报考条件的考生,由本人提出申请,于4月份按高校招生简章要求进行网上报名。省级招生考试机构要对本地报名考生的高考报名资格进行严格审核。</p><h3 id="三考生参加统一高考">三、考生参加统一高考</h3><p>报名考生均须参加全国统一高考。各省级招生考试机构原则上于6月25日前根据高校招生简章确定的规则,向有关高校提供报名考生高考成绩(不含高考加分)。</p><h3id="四确定入围高校考核名单并公示">四、确定入围高校考核名单并公示</h3><p>对于以高考成绩入围高校考核的,有关高校在各省(区、市)本科一批录取最低控制分数线(合并录取批次省份应单独划定相应分数线,下同)上,按照在生源所在省份强基计划招生名额的一定倍数,以考生高考成绩从高到低确定参加高校考核名单。</p><p>对于符合高校破格入围条件的考生,考生高考成绩应达到高校招生简章确定的要求,且原则上不得低于各省(区、市)本科一批录取最低控制分数线。</p><p>有关高校原则上应于6月26日前确定入围高校考核的考生名单并公示入围标准。</p><h3 id="五组织高校考核">五、组织高校考核</h3><p>有关高校于7月4日前完成对入围考生组织高校考核(含笔试、面试)和体育测试,其中体育测试结果作为录取的重要参考。</p><p>高校考核是国家教育考试的组成部分,由招生高校负责组织实施。有关高校要严格执行教育部关于特殊类型考试招生工作相关规定,合理确定高校考核的内容和形式。积极探索通过笔试、面试、实践操作等方式,考查学生分析问题、解决问题的能力和创新思维,增强选才的科学性。要充分运用学生综合素质档案,全面、深入地考察学生的能力和素养。要加强命题安全管理和质量管理,加强面试专家等相关人员名单的安全保密,认真执行回避制度。高校考核的笔试、面试应安排在国家教育考试标准化考点进行,面试采取专家、考生“双随机”抽签的方式,全程录音录像。</p><p>考生综合素质档案由省级教育行政部门或中学根据入围高校考核的考生名单于6月27日前提供。已建立省级统一信息平台的省份,由省级教育行政部门统一将考生电子化的综合素质档案提供招生高校。未建立省级统一信息平台的省份,由考生就读中学提供经中学校长签字确认的综合素质档案。综合素质档案须提前在考生就读中学详尽公示。</p><h3 id="六确定录取名单并公示">六、确定录取名单并公示</h3><p>有关高校将考生高考成绩、高校综合考核结果及综合素质评价情况等按比例合成考生综合成绩(其中高考成绩所占比例不得低于85%),并根据考生填报志愿,按综合成绩由高到低确定录取名单,提交生源所在省级招办办理录取手续。各省级招办应在提前批次录取开始前完成录取备案。破格录取的考生,按照高校招生简章公布办法进行录取。被录取考生不再参加后续高考志愿录取。有关高校须于7月5日前确定录取考生名单并公示录取标准。</p><h3id="七严格遵守强基计划招生十严禁">七、严格遵守强基计划招生“十严禁”</h3><p>高校不得发布未经教育部备案的强基计划招生简章或进行虚假招生宣传;</p><p>不得以任何形式组织与强基计划招生挂钩的冬令营、夏令营及考核工作,或委托个人或中介组织开展报名、考核等有关工作;</p><p>高校招生工作人员、专家评委不得参与社会机构组织的各类培训、辅导活动;</p><p>不得以“新生高额奖学金”“入校后重新选择专业”等方式进行恶性生源竞争或向考生违规承诺录取;</p><p>未经批准不得突破强基计划的招生计划录取;</p><p>不得在发放新生录取通知书或新生入学报到环节更改考生录取专业;</p><p>通过强基计划录取的学生入校后原则上不得转到相关学科之外的专业就读。</p><p>省级高校招生委员会和省级教育行政部门不得擅自扩大强基计划招生高校范围或出台与国家招生政策相抵触的招生办法。</p><p>省级招生考试机构不得为不符合要求的考生或违反规定程序办理录取手续。</p><p>有关中学等不得出具与事实不符的考生推荐材料、证明材料等或在考生综合素质档案中虚构事实或故意隐瞒事实。</p><h2 id="原文件">原文件</h2><p><imgsrc="https://gitee.com/andypl/imagehost/raw/master/img/1.jpeg" /> <imgsrc="https://gitee.com/andypl/imagehost/raw/master/img/2jpeg.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/3.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/4.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/5.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/6.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/7.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/8.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/9.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/10.jpeg" /><img src="https://gitee.com/andypl/imagehost/raw/master/img/11.jpeg" /><imgsrc="https://gitee.com/andypl/imagehost/raw/master/img/12.jpeg" /></p>]]></content>
<categories>
<category>其它</category>
</categories>
<tags>
<tag>强基计划</tag>
</tags>
</entry>
<entry>
<title>docker安装JupyterNotebook</title>
<link href="/2021/06/02/docker%E5%AE%89%E8%A3%85JupyterNotebook/"/>
<url>/2021/06/02/docker%E5%AE%89%E8%A3%85JupyterNotebook/</url>
<content type="html"><![CDATA[<h2 id="在docker中安装">在docker中安装</h2><figure class="highlight awk"><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><code class="hljs awk"><span class="hljs-comment"># 映射容器内jupyter的工作目录</span><br>mkdir <span class="hljs-regexp">/home/</span>jupyter<br><span class="hljs-comment"># 给jupyter写入文件夹的权限</span><br>chmod <span class="hljs-number">777</span> <span class="hljs-regexp">/home/</span>jupyter<br><span class="hljs-comment"># 映射端口和文件夹,安装科学计算高大全版本,有6个G吧</span><br>docker run -d -v <span class="hljs-regexp">/home/</span>jupyter:<span class="hljs-regexp">/home/</span>jovyan<span class="hljs-regexp">/work --name=jupyter -p 13579:8888 jupyter/</span>datascience-notebook<br><span class="hljs-comment"># 或者安装基本版本</span><br>docker run -d -v <span class="hljs-regexp">/home/</span>jupyter:<span class="hljs-regexp">/home/</span>jovyan<span class="hljs-regexp">/work --name=jupyter -p 13579:8888 jupyter/</span>base-notebook<br></code></pre></td></tr></table></figure><p>访问浏览器地址:127.0.0.1:13579(同时支持远程访问),会进入jupyter页面,首次需要输入token。</p><p>获取token的方法是 <code>docker logs jupyter</code>,然后会看到token字样。</p><p>从jupyter5开始,可以通过命令设置密码,首先<code>docker exec -it jupyter /bin/bash</code>连接jupyter的终端,然后<code>jupyter notebook password</code>,输入两次密码后,今后就默认启用密码登录jupyter了,不然每次都要输入token,重启容器生效</p><h2 id="安装主题及设置文字样式大小">安装主题及设置文字样式大小</h2><figure class="highlight mipsasm"><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><code class="hljs mipsasm"><span class="hljs-comment"># install jupyterthemes</span><br>pip <span class="hljs-keyword">install </span><span class="hljs-keyword">jupyterthemes</span><br><span class="hljs-keyword"></span><br><span class="hljs-keyword"># </span>upgrade to latest version<br>pip <span class="hljs-keyword">install </span>--upgrade <span class="hljs-keyword">jupyterthemes</span><br><span class="hljs-keyword"></span><br><span class="hljs-keyword"># </span>查看可用主题<br><span class="hljs-keyword">jt </span>-l<br><br><span class="hljs-comment"># 查看jt帮助</span><br><span class="hljs-keyword">jt </span>--help<br><br><span class="hljs-comment"># 个性化设置示例</span><br><span class="hljs-keyword">jt </span>-t onedork -f roboto -fs <span class="hljs-number">14</span> -nfs <span class="hljs-number">14</span> -tfs <span class="hljs-number">14</span> -ofs <span class="hljs-number">11</span><br></code></pre></td></tr></table></figure><p>重启容器生效</p><h2 id="安装插件">安装插件</h2><p>首先连接jupyter终端<code>docker exec -it jupyter /bin/bash</code></p><figure class="highlight mipsasm"><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><code class="hljs mipsasm"><span class="hljs-comment"># 安装</span><br>pip <span class="hljs-keyword">install </span><span class="hljs-keyword">jupyter_contrib_nbextensions</span><br><span class="hljs-keyword"> </span><br><span class="hljs-comment"># 配置</span><br><span class="hljs-keyword">jupyter </span>contrib nbextension <span class="hljs-keyword">install </span>--user --skip-running-check<br></code></pre></td></tr></table></figure><p>设置好开启的插件以后,重启容器生效,推荐开启 <code>Gist-it</code> 和<code>Hinterland</code> 插件</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>docker</tag>
<tag>jupyter</tag>
</tags>
</entry>
<entry>
<title>Selenium通过屏幕坐标定位</title>
<link href="/2021/05/26/Selenium%E9%80%9A%E8%BF%87%E5%B1%8F%E5%B9%95%E5%9D%90%E6%A0%87%E5%AE%9A%E4%BD%8D/"/>
<url>/2021/05/26/Selenium%E9%80%9A%E8%BF%87%E5%B1%8F%E5%B9%95%E5%9D%90%E6%A0%87%E5%AE%9A%E4%BD%8D/</url>
<content type="html"><![CDATA[<h2 id="示例代码">示例代码</h2><figure class="highlight pgsql"><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></pre></td><td class="code"><pre><code class="hljs pgsql"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver<br><span class="hljs-keyword">from</span> selenium.webdriver <span class="hljs-keyword">import</span> ActionChains<br><span class="hljs-keyword">from</span> <span class="hljs-type">time</span> <span class="hljs-keyword">import</span> sleep<br>dr = webdriver.Edge()<br><br>dr.<span class="hljs-keyword">get</span>(<span class="hljs-string">'https://www.baidu.com'</span>)<br>dr.maximize_window()<br><br>def click_locxy(dr, x, y):<br> ActionChains(dr).move_by_offset(x, y).click().<span class="hljs-keyword">perform</span>()<br> ActionChains(dr).move_by_offset(-x, -y).<span class="hljs-keyword">perform</span>()<br><br>sleep(<span class="hljs-number">5</span>)<br>click_locxy(dr, <span class="hljs-number">640</span>, <span class="hljs-number">400</span>)<br>sleep(<span class="hljs-number">5</span>)<br></code></pre></td></tr></table></figure>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>selenium</tag>
<tag>python</tag>
</tags>
</entry>
<entry>
<title>Selenium Python 教程</title>
<link href="/2021/05/25/Selenium-Python-%E6%95%99%E7%A8%8B/"/>
<url>/2021/05/25/Selenium-Python-%E6%95%99%E7%A8%8B/</url>
<content type="html"><![CDATA[<h2 id="准备工作">准备工作</h2><p>1.安装 <code>selenium</code></p><figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cmake">pip <span class="hljs-keyword">install</span> selenium<br></code></pre></td></tr></table></figure><p>2.下载浏览器驱动</p><p>Firefox浏览器驱动:geckodriver</p><p>Chrome浏览器驱动:chromedriver , taobao备用地址</p><p>IE浏览器驱动:IEDriverServer</p><p>Edge浏览器驱动:MicrosoftWebDriver</p><p>Opera浏览器驱动:operadriver</p><p>PhantomJS浏览器驱动:phantomjs</p><p><strong>需要把浏览器驱动放入系统路径中,或者直接告知selenuim的驱动路径</strong></p><p>3.简单示例:</p><figure class="highlight nix"><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><code class="hljs nix">from selenium <span class="hljs-built_in">import</span> webdriver<br><br><br><span class="hljs-attr">driver</span> = webdriver.Firefox() <span class="hljs-comment"># Firefox浏览器</span><br><span class="hljs-comment"># driver = webdriver.Firefox("驱动路径")</span><br><br><span class="hljs-attr">driver</span> = webdriver.Chrome() <span class="hljs-comment"># Chrome浏览器</span><br><br><span class="hljs-attr">driver</span> = webdriver.Ie() <span class="hljs-comment"># Internet Explorer浏览器</span><br><br><span class="hljs-attr">driver</span> = webdriver.Edge() <span class="hljs-comment"># Edge浏览器</span><br><br><span class="hljs-attr">driver</span> = webdriver.Opera() <span class="hljs-comment"># Opera浏览器</span><br><br><span class="hljs-attr">driver</span> = webdriver.PhantomJS() <span class="hljs-comment"># PhantomJS</span><br><br><span class="hljs-comment"># 打开网页</span><br>driver.get(url) <span class="hljs-comment"># 打开url网页 比如 driver.get("http://www.baidu.com")</span><br></code></pre></td></tr></table></figure><h2 id="元素定位">元素定位</h2><figure class="highlight stylus"><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><code class="hljs stylus"><span class="hljs-function"><span class="hljs-title">find_element_by_id</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_name</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_class_name</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_tag_name</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_link_text</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_partial_link_text</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_xpath</span><span class="hljs-params">()</span></span><br><span class="hljs-function"><span class="hljs-title">find_element_by_css_selector</span><span class="hljs-params">()</span></span><br></code></pre></td></tr></table></figure><p>** 浏览器中选择元素后,右键Copy可以选择获取到selector和xpath **</p><h2 id="控制浏览器操作">控制浏览器操作</h2><ul><li>控制浏览器窗口大小</li></ul><p><code>driver.set_window_size(768,1024)</code></p><ul><li>浏览器前进后退</li></ul><p><code>driver.back()</code></p><p><code>driver.forward()</code></p><ul><li>刷新</li></ul><p><code>driver.refresh()</code></p><h2 id="webelement常用方法">Webelement常用方法</h2><ul><li>点击和输入</li></ul><p><figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs less"><span class="hljs-selector-tag">driver</span><span class="hljs-selector-class">.find_element_by_id</span>(<span class="hljs-string">"kw"</span>)<span class="hljs-selector-class">.clear</span>() # 清除文本 <span class="hljs-selector-tag">driver</span><span class="hljs-selector-class">.find_element_by_id</span>(<span class="hljs-string">"kw"</span>)<span class="hljs-selector-class">.send_keys</span>(<span class="hljs-string">"selenium"</span>) # 模拟按键输入 <span class="hljs-selector-tag">driver</span><span class="hljs-selector-class">.find_element_by_id</span>(<span class="hljs-string">"su"</span>)<span class="hljs-selector-class">.click</span>() # 点击元素<br></code></pre></td></tr></table></figure></p><ul><li>提交</li></ul><p><figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs stylus">search_text = driver<span class="hljs-selector-class">.find_element_by_id</span>(<span class="hljs-string">'kw'</span>) search_text<span class="hljs-selector-class">.send_keys</span>(<span class="hljs-string">'selenium'</span>) search_text<span class="hljs-selector-class">.submit</span>()<br></code></pre></td></tr></table></figure></p><ul><li>其它</li></ul><p><strong>size</strong>:返回元素的尺寸</p><p><strong>text</strong>:返回元素的文本</p><p><strong>get_attribute(name)</strong>:获得属性值</p><p><strong>id_displayed()</strong>:设置该元素是否用户可见</p><h2 id="鼠标操作">鼠标操作</h2><p>在 WebDriver 中, 将这些关于鼠标操作的方法封装在 ActionChains类提供。</p><p>ActionChains 类提供了鼠标操作的常用方法:</p><ul><li>perform():执行所有ActionChains中存储的行为</li><li>context_click():右击</li><li>double_click():双击</li><li>drag_and_drop():拖动</li><li>move_to_element():鼠标悬停</li></ul><p>例如: <figure class="highlight pgsql"><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><code class="hljs pgsql"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver<br># 引入 ActionChains 类<br><span class="hljs-keyword">from</span> selenium.webdriver.common.action_chains <span class="hljs-keyword">import</span> ActionChains<br><br>driver = webdriver.Edge()<br>driver.<span class="hljs-keyword">get</span>("https://www.baidu.cn")<br><br># 定位到要悬停的元素<br>above = driver.find_element_by_link_text("设置")<br># 对定位到的元素执行鼠标悬停操作<br>ActionChains(driver).move_to_element(above).<span class="hljs-keyword">perform</span>()<br></code></pre></td></tr></table></figure></p><h2 id="键盘事件">键盘事件</h2><p>以下为常用的键盘操作:</p><ul><li>send_keys(Keys.BACK_SPACE) 删除键</li><li>send_keys(Keys.SPACE) 空格键</li><li>send_keys(Keys.TAB) 制表键</li><li>send_keys(Keys.ESCAPE) 回退键</li><li>send_keys(Keys.ENTER) 回车键</li><li>send_keys(Keys.CONTROL,'a') 全选</li><li>send_keys(Keys.CONTROL,'c') 复制</li><li>send_keys(Keys.CONTROL,'x') 剪切</li><li>send_keys(Keys.CONTROL,'v') 粘贴</li><li>send_keys(Keys.F1) 键盘 F1</li></ul><h2 id="获取断言信息">获取断言信息</h2><figure class="highlight ini"><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><code class="hljs ini"><span class="hljs-attr">title</span> = driver.title <span class="hljs-comment"># 打印当前页面title</span><br><span class="hljs-attr">now_url</span> = driver.current_url <span class="hljs-comment"># 打印当前页面URL</span><br><span class="hljs-attr">user</span> = driver.find_element_by_class_name(<span class="hljs-string">'nums'</span>).text <span class="hljs-comment"># # 获取结果数目</span><br></code></pre></td></tr></table></figure><h2 id="等待页面加载完成">等待页面加载完成</h2><ul><li>显示等待</li></ul><p>显式等待使WebdDriver等待某个条件成立时继续执行,否则在达到最大时长时抛出超时异常(TimeoutException)。</p><p><figure class="highlight stylus"><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><code class="hljs stylus"> from selenium import webdriver<br>from selenium<span class="hljs-selector-class">.webdriver</span><span class="hljs-selector-class">.common</span><span class="hljs-selector-class">.by</span> import By<br>from selenium<span class="hljs-selector-class">.webdriver</span><span class="hljs-selector-class">.support</span><span class="hljs-selector-class">.ui</span> import WebDriverWait<br>from selenium<span class="hljs-selector-class">.webdriver</span><span class="hljs-selector-class">.support</span> import expected_conditions as EC<br>driver = webdriver<span class="hljs-selector-class">.Edge</span>()<br>driver<span class="hljs-selector-class">.get</span>(<span class="hljs-string">"http://www.baidu.com"</span>)<br>element = WebDriverWait(driver, <span class="hljs-number">5</span>, <span class="hljs-number">0.5</span>)<span class="hljs-selector-class">.until</span>(<br> EC<span class="hljs-selector-class">.presence_of_element_located</span>((By<span class="hljs-selector-class">.ID</span>, <span class="hljs-string">"kw"</span>))<br> )<br>element<span class="hljs-selector-class">.send_keys</span>(<span class="hljs-string">'selenium'</span>)<br>driver<span class="hljs-selector-class">.quit</span>()<br></code></pre></td></tr></table></figure> WebDriverWait类是由WebDirver提供的等待方法。在设置时间内,默认每隔一段时间检测一次当前页面元素是否存在,如果超过设置时间检测不到则抛出异常。具体格式如下:</p><p><code>WebDriverWait(driver, timeout, poll_frequency=0.5, ignored_exceptions=None)</code></p><ul><li><p>driver :浏览器驱动。</p></li><li><p>timeout :最长超时时间,默认以秒为单位。</p></li><li><p>poll_frequency :检测的间隔(步长)时间,默认为0.5S。</p></li><li><p>ignored_exceptions:超时后的异常信息,默认情况下抛NoSuchElementException异常。</p></li><li><p>WebDriverWait()一般由until()或until_not()方法配合使用,下面是until()和until_not()方法的说明。</p></li><li><p>until(method, message=‘’)调用该方法提供的驱动程序作为一个参数,直到返回值为True。</p></li><li><p>until_not(method, message=‘’)调用该方法提供的驱动程序作为一个参数,直到返回值为False。</p></li><li><p>在本例中,通过as关键字将expected_conditions重命名为EC,并调用presence_of_element_located()方法判断元素是否存在。</p></li><li><p>隐式等待</p></li></ul><p>如果某些元素不是立即可用的,隐式等待是告诉WebDriver去等待一定的时间后去查找元素。默认等待时间是0秒,一旦设置该值,隐式等待是设置该WebDriver的实例的生命周期。</p><p><figure class="highlight sqf"><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><code class="hljs sqf"> <span class="hljs-keyword">from</span> selenium import webdriver<br><span class="hljs-built_in">driver</span> = webdriver.Edge() <br><span class="hljs-built_in">driver</span>.implicitly_wait(<span class="hljs-number">10</span>) <span class="hljs-meta"># seconds </span><br><span class="hljs-built_in">driver</span>.get(<span class="hljs-string">"http://somedomain/url_that_delays_loading"</span>) <br>myDynamicElement = <span class="hljs-built_in">driver</span>.find_element_by_id(<span class="hljs-string">"myDynamicElement"</span>) <br></code></pre></td></tr></table></figure></p><h2 id="在不同的窗口和框架之间移动">在不同的窗口和框架之间移动</h2><figure class="highlight ceylon"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs ceylon">driver.<span class="hljs-keyword">switch</span><span class="hljs-number">_</span>to<span class="hljs-number">_</span>window(<span class="hljs-string">"windowName"</span>)<br>driver.<span class="hljs-keyword">switch</span><span class="hljs-number">_</span>to<span class="hljs-number">_f</span>rame(<span class="hljs-string">"frameName"</span>)<br></code></pre></td></tr></table></figure><p>以直接取表单的id或name属性。如果iframe没有可用的id和name属性,则可以通过下面的方式进行定位:<figure class="highlight reasonml"><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><code class="hljs reasonml">#先通过xpth定位到iframe<br>xf = driver.find<span class="hljs-constructor">_element_by_xpath('<span class="hljs-operator">/</span><span class="hljs-operator">/</span><span class="hljs-operator">*</span>[@<span class="hljs-params">id</span>=<span class="hljs-string">"x-URS-iframe"</span>]')</span><br><br>#再将定位对象传给switch<span class="hljs-constructor">_to_frame()</span>方法<br>driver.switch<span class="hljs-constructor">_to_frame(<span class="hljs-params">xf</span>)</span><br></code></pre></td></tr></table></figure> 一旦我们完成了frame中的工作,我们可以这样返回父frame:<figure class="highlight ceylon"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ceylon">driver.<span class="hljs-keyword">switch</span><span class="hljs-number">_</span>to<span class="hljs-number">_</span><span class="hljs-keyword">default</span><span class="hljs-number">_</span>content()<br></code></pre></td></tr></table></figure></p><h2 id="警告框处理">警告框处理</h2><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ini"><span class="hljs-attr">alert</span> = driver.switch_to_alert()<br></code></pre></td></tr></table></figure><ul><li><p>text:返回 alert/confirm/prompt 中的文字信息。</p></li><li><p>accept():接受现有警告框。</p></li><li><p>dismiss():解散现有警告框。</p></li><li><p>send_keys(keysToSend):发送文本至警告框。keysToSend:将文本发送至警告框。</p></li></ul><h2 id="下拉框选择">下拉框选择</h2><figure class="highlight pgsql"><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><code class="hljs pgsql"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver<br><span class="hljs-keyword">from</span> selenium.webdriver.support.<span class="hljs-keyword">select</span> <span class="hljs-keyword">import</span> <span class="hljs-keyword">Select</span><br><span class="hljs-keyword">from</span> <span class="hljs-type">time</span> <span class="hljs-keyword">import</span> sleep<br><br>driver = webdriver.Chrome()<br>driver.implicitly_wait(<span class="hljs-number">10</span>)<br>driver.<span class="hljs-keyword">get</span>(<span class="hljs-string">'http://www.baidu.com'</span>)<br>sel = driver.find_element_by_xpath("//select[@id='nr']")<br><span class="hljs-keyword">Select</span>(sel).select_by_value(<span class="hljs-string">'50'</span>) # 显示<span class="hljs-number">50</span>条<br></code></pre></td></tr></table></figure><h2 id="文件上传">文件上传</h2><figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs reasonml">driver.find<span class="hljs-constructor">_element_by_name(<span class="hljs-string">"file"</span>)</span>.send<span class="hljs-constructor">_keys('D:\\<span class="hljs-params">upload_file</span>.<span class="hljs-params">txt</span>')</span> # 定位上传按钮,添加本地文件<br></code></pre></td></tr></table></figure><h2 id="cookies操作">Cookies操作</h2><p>WebDriver操作cookie的方法:</p><ul><li>get_cookies(): 获得所有cookie信息。</li><li>get_cookie(name): 返回字典的key为“name”的cookie信息。</li><li>add_cookie(cookie_dict) :添加cookie。“cookie_dict”指字典对象,必须有name 和value 值。</li><li>delete_cookie(name,optionsString):删除cookie信息。“name”是要删除的cookie的名称,“optionsString”是该cookie的选项,目前支持的选项包括“路径”,“域”。</li><li>delete_all_cookies(): 删除所有cookie信息</li></ul><h2 id="调用javascript代码">调用JavaScript代码</h2><figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs makefile">js=<span class="hljs-string">"window.scrollTo(100,450);"</span><br>driver.execute_script(js) <span class="hljs-comment"># 通过javascript设置浏览器窗口的滚动条位置</span><br></code></pre></td></tr></table></figure><h2 id="窗口截图">窗口截图</h2><figure class="highlight 1c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs 1c">driver.get_screenshot_as_file(<span class="hljs-string">"D:\\baidu_img.jpg"</span>) <span class="hljs-meta"># 截取当前窗口,并指定截图图片的保存位置</span><br></code></pre></td></tr></table></figure><h2 id="关闭浏览器">关闭浏览器</h2><ul><li>close() 关闭单个标签</li><li>quit() 关闭所有标签</li></ul><h2 id="直接用cookie登录方法">直接用cookie登录方法</h2><p>https://www.jianshu.com/p/773c58406bdb</p><h2 id="原文链接">原文链接</h2><p>https://zhuanlan.zhihu.com/p/111859925</p><p>https://selenium-python-zh.readthedocs.io/en/latest/navigating.html</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>selenium</tag>
<tag>python</tag>
</tags>
</entry>
<entry>
<title>端点函数值为零求导不要停</title>
<link href="/2021/05/24/%E7%AB%AF%E7%82%B9%E5%87%BD%E6%95%B0%E5%80%BC%E4%B8%BA%E9%9B%B6%EF%BC%8C%E6%B1%82%E5%AF%BC%E4%B8%8D%E8%A6%81%E5%81%9C-1/"/>
<url>/2021/05/24/%E7%AB%AF%E7%82%B9%E5%87%BD%E6%95%B0%E5%80%BC%E4%B8%BA%E9%9B%B6%EF%BC%8C%E6%B1%82%E5%AF%BC%E4%B8%8D%E8%A6%81%E5%81%9C-1/</url>
<content type="html"><![CDATA[<div class="note note-info"> <p><spanclass="label label-danger">庆祝剑群周题100期导数100-1</span>已知函数<spanclass="math inline">\(f(x)=(2+x+ax^2)\ln(1+x)-2x\)</span></p><p>(1)若<span class="math inline">\(a=0\)</span>,证明:当<spanclass="math inline">\(-1<x<0\)</span>时,<spanclass="math inline">\(f(x)<0\)</span>;当<spanclass="math inline">\(x>0\)</span>时,<spanclass="math inline">\(f(x)>0\)</span></p><p>(2)若<span class="math inline">\(x=0\)</span>是<spanclass="math inline">\(f(x)\)</span>的极大值点,求<spanclass="math inline">\(a\)</span>的值</p> </div><div class="note note-primary"> <p>(1)证明:<spanclass="math inline">\(f(x)=(2+x)\ln(1+x)-2x\)</span>,令<spanclass="math inline">\(g(x)=\ln(1+x)-\dfrac{2x}{2+x}\)</span></p><p>则<spanclass="math inline">\(g'(x)=\dfrac{x^2}{(x+1)(x+2)}\ge0\)</span>,于是<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((-1,+\infty)\)</span>单增,又<spanclass="math inline">\(g(0)=0\)</span>,</p><p>则当<span class="math inline">\(-1<x<0\)</span>时,<spanclass="math inline">\(f(x)=(2+x)g(x)<0\)</span>;当<spanclass="math inline">\(x>0\)</span>时,<spanclass="math inline">\(f(x)=(2+x)g(x)>0\)</span></p><p>(2)<spanclass="math inline">\(f'(x)=(2ax+1)\ln(x+1)+\dfrac{ax^2-x}{x+1},f'(0)=0\)</span></p><p><spanclass="math inline">\(f''(x)=2a\ln(x+1)+\dfrac{3ax^2+(4a+1)x}{(x+1)^2},f''(0)=0\)</span></p><p><spanclass="math inline">\(f'''(x)=\dfrac{2ax^2+(6a-1)x+6a+1}{(x+1)^3},f'''(0)=6a+1\)</span></p><p>情形一:<span class="math inline">\(a\ge0\)</span>时</p><p><span class="math inline">\(\forall x\ge0\)</span>,<spanclass="math inline">\(f''(x)\ge0\)</span>,则<spanclass="math inline">\(f'(x)\)</span>在<spanclass="math inline">\([0,+\infty)\)</span>单增,于是<spanclass="math inline">\(f'(x)\ge0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\([0,+\infty)\)</span>单增,则<spanclass="math inline">\(x=0\)</span>不是极大值点</p><p>情形二:<span class="math inline">\(a<0\)</span>时</p><p>记<spanclass="math inline">\(h(x)=2ax^2+(6a-1)x+6a+1\)</span>,对称轴<spanclass="math inline">\(x=-\dfrac{3}{2}+\dfrac{1}{4a}<-1\)</span>,分以下四种i情况讨论:</p><p>①若<span class="math inline">\(h(0)=6a+1=0\)</span>,即<spanclass="math inline">\(a=-\dfrac{1}{6}\)</span>时,<spanclass="math inline">\(x\in(-1,0)\)</span>时,<spanclass="math inline">\(h(x)>0\)</span>,即<spanclass="math inline">\(f'''(x)>0\)</span>,则<spanclass="math inline">\(f''(x)\)</span>单增,<spanclass="math inline">\(f''(x)<0\)</span>,于是 <spanclass="math inline">\(f'(x)\)</span>单减,<spanclass="math inline">\(f'(x)>0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-1,0)\)</span>单增;<spanclass="math inline">\(x\in(0,+\infty)\)</span>时,<spanclass="math inline">\(h(x)<0\)</span>,即<spanclass="math inline">\(f'''(x)<0\)</span>,同理可得<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>单减,于是<spanclass="math inline">\(x=0\)</span>是<spanclass="math inline">\(f(x)\)</span>的极大值点</p><p>②若<span class="math inline">\(h(0)=6a+1>0\)</span>,即<spanclass="math inline">\(-\dfrac{1}{6}<a<0\)</span>时,<spanclass="math inline">\(\exists x_0\in(0,+\infty)\)</span>使得<spanclass="math inline">\(h(x_0)=0\)</span>,则<spanclass="math inline">\(x\in(0,x_0)\)</span>时,<spanclass="math inline">\(h(x)>0\)</span>,即<spanclass="math inline">\(f'''(x)>0\)</span>,于是<spanclass="math inline">\(f''(x)\)</span>单增,则<spanclass="math inline">\(f''(x)>0\)</span>,于是<spanclass="math inline">\(f'(x)\)</span>单增,则<spanclass="math inline">\(f'(x)>0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,x_0)\)</span>单增,则<spanclass="math inline">\(x=0\)</span>不是极大值点</p><p>③若<span class="math inline">\(h(0)=6a+1<0\)</span>且<spanclass="math inline">\(h(-1)=2a+2>0\)</span>,即<spanclass="math inline">\(-1<a<-\dfrac{1}{6}\)</span>时,<spanclass="math inline">\(\exists x_1\in(-1,0)\)</span>使得<spanclass="math inline">\(h(x_1)=0\)</span>,则<spanclass="math inline">\(x\in(x_1,0)\)</span>时,<spanclass="math inline">\(h(x)<0\)</span>,即<spanclass="math inline">\(f'''(x)<0\)</span>,与②同理可得<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((x_1,0)\)</span>单减,则<spanclass="math inline">\(x=0\)</span>不是极大值点</p><p>④若<span class="math inline">\(h(-1)=2a+2\le0\)</span>,即<spanclass="math inline">\(a\le-1\)</span>时,<spanclass="math inline">\(x\in(-1,0)\)</span>时,<spanclass="math inline">\(h(x)<0\)</span>,即<spanclass="math inline">\(f'''(x)<0\)</span>,同③可得<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((-1,0)\)</span>单减,则<spanclass="math inline">\(x=0\)</span>不是极大值点</p><p>综上,<span class="math inline">\(a=-\dfrac{1}{6}\)</span></p><p align="right"><code>pl</code></p> </div><div class="note note-info"> <p><spanclass="label label-danger">庆祝剑群周题100期导数100-2</span>已知函数<spanclass="math inline">\(f(x)=\ln x+ax^2+(2a+1)x\)</span></p><p>(1)讨论<spanclass="math inline">\(f(x)\)</span>的单调性;(2)当<spanclass="math inline">\(a<0\)</span>时,证明:<spanclass="math inline">\(f(x)\le-\dfrac{3}{4a}-2\)</span></p> </div><div class="note note-primary"> <p>(1)解:<spanclass="math inline">\(f'(x)=\dfrac{2ax^2+(2a+1)x+1}{x},x>0\)</span></p><p>当<span class="math inline">\(a\ge0\)</span>时,<spanclass="math inline">\(f'(x)>0\)</span>,则<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,+\infty)\)</span>单增;</p><p>当<span class="math inline">\(a<0\)</span>时,<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,-\dfrac{1}{2a})\)</span>单增,<spanclass="math inline">\((-\dfrac{1}{2a},+\infty)\)</span>单减</p><p>(2)由(1)知<spanclass="math inline">\(f(x)_{\max}=f(-\dfrac{1}{2a})=\ln(-\dfrac{1}{2a})-\dfrac{1}{4a}-1\)</span></p><p>则<spanclass="math inline">\(\ln(-\dfrac{1}{2a})-\dfrac{1}{4a}-1\le-\dfrac{3}{4a}-2\)</span>等价于<spanclass="math inline">\(\ln(-\dfrac{1}{2a})\le-\dfrac{1}{2a}-1\)</span>,易证<spanclass="math inline">\(\ln x\le x-1\)</span>,略</p><p align="right"><code>pl</code></p> </div><div class="note note-info"> <p><spanclass="label label-danger">庆祝剑群周题100期导数100-3</span>记<spanclass="math inline">\(f'(x),g'(x)\)</span>分别是函数<spanclass="math inline">\(f(x),g(x)\)</span>的导函数.若存在<spanclass="math inline">\(x_0\in\mathbb{R}\)</span>,满足<spanclass="math inline">\(f(x_0)=g(x_0)\)</span>且<spanclass="math inline">\(f'(x_0)=g'(x_0)\)</span>,则称<spanclass="math inline">\(x_0\)</span>为函数<spanclass="math inline">\(f(x)\)</span>与<spanclass="math inline">\(g(x)\)</span>的一个“<spanclass="math inline">\(S\)</span>点”</p><p>(1)证明:函数<span class="math inline">\(f(x)=x\)</span>与<spanclass="math inline">\(g(x)=x^2+2x-2\)</span>不存在“<spanclass="math inline">\(S\)</span>点”;</p><p>(2)若函数<span class="math inline">\(f(x)=ax^2-1\)</span>与<spanclass="math inline">\(g(x)=\ln x\)</span>存在“<spanclass="math inline">\(S\)</span>点”,求实数<spanclass="math inline">\(a\)</span>的值;</p><p>(3)已知函数<span class="math inline">\(f(x)=-x^2+a\)</span>,<spanclass="math inline">\(g(x)=\dfrac{be^x}{x}\)</span>,对任意<spanclass="math inline">\(a>0\)</span>,判断是否存在<spanclass="math inline">\(b>0\)</span>,使函数<spanclass="math inline">\(f(x)\)</span>与<spanclass="math inline">\(g(x)\)</span>在区间<spanclass="math inline">\((0,+\infty)\)</span>内存在“<spanclass="math inline">\(S\)</span>点”,并说明理由</p> </div><div class="note note-primary"> <p>(1)证明:<span class="math inline">\(\begin{cases}x^2+2x-2=x\\2x+2=1 \end{cases}\)</span>方程组无解,即不存在“<spanclass="math inline">\(S\)</span>点”</p><p>(2)解:<span class="math inline">\(\begin{cases}ax^2-1=\ln x\\2ax=\dfrac{1}{x} \end{cases}\)</span>,解得<spanclass="math inline">\(\begin{cases}a=\dfrac{e}{2}\\x=\dfrac{\sqrt{e}}{e} \end{cases}\)</span></p><p>(3)解:考虑<spanclass="math inline">\(\begin{cases}-x^2+a=\dfrac{be^x}{x} \quad①\\-2x=\dfrac{be^x(x-1)}{x^2}\quad② \end{cases}\)</span>若有解,由②知<spanclass="math inline">\(x\in(0,1)\)</span>,消去<spanclass="math inline">\(b\)</span>化简得<spanclass="math inline">\(h(x)=x^3-3x^2-ax+a=0\)</span>,</p><p>对任意<span class="math inline">\(a>0\)</span>,<spanclass="math inline">\(h(0)=a>0,h(1)=-2<0\)</span>,于是<spanclass="math inline">\(h(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>一定存在零点<spanclass="math inline">\(x_0\)</span></p><p>即对任意<span class="math inline">\(a>0\)</span>,存在<spanclass="math inline">\(b=\dfrac{2x_0^3}{e^{x_0}(1-x_0)}\)</span>满足条件</p><p align="right"><code>pl</code></p> </div>]]></content>
<categories>
<category>数学</category>
<category>导数</category>
</categories>
<tags>
<tag>导数</tag>
<tag>高考题</tag>
</tags>
</entry>
<entry>
<title>Hexo Admin后台管理使用记录</title>
<link href="/2021/05/23/Hexo-Admin%E5%90%8E%E5%8F%B0%E7%AE%A1%E7%90%86%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/"/>
<url>/2021/05/23/Hexo-Admin%E5%90%8E%E5%8F%B0%E7%AE%A1%E7%90%86%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/</url>
<content type="html"><![CDATA[<h2 id="插件设计初衷">插件设计初衷</h2><p>该插件最初设计为本地编辑器-您在本地运行hexo,使用<code>hexo-admin</code> 撰写帖子,然后使用<code>hexo generate</code> 或<code>hexo deploy</code>将生成的静态HTML文件发送到github页面或其他静态服务器。</p><p>但是,只要您使用非静态托管服务(例如Heroku,DigitalOcean等),就可以在实时博客上运行hexo-admin。<strong>静态托管服务(例如Github页面和Surge.sh)不支持运行hexo-admin从您的实时站点。</strong>如果您是通过实时博客使用Hexoadmin,则一定要设置密码(请参见下文),否则任何人都可以编辑您的内容。</p><h2 id="安装插件">安装插件</h2><figure class="highlight awk"><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><code class="hljs awk">npm install --save hexo-admin<br>hexo server -d<br>open http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4000</span><span class="hljs-regexp">/admin/</span><br></code></pre></td></tr></table></figure><h2 id="插件设置">插件设置</h2><p>以下1,2步针对实时服务器上使用Hexoadmin,需要设置密码保护,<span class="label label-warning">本地用户可跳过</span></p><p>1.登录后台,点击 <code>Settings</code> --<code>Setup authentification here</code>,输入用户名,登录密码和一个叫做 <code>Secret</code>的项,用来加密cookies的,越长越好,设置好以后会在下方生成配置信息</p><p>2.站贴以上配置信息到hexo的 <code>_config.yml</code> ,例如:<figure class="highlight apache"><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><code class="hljs apache"><span class="hljs-attribute">admin</span>:<br> <span class="hljs-attribute">username</span>: myfavoritename<br> <span class="hljs-attribute">password_hash</span>: be<span class="hljs-number">121740</span>bf<span class="hljs-number">988</span>b<span class="hljs-number">2225</span>a<span class="hljs-number">313</span>fa<span class="hljs-number">1</span>f<span class="hljs-number">107</span>ca<span class="hljs-number">1</span><br> <span class="hljs-attribute">secret</span>: a secret something<br><br></code></pre></td></tr></table></figure></p><p>3.设置插件中的 <code>Deploy</code> 功能:<span class="label label-info">设置的好处点下鼠标就部署了</span></p><p>①添加下列信息到 <code>_config.yml</code> <figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli">admin:<br> <span class="hljs-keyword">deploy</span>Command: '<span class="hljs-string">./deploy.sh</span><br></code></pre></td></tr></table></figure>②在hexo文件夹下创建文件 <code>deploy.sh</code> ,修改权限<span class="label label-danger">chmod +x deploy.sh</span>,然后写入如下内容: <figure class="highlight bash"><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><code class="hljs bash"><span class="hljs-meta">#!/bin/sh</span><br>hexo g -d<br><span class="hljs-comment"># 如果安装了hexo backup插件</span><br><span class="hljs-comment"># hexo bakcup</span><br></code></pre></td></tr></table></figure></p><h2 id="小贴士">小贴士</h2><p>在vps端运行时,可以使用 <code>nohup</code>命令在后台运行,关闭终端以后不会杀进程 <figure class="highlight arcade"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs arcade">nohup hexo server > <span class="hljs-regexp">/dev/</span><span class="hljs-literal">null</span> <span class="hljs-number">2</span>>&<span class="hljs-number">1</span> &<br></code></pre></td></tr></table></figure> 其中<code>> /dev/null</code> 将 <code>nohup</code>的日志输出到linux的黑洞,<code>2>&1</code>将标准错误信息重定向到标准输出,那么也进了黑洞,也就是说不想让<code>nohup</code> 输出任何信息。最后一个 <code>&</code>表示在后台运行,不会占用当前的终端显示。</p>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title>测试是否hexo backup</title>
<link href="/2021/05/22/%E6%B5%8B%E8%AF%95%E6%98%AF%E5%90%A6hexo-backup/"/>
<url>/2021/05/22/%E6%B5%8B%E8%AF%95%E6%98%AF%E5%90%A6hexo-backup/</url>
<content type="html"><![CDATA[<p>测试</p>]]></content>
</entry>
<entry>
<title>放缩处理端点函数值取极限的情况</title>
<link href="/2021/05/22/%E6%94%BE%E7%BC%A9%E5%A4%84%E7%90%86%E7%AB%AF%E7%82%B9%E5%87%BD%E6%95%B0%E5%80%BC%E5%8F%96%E6%9E%81%E9%99%90%E7%9A%84%E6%83%85%E5%86%B5/"/>
<url>/2021/05/22/%E6%94%BE%E7%BC%A9%E5%A4%84%E7%90%86%E7%AB%AF%E7%82%B9%E5%87%BD%E6%95%B0%E5%80%BC%E5%8F%96%E6%9E%81%E9%99%90%E7%9A%84%E6%83%85%E5%86%B5/</url>
<content type="html"><![CDATA[<h2id="放缩处理端点函数值取极限的情况">放缩处理端点函数值取极限的情况</h2><div class="note note-info"> <p>证明:<span class="math inline">\(x\ln x<e^x-x^2-1\)</span></p> </div><div class="note note-primary"> <p>证:即证<span class="math inline">\(f(x)=\dfrac{x\lnx+x^2+1}{e^x}<1\)</span></p><p><span class="math inline">\(f'(x)=(\ln x+1+2x-x\lnx-x^2-1)e^{-x}=[(1-x)\ln x-(1-x)^2]e^{-x}=(1-x)(\lnx+x-1)e^{-x}\)</span></p><p>则<span class="math inline">\(x\in(0,1)\)</span>时,<spanclass="math inline">\(f'(x)<0\)</span>,<spanclass="math inline">\(f(x)\)</span>单减;<spanclass="math inline">\(x\in[1,+\infty)\)</span>时,<spanclass="math inline">\(f'(x)<0\)</span>,<spanclass="math inline">\(f(x)\)</span>单减</p><p>则<span class="math inline">\(x\in[1,+\infty)\)</span>时,<spanclass="math inline">\(f(x)\le f(1)=\dfrac{2}{e}<1\)</span></p><p><span class="math inline">\(x\in(0,1)\)</span>时,由于<spanclass="math inline">\(x\ln x<0\)</span>,则<spanclass="math inline">\(f(x)<\dfrac{x^2+1}{e^x}=g(x)\)</span>,<spanclass="math inline">\(g'(x)=-(x-1)^2e^{-x}<0\)</span>,于是<spanclass="math inline">\(g(x)\)</span>在<spanclass="math inline">\((0,1)\)</span>单减,<spanclass="math inline">\(g(x)<g(0)=1\)</span>,则<spanclass="math inline">\(f(x)<1\)</span></p><p>综上<span class="math inline">\(f(x)<1\)</span>成立</p> </div><div class="note note-danger"> <p>评:</p><ol type="1"><li><p>野猪说:“对数单身狗,指数找基友”</p></li><li><p><span class="math inline">\(f(x)\)</span>在<spanclass="math inline">\((0,+\infty)\)</span>单减,尴尬的是中学阶段不能用极限说明<spanclass="math inline">\(f(x)\)</span>在<spanclass="math inline">\(x=0\)</span>的极限值为0</p></li><li><p>由于<span class="math inline">\(f(x)\)</span>的上确界是在<spanclass="math inline">\(x=0\)</span>取到的,而<spanclass="math inline">\(x\ln x\)</span>的极限值也为0,并且刚好<spanclass="math inline">\(x\in(0,1)\)</span>时<spanclass="math inline">\(x\ln x<0\)</span>,那么将<spanclass="math inline">\(f(x)\)</span>去掉<span class="math inline">\(x\lnx\)</span>放大成<span class="math inline">\(g(x)\)</span>后,<spanclass="math inline">\(g(x)\)</span>上界是不变的,只需要保证<spanclass="math inline">\(g(x)\)</span>单调递减就可以了。</p></li></ol> </div>]]></content>
<categories>
<category>数学</category>
<category>导数</category>
</categories>
<tags>
<tag>导数</tag>
<tag>放缩</tag>
<tag>单身狗与基友</tag>
</tags>
</entry>
<entry>
<title>Fluid主题脚注、标签、多图的语法</title>
<link href="/2021/05/20/Fluid%E4%B8%BB%E9%A2%98%E8%84%9A%E6%B3%A8%E3%80%81%E6%A0%87%E7%AD%BE%E3%80%81%E5%A4%9A%E5%9B%BE%E7%9A%84%E8%AF%AD%E6%B3%95/"/>
<url>/2021/05/20/Fluid%E4%B8%BB%E9%A2%98%E8%84%9A%E6%B3%A8%E3%80%81%E6%A0%87%E7%AD%BE%E3%80%81%E5%A4%9A%E5%9B%BE%E7%9A%84%E8%AF%AD%E6%B3%95/</url>
<content type="html"><![CDATA[<h2 id="脚注">脚注</h2><p>主题内置了脚注语法支持,可以在文章末尾自动生成带有锚点的脚注,该功能在<strong>主题配置</strong>中默认开启:</p><figure class="highlight yaml"><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><code class="hljs yaml"><span class="hljs-attr">post:</span><br> <span class="hljs-attr">footnote:</span><br> <span class="hljs-attr">enable:</span> <span class="hljs-literal">true</span><br> <span class="hljs-attr">header:</span> <span class="hljs-string">''</span><br></code></pre></td></tr></table></figure><p>脚注语法如下:</p><figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs markdown">这是一句话<sup id="fnref:1" class="footnote-ref"><a href="#fn:1" rel="footnote"><span class="hint--top hint--rounded" aria-label="参考资料1">[1]</span></a></sup><br>[<span class="hljs-symbol">^1</span>]: <span class="hljs-link">这是对应的脚注</span><br></code></pre></td></tr></table></figure><p>显示效果:</p><div class="note note-primary"> <p>这句话带脚注<sup id="fnref:1" class="footnote-ref"><a href="#fn:1" rel="footnote"><spanclass="hint--top hint--rounded" aria-label="参考资料1">[1]</span></a></sup></p><p>这句话也带脚注<sup id="fnref:2" class="footnote-ref"><a href="#fn:2" rel="footnote"><spanclass="hint--top hint--rounded" aria-label="参考资料2">[2]</span></a></sup></p> </div><h2 id="标签">标签</h2><p>在 markdown 中加入如下的代码来使用便签:</p><figure class="highlight markdown"><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><code class="hljs markdown">{% note success %}<br>文字 或者 <span class="hljs-code">`markdown`</span> 均可<br>{% endnote %}<br></code></pre></td></tr></table></figure><p>或者使用 HTML 形式:</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"note note-primary"</span>></span>标签<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br></code></pre></td></tr></table></figure><p>可选标签<code>primary,secondary,success,danger,warning,info,light</code>显示效果:</p><div class="note note-primary"> <p>primary</p> </div><div class="note note-secondary"> <p>secondary</p> </div><div class="note note-success"> <p>success</p> </div><div class="note note-danger"> <p>danger</p> </div><div class="note note-warning"> <p>warning</p> </div><div class="note note-info"> <p>info</p> </div><div class="note note-light"> <p>light</p> </div><h3 id="行内标签">行内标签</h3><p>在 markdown 中加入如下的代码来使用 Label:</p><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs css">{% <span class="hljs-selector-tag">label</span> primary <span class="hljs-keyword">@text</span> %}<br></code></pre></td></tr></table></figure><p>或者使用 HTML 形式:</p><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">span</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"label label-primary"</span>></span>Label<span class="hljs-tag"></<span class="hljs-name">span</span>></span><br></code></pre></td></tr></table></figure><p>效果展示:</p><span class="label label-primary">primary</span><span class="label label-secondary">secondary</span><span class="label label-success">success</span><span class="label label-danger">danger</span><span class="label label-warning">warning</span><span class="label label-info">info</span><span class="label label-light">light</span><h2 id="组图">组图</h2><p>如果想把多张图片按一定布局组合显示,你可以在 markdown中按如下格式:</p><figure class="highlight less"><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></pre></td><td class="code"><pre><code class="hljs less">{% <span class="hljs-selector-tag">gi</span> <span class="hljs-selector-tag">total</span> <span class="hljs-selector-tag">n1-n2-</span>... %}<br> !<span class="hljs-selector-attr">[]</span>(url)<br> !<span class="hljs-selector-attr">[]</span>(url)<br> !<span class="hljs-selector-attr">[]</span>(url)<br> !<span class="hljs-selector-attr">[]</span>(url)<br> !<span class="hljs-selector-attr">[]</span>(url)<br>{% <span class="hljs-selector-tag">endgi</span> %}<br></code></pre></td></tr></table></figure><p>total:图片总数量,对应中间包含的图片 url 数量n1-n2-...:每行的图片数量,可以省略,默认单行最多 3 张图,求和必须相等于total,否则按默认样式</p><p>例如 <code>{% gi 5 3-2 %}</code> 代表共 5 张图,第一行 3张图,第二行 2 张图。</p><h2 id="参考">参考</h2><section class="footnotes"><div class="footnote-list"><ol><li><span id="fn:1" class="footnote-text"><span>参考资料1<a href="#fnref:1" rev="footnote" class="footnote-backref">↩︎</a></span></span></li><li><span id="fn:2" class="footnote-text"><span>参考资料2<a href="#fnref:2" rev="footnote" class="footnote-backref">↩︎</a></span></span></li></ol></div></section>]]></content>
<categories>
<category>折腾</category>
</categories>
<tags>
<tag>hexo</tag>
<tag>fluid</tag>
</tags>
</entry>
<entry>
<title>椭圆上两点连线过定点问题的简化计算</title>
<link href="/2021/05/20/%E6%A4%AD%E5%9C%86%E4%B8%8A%E4%B8%A4%E7%82%B9%E8%BF%9E%E7%BA%BF%E8%BF%87%E5%AE%9A%E7%82%B9%E9%97%AE%E9%A2%98%E7%9A%84%E7%AE%80%E5%8C%96%E8%AE%A1%E7%AE%97/"/>
<url>/2021/05/20/%E6%A4%AD%E5%9C%86%E4%B8%8A%E4%B8%A4%E7%82%B9%E8%BF%9E%E7%BA%BF%E8%BF%87%E5%AE%9A%E7%82%B9%E9%97%AE%E9%A2%98%E7%9A%84%E7%AE%80%E5%8C%96%E8%AE%A1%E7%AE%97/</url>
<content type="html"><![CDATA[<h2id="椭圆上两点连线过定点问题的计算优化">椭圆上两点连线过定点问题的计算优化</h2><p><strong>题</strong></p><p>已知椭圆<spanclass="math inline">\(C:\dfrac{x^2}{a^2}+y^2=1(a>1)\)</span>的左焦点为<spanclass="math inline">\(F\)</span>,直线<spanclass="math inline">\(y=kx(k>0)\)</span>与<spanclass="math inline">\(C\)</span>交于<spanclass="math inline">\(A,B\)</span>两点,且<spanclass="math inline">\(\overrightarrow{FA}\cdot\overrightarrow{FB}=0\)</span>时,<spanclass="math inline">\(k=\dfrac{\sqrt3}{3}\)</span></p><p>(1)求<span class="math inline">\(a\)</span>的值;</p><p>(2)若线段<spanclass="math inline">\(AF,BF\)</span>的延长线分别交<spanclass="math inline">\(C\)</span>于<spanclass="math inline">\(D,E\)</span>两点,当<spanclass="math inline">\(k\)</span>变化时,直线<spanclass="math inline">\(DE\)</span>是否过定点?若是,求出该定点坐标</p><p><strong>解:</strong>(1)由<spanclass="math inline">\(\overrightarrow{FA}\cdot\overrightarrow{FB}=0\)</span>,即<spanclass="math inline">\((\overrightarrow{FO}+\overrightarrow{OA})\cdot(\overrightarrow{FO}+\overrightarrow{OB})=0\)</span>,化简得<spanclass="math inline">\(\overrightarrow{FO}^2=\overrightarrow{OA}^2\)</span>,则<spanclass="math inline">\(|\overrightarrow{FO}|=|\overrightarrow{OA}|=c\)</span>,于是<spanclass="math inline">\(A(\dfrac{\sqrt3}{2}c,\dfrac{1}{2}c)\)</span>代入椭圆方程得</p><p><spanclass="math inline">\(\begin{cases}\dfrac{\dfrac{3}{4}c^2}{a^2}+\dfrac{1}{4}c^2=1\\c^2=a^2-1 \end{cases}\)</span>,解得<spanclass="math inline">\(a=\sqrt3\)</span></p><p><img src="https://gitee.com/andypl/imagehost/raw/master/img/Snipaste_2021-05-20_11-45-43.jpg" style="zoom:67%;" /></p><p>(2)设点<span class="math inline">\(A\)</span>的坐标为<spanclass="math inline">\((x_0,y_0)\)</span>,则直线<spanclass="math inline">\(AF\)</span>的方程为<spanclass="math inline">\(x=\dfrac{y}{y_0}(x_0+\sqrt2)-\sqrt2\)</span>,与椭圆联立得</p><p><spanclass="math inline">\([(\dfrac{x_0+\sqrt2}{y_0})^2+3]y^2+\)</span>酱油一次项<spanclass="math inline">\(-1=0\)</span>,将<spanclass="math inline">\(x_0^2+3y_0^2=3\)</span>代入化简得<spanclass="math inline">\(\dfrac{2\sqrt2x_0+5}{y_0^2}y^2+\)</span>酱油一次项<spanclass="math inline">\(-1=0\)</span>,于是</p><p><spanclass="math inline">\(y_0y_{D}=\dfrac{-y_0^2}{2\sqrt2x_0+5}\)</span>,则<spanclass="math inline">\(y_D=\dfrac{-y_0}{2\sqrt2x_0+5}\)</span>,代入直线方程解得<spanclass="math inline">\(D(\dfrac{-5x_0-6\sqrt2}{2\sqrt2x_0+5},\dfrac{-y_0}{2\sqrt2x_0+5})\)</span>,同理<spanclass="math inline">\(E(\dfrac{5x_0-6\sqrt2}{-2\sqrt2x_0+5},\dfrac{y_0}{-2\sqrt2x_0+5})\)</span></p><p>由对称性知直线<span class="math inline">\(DE\)</span>过的定点在<spanclass="math inline">\(x\)</span>轴上,设为<spanclass="math inline">\((t,0)\)</span>,于是</p><p><spanclass="math inline">\(\dfrac{\dfrac{-y_0}{2\sqrt2x_0+5}-0}{\dfrac{-5x_0-6\sqrt2}{2\sqrt2x_0+5}-t}=\dfrac{\dfrac{y_0}{-2\sqrt2x_0+5}-0}{\dfrac{5x_0-6\sqrt2}{-2\sqrt2x_0+5}-t}\)</span>,看似繁杂但很容易化简得<spanclass="math inline">\(t=-\dfrac{6\sqrt2}{5}\)</span>,于是直线<spanclass="math inline">\(DE\)</span>过定点<spanclass="math inline">\((-\dfrac{6\sqrt2}{5},0)\)</span></p><p><strong>评:</strong></p><ol type="1"><li><p>如果设直线<span class="math inline">\(AF\)</span>的方程为<spanclass="math inline">\(y=\dfrac{y_0}{x_0+\sqrt2}(x+\sqrt2)\)</span>的形式与椭圆联立时,所得到的关于<spanclass="math inline">\(x\)</span>的一元二次方程常数项并不是常数,计算量相应变大</p></li><li><p>求出<spanclass="math inline">\(D,E\)</span>两点的坐标以后,不要写直线<spanclass="math inline">\(DE\)</span>的方程,通过对称性确定定点所在的位置,然后利用三点共线求解</p></li></ol>]]></content>
<categories>
<category>数学</category>
<category>解析几何</category>
</categories>
<tags>
<tag>解析几何</tag>
<tag>椭圆</tag>
<tag>定点问题</tag>
</tags>