-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1188 lines (792 loc) · 61.3 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 6.2.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"example.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
</script>
<meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://example.com/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="http://example.com/">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome : true,
isPost : false,
lang : 'en'
};
</script>
<title>Hexo</title>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband"></div>
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="Toggle navigation bar">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<h1 class="site-title">Hexo</h1>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="main-menu menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>About</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>Categories</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives</a>
</li>
<li class="menu-item menu-item-schedule">
<a href="/schedule/" rel="section"><i class="fa fa-calendar fa-fw"></i>Schedule</a>
</li>
<li class="menu-item menu-item-sitemap">
<a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>Sitemap</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<main class="main">
<div class="main-inner">
<div class="content-wrap">
<div class="content index posts-expand">
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/09/19/%E5%8D%9A%E5%AE%A2/%E5%8D%9A%E5%AE%A2%E4%B8%BB%E9%A2%98%E8%AE%BE%E7%BD%AE/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/09/19/%E5%8D%9A%E5%AE%A2/%E5%8D%9A%E5%AE%A2%E4%B8%BB%E9%A2%98%E8%AE%BE%E7%BD%AE/" class="post-title-link" itemprop="url">博客主题设置</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-09-19 13:42:03" itemprop="dateCreated datePublished" datetime="2022-09-19T13:42:03+08:00">2022-09-19</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-12-13 15:17:43" itemprop="dateModified" datetime="2018-12-13T15:17:43+08:00">2018-12-13</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">博客</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>日志文件比较多的时候,博客了设置一些分类标签,能迅速的找到需要的东西,而且看起来比较舒服</p>
<h3 id="下载主题"><a href="#下载主题" class="headerlink" title="下载主题"></a>下载主题</h3><p>进入hexo创建博客的根目录,打开命令行,运行:<br><code>git clone https://github.com/theme-next/hexo-theme-next themes/next</code><br>这个命令就是下载next主题到当前目录themes下</p>
<h3 id="启动主题"><a href="#启动主题" class="headerlink" title="启动主题"></a>启动主题</h3><p>修改配置文件_config.yml<br><code>theme: next</code></p>
<h3 id="主题设定"><a href="#主题设定" class="headerlink" title="主题设定"></a>主题设定</h3><p>修改next/_config.yml,找到Scheme Settings,这里有四种外观<br># Scheme Settings<br>#<br>-————————————————————–</p>
<p># Schemes<br>#scheme: Muse 默认 Scheme,这是 NexT 最初的版本,黑白主调,大量留白<br>#scheme: Mist Muse 的紧凑版本,整洁有序的单栏外观<br>#scheme: Pisces 双栏 Scheme,小家碧玉似的清新<br>#scheme: Gemini 左侧网站信息及目录,块+片段结构布局`<br>想要哪个就把前面的#去掉就行</p>
<h3 id="设置语言"><a href="#设置语言" class="headerlink" title="设置语言"></a>设置语言</h3><p>修改配置文件_config.yml,将language设置成你所需要的语言,例如简体中文:<br>language: zh-Hans</p>
<h3 id="设置菜单"><a href="#设置菜单" class="headerlink" title="设置菜单"></a>设置菜单</h3><p>修改next/_config.yml,找到menu<br>menu:<br> home: / || home<br> #about: /about/ || user<br> #tags: /tags/ || tags<br> #categories: /categories/ || th<br> archives: /archives/ || archive<br> #schedule: /schedule/ || calendar<br> #sitemap: /sitemap.xml || sitemap<br> #commonweal: /404/ || heartbeat<br>这里我们可以设置标签、分类。在这之前需要创建page<br><code>hexo new page 'tags'</code><br><code>hexo new page categories</code><br>在根目录下的source文件会生成tags、categories文件夹<br>分别修改tags和categories文件夹的index.md文件,新增type属性<br>-–<br>title: tags<br>date: 2018-08-08 12:12:12<br>type: tags<br>-–<br>categories的修改类似<br>在新建一篇博的时刻,增加tags和categories属性值,就能在tags和categories界面检索到文章了。</p>
<h4 id="去掉文章后面的标签前面的-号"><a href="#去掉文章后面的标签前面的-号" class="headerlink" title="去掉文章后面的标签前面的#号"></a>去掉文章后面的标签前面的#号</h4><p>修改模板/themes/next/layout/_macro/post.swig,搜索 rel=”tag”>#,将#换成<i class="fa fa-tag"></i></p>
<h4 id="动态背景"><a href="#动态背景" class="headerlink" title="动态背景"></a>动态背景</h4><p>目前NexT主题最新的是V6.0版本,这个版本中可以有4种动态背景:<br>Canvas-nest<br>three_waves<br>canvas_lines<br>canvas_sphere<br>设置方法也很简单,直接设置里需要的动态背景为true。</p>
<h4 id="侧边栏社交小图标设置"><a href="#侧边栏社交小图标设置" class="headerlink" title="侧边栏社交小图标设置"></a>侧边栏社交小图标设置</h4><p>打开主题配置文件_config.yml,搜索social:, ||之后是在图标库中对应的图标。注意空格就行<br>social:<br> #GitHub: <a target="_blank" rel="noopener" href="https://github.com/yourname">https://github.com/yourname</a> || github<br> #E-Mail: mailto:<a href="mailto:yourname@gmail.com">yourname@gmail.com</a> || envelope<br> #Google: <a target="_blank" rel="noopener" href="https://plus.google.com/yourname">https://plus.google.com/yourname</a> || google<br> #Twitter: <a target="_blank" rel="noopener" href="https://twitter.com/yourname">https://twitter.com/yourname</a> || twitter<br> #FB Page: <a target="_blank" rel="noopener" href="https://www.facebook.com/yourname">https://www.facebook.com/yourname</a> || facebook<br> #VK Group: <a target="_blank" rel="noopener" href="https://vk.com/yourname">https://vk.com/yourname</a> || vk<br> #StackOverflow: <a target="_blank" rel="noopener" href="https://stackoverflow.com/yourname">https://stackoverflow.com/yourname</a> || stack-overflow<br> #YouTube: <a target="_blank" rel="noopener" href="https://youtube.com/yourname">https://youtube.com/yourname</a> || youtube<br> #Instagram: <a target="_blank" rel="noopener" href="https://instagram.com/yourname">https://instagram.com/yourname</a> || instagram<br> #Skype: skype:yourname?call|chat || skype<br>去掉前面的#就行<br>可以加上自己的<br> Google: <a target="_blank" rel="noopener" href="http://www.google.cn/">http://www.google.cn/</a> || google<br> Github: <a target="_blank" rel="noopener" href="https://github.com/">https://github.com/</a> || github<br> baidu: <a target="_blank" rel="noopener" href="https://www.baidu.com/">https://www.baidu.com/</a> || baidu<br> Bing: <a target="_blank" rel="noopener" href="https://cn.bing.com/">https://cn.bing.com/</a> || Bing</p>
<h4 id="博页面两侧的空白太多"><a href="#博页面两侧的空白太多" class="headerlink" title="博页面两侧的空白太多"></a>博页面两侧的空白太多</h4><p>编辑主题的source/css/_variables/custom.styl文件,新增变量:<br>// 修改成你期望的宽度<br>$content-desktop = 700px // 我的为800px,自己调整测试即可<br>// 当视窗超过 1600px 后的宽度<br>$content-desktop-large = 900px<br>我的电脑上的配置是<br>$content-desktop = 1000px<br>$content-desktop-large = 1200px</p>
<h4 id="代码超出自动换行"><a href="#代码超出自动换行" class="headerlink" title="代码超出自动换行"></a>代码超出自动换行</h4><p>修改 themes\next\source\css_common\scaffolding\base.styl<br>修改base.styl ,blockquote 样式下 添加 word-break: break-all;</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">blockquote {</span><br><span class="line"> margin: 0;</span><br><span class="line"> padding: 0;</span><br><span class="line"> word-break: break-all;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_32454537/article/details/79482896">2018最新版Hexo博客Next主题6.0配置优化</a><br><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/70dbff8d7608">Hexo博客之主题美化</a><br><a target="_blank" rel="noopener" href="https://blog.csdn.net/Mohon/article/details/69803130">Hexo NexT 主题下 blockquote 文本内容超出不自动换行解决方式</a><br><a target="_blank" rel="noopener" href="https://xiaotiandi.github.io/publicBlog/">一个看起来不错的博客版面</a><br><a target="_blank" rel="noopener" href="http://www.cocofe.cn/">其它博客</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/09/19/%E5%8D%9A%E5%AE%A2/%E5%8D%9A%E5%AE%A2%E5%8A%A0%E5%AF%86/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/09/19/%E5%8D%9A%E5%AE%A2/%E5%8D%9A%E5%AE%A2%E5%8A%A0%E5%AF%86/" class="post-title-link" itemprop="url">博客加密</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-09-19 13:42:03" itemprop="dateCreated datePublished" datetime="2022-09-19T13:42:03+08:00">2022-09-19</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-12-15 17:39:14" itemprop="dateModified" datetime="2018-12-15T17:39:14+08:00">2018-12-15</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">博客</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h3 id="博客加密"><a href="#博客加密" class="headerlink" title="博客加密"></a>博客加密</h3><p>有时候写一篇博客,不希望每个人都可以看到,可以对博客进行加密,其他人需要输入密码才可以访问这篇博客,百度大多使用js语句实现加密功能,然后那个加密功能有很多bug,包括:</p>
<ul>
<li>search.xml依然保留文章内容,可以使用搜索直接获取文章内容</li>
<li>密码明文传输,直接查看网页源代码即可获取密码(本问题可以采用md5加密解决)</li>
<li>新标签页打开页面不用输入密码即可进入页面(本问题可以使用location定位解决)</li>
<li>源代码未加密,直接下载源代码去掉加密部分即可看到文章内容<br>特别是1,4比较棘手,似乎就没有将网页源码加密以外的方法了。</li>
</ul>
<h3 id="方案"><a href="#方案" class="headerlink" title="方案"></a>方案</h3><p>使用插件hexo-encrypt,地址:<a target="_blank" rel="noopener" href="https://github.com/edolphin-ydf/hexo-encrypt">https://github.com/edolphin-ydf/hexo-encrypt</a></p>
<h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><p><code>npm install hexo-encrypt --save</code><br>修改博客配置文件_config.yml,在末尾添加:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">encrypt</span><br><span class="line"> password: 123456</span><br></pre></td></tr></table></figure>
<p>这里123456为默认密码,即若文章加密并且未声明独立密码即可通过默认密码解锁文章。<br>然后在package.json中修改插件的版本号,修改为<br><code>"hexo-encrypt": "^0.2.0"</code></p>
<h3 id="应用"><a href="#应用" class="headerlink" title="应用"></a>应用</h3><p>在每一篇文章的开头加入:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">encrypt: true</span><br><span class="line">enc_pwd: 123456</span><br></pre></td></tr></table></figure>
<p>这里的enc_pwd为独立密码,设定独立密码后文章不再使用默认密码解锁,改用独立密码解锁。<br>输入<code>hexo s</code> 即可查看效果。<br>注意若修改完插件或密码需要先hexo clean清空缓存。</p>
<h3 id="方案二"><a href="#方案二" class="headerlink" title="方案二"></a>方案二</h3><p>打开/themes/next/layout/_partials/head.swig, 在meta标签后面插入这样一段代码:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><script></span><br><span class="line"> (function(){</span><br><span class="line"> if('{{ page.password }}'){</span><br><span class="line"> if (prompt('请输入文章密码') !== '{{ page.password }}'){</span><br><span class="line"> alert('密码错误!');</span><br><span class="line"> history.back();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> })();</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line">作者:枫頔</span><br><span class="line">链接:https://www.jianshu.com/p/70dbff8d7608</span><br><span class="line">來源:简书</span><br><span class="line">简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。</span><br></pre></td></tr></table></figure>
<p>然后文章中添加:password: 00000 如下图:<br><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/70dbff8d7608">ref</a><br>如果password后面为空,则表示不用密码。</p>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><p><a target="_blank" rel="noopener" href="https://blog.bill.moe/encrypt/#comments">「Hexo插件应用」encrypt插件加密文章</a><br><a target="_blank" rel="noopener" href="https://blog.csdn.net/Lancelot_Lewis/article/details/53422901">Hexo文章简单加密访问</a><br><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/70dbff8d7608">Hexo博客之主题美化</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/09/19/%E5%8D%9A%E5%AE%A2/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/09/19/%E5%8D%9A%E5%AE%A2/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" class="post-title-link" itemprop="url">搭建个人博客</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-09-19 13:42:03" itemprop="dateCreated datePublished" datetime="2022-09-19T13:42:03+08:00">2022-09-19</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-09-14 09:30:56" itemprop="dateModified" datetime="2018-09-14T09:30:56+08:00">2018-09-14</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">博客</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h3 id="搭建个人博客"><a href="#搭建个人博客" class="headerlink" title="搭建个人博客"></a>搭建个人博客</h3><p><a target="_blank" rel="noopener" href="http://baixin.io/2015/08/HEXO%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">http://baixin.io/2015/08/HEXO%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/</a><br>1 安装Node <a target="_blank" rel="noopener" href="https://nodejs.org/en/">https://nodejs.org/en/</a> 下载新版 按步骤安装<br>2 安装git <a target="_blank" rel="noopener" href="https://git-for-windows.github.io/">https://git-for-windows.github.io/</a> 下载新版 按步骤安装<br>3 安装 hexo 执行命令 npm install -g hexo 即会自动安装<br>4 创建博客,新建目录 blog1 进入:<br>hexo init 初始化 (hexo i blog1; cd blog1)<br>hexo g (hexo generate) 生成静态页面<br>hexo s (hexo server) 启动本地服务<br>浏览器输入<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000</a> 即可访问,如果长时间没有反应,那可能4000端口被占用了,可换其他端口 hexo s -p 5000 访问<a target="_blank" rel="noopener" href="http://localhost:5000/">http://localhost:5000</a> 即可<br>选择主题:git clone <a target="_blank" rel="noopener" href="https://github.com/iissnan/hexo-theme-next">https://github.com/iissnan/hexo-theme-next</a> themes/next<br>主题1 <a target="_blank" rel="noopener" href="https://github.com/iissnan/hexo-theme-next">https://github.com/iissnan/hexo-theme-next</a><br> git checkout tags/v5.1.0</p>
<p>(<a target="_blank" rel="noopener" href="http://blog.csdn.net/qq_31655965/article/details/53172143">http://blog.csdn.net/qq_31655965/article/details/53172143</a>)<br>修改_config.yml theme: next<br>5 上传到github: npm install hexo-deployer-git –save<br>修改_config.yml (如果显示中文乱码,保存成 UTF-8 编码)<br>deploy:<br>repository: <a href="mailto:git@github.com">git@github.com</a>:chenbourne/chenbourne.github.io.git<br>生成本地秘钥 ssh-keygen -t rsa 并copy到GitHub<br>测试 ssh -T <a href="mailto:git@github.com">git@github.com</a><br>生成 hexo d (hexo deploy)<br><a target="_blank" rel="noopener" href="https://chenbourne.github.io/">https://chenbourne.github.io/</a> 可查看 (<a target="_blank" rel="noopener" href="https://github.com/">https://github.com/</a>)<br>hexo clean && hexo g && hexo d</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/%E5%8D%95%E7%BB%86%E8%83%9E/%E5%8D%95%E7%BB%86%E8%83%9E%E6%97%B6%E7%A9%BA%E7%BB%84%E5%B7%A5%E5%85%B7/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/%E5%8D%95%E7%BB%86%E8%83%9E/%E5%8D%95%E7%BB%86%E8%83%9E%E6%97%B6%E7%A9%BA%E7%BB%84%E5%B7%A5%E5%85%B7/" class="post-title-link" itemprop="url">单细胞时空组工具</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 16:42:02 / Modified: 16:44:00" itemprop="dateCreated datePublished" datetime="2022-05-20T16:42:02+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">工具</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h5 id="软件"><a href="#软件" class="headerlink" title="软件"></a>软件</h5><p>所有工具的集合:<a target="_blank" rel="noopener" href="https://github.com/seandavi/awesome-single-cell">https://github.com/seandavi/awesome-single-cell</a><br>作者收集了单细胞分析、可视化的所有工具,也有部分时空组的工具,给出了每个工具的简介和链接</p>
<h6 id="可视化"><a href="#可视化" class="headerlink" title="可视化"></a>可视化</h6><p>Cerebro: <a target="_blank" rel="noopener" href="https://github.com/romanhaa/Cerebro">https://github.com/romanhaa/Cerebro</a> 很友好的交互式当细胞可视化软件,可惜已经不再更新</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/love/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/love/" class="post-title-link" itemprop="url">白菜</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:22:20 / Modified: 14:23:52" itemprop="dateCreated datePublished" datetime="2022-05-20T14:22:20+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/live/" itemprop="url" rel="index"><span itemprop="name">live</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src=/js/crypto-js.js></script>
<script>
function doDecrypt (pwd, onError) {
console.log('in doDecrypt');
const txt = document.getElementById('enc_content').innerHTML;
let plantext;
try {
const bytes = CryptoJS.AES.decrypt(txt, pwd);
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
} catch(err) {
if(onError) {
onError(err);
}
return;
}
document.getElementById('enc_content').innerHTML = plaintext;
document.getElementById('enc_content').style.display = 'block';
document.getElementById('enc_passwd').style.display = 'none';
if(typeof MathJax !== 'undefined') {
MathJax.Hub.Queue(
['resetEquationNumbers', MathJax.InputJax.TeX],
['PreProcess', MathJax.Hub],
['Reprocess', MathJax.Hub]
);
}
}
</script>
<div id="enc_content" style="display:none">U2FsdGVkX1+61qh3oBIoN8hHWVE3CPNiU760LZUMF0y+hNFPHLaaqADpGa15PqjP58n7iU1zSaHgPetDETppL+8NTSLRqDrnpTQO0Nigxf0pbnes+pB1e28EFBrd0eiA2GSAAvkdpNewODe1+4ViTA==</div>
<div id="enc_passwd"> <input id="enc_pwd_input" type="password" style="border-radius: 5px;border-style: groove;height: 30px;width: 50%;cursor: auto;font-size: 102%;color: currentColor;outline: none;text-overflow: initial;padding-left: 5px;" onkeydown="if (event.keyCode == 13) { decrypt(); return false;}"> <input type="submit" value="解 密" onclick="decrypt()" style="width: 58px;height: 34px;border-radius: 5px;background-color: white;border-style: solid;color: currentColor;"><div id="enc_error" style="display: inline-block;color: #d84527;margin-left: 10px"></div>
<script>
var onError = function(error) {
document.getElementById("enc_error").innerHTML = "password error!"
};
function decrypt() {
var passwd = document.getElementById("enc_pwd_input").value;
console.log(passwd);
doDecrypt(passwd, onError);
}
</script>
</div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/python/parallel%E5%B9%B6%E8%A1%8C/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/python/parallel%E5%B9%B6%E8%A1%8C/" class="post-title-link" itemprop="url">parallel多并行</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:15:05 / Modified: 14:17:45" itemprop="dateCreated datePublished" datetime="2022-05-20T14:15:05+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/%E5%B9%B6%E8%A1%8C/" itemprop="url" rel="index"><span itemprop="name">并行</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src=/js/crypto-js.js></script>
<script>
function doDecrypt (pwd, onError) {
console.log('in doDecrypt');
const txt = document.getElementById('enc_content').innerHTML;
let plantext;
try {
const bytes = CryptoJS.AES.decrypt(txt, pwd);
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
} catch(err) {
if(onError) {
onError(err);
}
return;
}
document.getElementById('enc_content').innerHTML = plaintext;
document.getElementById('enc_content').style.display = 'block';
document.getElementById('enc_passwd').style.display = 'none';
if(typeof MathJax !== 'undefined') {
MathJax.Hub.Queue(
['resetEquationNumbers', MathJax.InputJax.TeX],
['PreProcess', MathJax.Hub],
['Reprocess', MathJax.Hub]
);
}
}
</script>
<div id="enc_content" style="display:none">U2FsdGVkX19W6iViwx4ZE3Dg5CrOYgpXNFVOQL78TDZp0opgCDcWN/tSWYtpzaDGdScFMungS8f97QuBnaDmBfoO4g7lilgOPvUAEmjDC49CRpH/g7nq3ZOAPzjsYtHBw2cUxp73fxayXAmH7EXpd1GhfPb+g6ErUQuP3eA3ECpyiRphQ7UkXZ0WKO5grf8va1mEbXo4FZarN83GXEB5q71FZs0H0SEVq7ubHl0yQ0r4r4Axf5Y0OpWQDYhBK1SgH6i7ogtgpVyi9jVod8cLGrf/7fzWrh/pYqfIYU4Son35+gT7mQ3gdheOd+qa7Q7blp7ijd7iuRJkQgmUZQ4w3H1PIqlDQhGmf3N6UQN71uyvvqqUyg5pCj75UcnCPVX74jfKOKr6F0qANENKARtkrZlztDt7efqXGTjKyifk0ZrRbQAYfB5+oIrxz1JZL3RMHAWxh2RMCoTBGZdm7GBVQp6H8EGkJ+oALvACEtES79ibco4e8q/BRsyPYCadD+gZlOoQgdN2f+mPMggvbVcnwgUF+SRt/TBLFdS3GWjJxmLev5p4Rh6+4UfXdni1Pk6pbxtonG3c9RjJVoqsCSAbfYR/AJ+uvbGvsl8B1YrmkaAvfXp3J2lRXNWEF0jZIqhR1RLVLVd6qcwydXISdsMUR/vcYZi4/h3eZUsHU7HxEWTlr8wnT/GwC7J3l+8akIq2RFpdw3Snbtm53Ky+rMEyrGeu0MxSpKh2knz4rCwyjIjgaYwxabAHrKApobG0M6r/DMA4NYlcU7+buwoO1JOW+OW5Z4u58FQxCqla8rWv3s5gqrex2QmJcwG0aZyLBdqcY6EUppOwq1BJyPFTOyxzCahd2pQC8PKJSFcLSf2WUaMtXCoxtBz/6ME860ZJ/UVTtXS621ESwiryTduYE9u6HIpeCMx2m8xN87KfWNg8jHI3QDO8xNP1VM4Pjo04gGr/NwCb51e8sgH9XbG4MPTZItNIKaRfzKiHdw3UoHRMZk2MxweiY24zy0r7M+PYw0A35KWn4s5WmhH5x3UXbdH+pZafGJ+WwYvAiOdXKXNxaxa8mfnnpSIL9I4J4saZInRD/v9cm3+vbJbd7XeQvEmxa7dKkUO+ecvGmjiaLw7YPFSM0qVYc/APz1SjL5o+jgJeCuMeHddt3Maghs2J31GaqrgiLyoMBz9RrdtGxALPhsTRWMihdZ31N+0XKzqVpEP/AYcXpGM2EwNWE+bYJCbG5gs0Kjv6rxLkC5uF0HT4849VFzO6SSUfVXFSA86Ow+6yQ80frSyhvt260e6Axy2DFFwYJZ+SAknaceIaZpLCa7LoF0Ds4FNDSueMkQrVtk/ugE1DLTYWt6jWWGs1jvScvzbYRXejrNAz+o4uunSZW9hwR23tzuDYftDj++X7XvqDAFJnyi34liH9S0W57h9MIY6FD40D98errjdZVSGH8ISvG6F6ViYz0MvdoXCJH2F0s81jcbEbN3sosKEvq4Gn8cLyHUz3dOLKFPq6AeyPXi2eImGkQ1+smRX14n+K/TO6LfPMZTHU86x5yfwc2URFCQt7Xlr3S0RKU5VblvDIcfAHAnYug1Zv+YLOFoUr3oynYxD+bFYwxzrtE+1VLFIRnOc6fh/Di0BBabb5W4iCEAI2w48TZXIO3mkIWVNGfnXSg2hNOiI/MLI0UfZ3PaVoVMlDppqSOhuUfxIrus8hcjlOhA2tMPCR44gVUygg6mZYErHvc1vh9JkBCI2jCX9Oodp39Aq3cXCbQeELjjY3CjyIGtgj8vmwAit84ExtslEE6WPjfknnBFcmjUyWD+6U7S2PVglmpErnjUX6E6DIvE7Z9bAVdpFcYdhLXjm27B6Fyi60WVzdN9vkCS495dMPNum2xVtbyTmacegJs0s7nv0/IBe9y2gNgh+yMpwMEXPvj2J+xu+xsxoJmGVDnBGAVfafKt0ZBRCmVa24c7Nkeak=</div>
<div id="enc_passwd"> <input id="enc_pwd_input" type="password" style="border-radius: 5px;border-style: groove;height: 30px;width: 50%;cursor: auto;font-size: 102%;color: currentColor;outline: none;text-overflow: initial;padding-left: 5px;" onkeydown="if (event.keyCode == 13) { decrypt(); return false;}"> <input type="submit" value="解 密" onclick="decrypt()" style="width: 58px;height: 34px;border-radius: 5px;background-color: white;border-style: solid;color: currentColor;"><div id="enc_error" style="display: inline-block;color: #d84527;margin-left: 10px"></div>
<script>
var onError = function(error) {
document.getElementById("enc_error").innerHTML = "password error!"
};
function decrypt() {
var passwd = document.getElementById("enc_pwd_input").value;
console.log(passwd);
doDecrypt(passwd, onError);
}
</script>
</div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/python/virtualenv%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%9A%84python%E7%8E%AF%E5%A2%83/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/python/virtualenv%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%9A%84python%E7%8E%AF%E5%A2%83/" class="post-title-link" itemprop="url">virtualenv创建虚拟的python环境</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:14:05" itemprop="dateCreated datePublished" datetime="2022-05-20T14:14:05+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-12-20 15:12:10" itemprop="dateModified" datetime="2018-12-20T15:12:10+08:00">2018-12-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>virtualenv创建虚拟的python环境<br>virtualenv——用来建立一个虚拟的python环境,用virtualenv 来保持一个干净的环境非常有用</p>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><p><code>pip install virtualenv</code></p>
<h2 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">virtualenv my_project_env</span><br><span class="line">virtualenv -p /usr/bin/python2.7 my_project_env 选择指定一个Python解释器</span><br><span class="line">source deactivate/bin/activate</span><br></pre></td></tr></table></figure>
<h2 id="停止"><a href="#停止" class="headerlink" title="停止"></a>停止</h2><p><code>deactivate</code><br>注意,deactivate是source activate生成的一个函数,可以直接运行,而不是bin下面的一个程序。</p>
<h2 id="ref"><a href="#ref" class="headerlink" title="ref"></a>ref</h2><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/freely/p/8022923.html">python三大神器之virtualenv</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/python/Queue%E9%98%9F%E5%88%97/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/python/Queue%E9%98%9F%E5%88%97/" class="post-title-link" itemprop="url">python Queue队列</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:14:05" itemprop="dateCreated datePublished" datetime="2022-05-20T14:14:05+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-12-24 09:26:37" itemprop="dateModified" datetime="2018-12-24T09:26:37+08:00">2018-12-24</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p><a target="_blank" rel="noopener" href="http://www.runoob.com/python/python-multithreading.html">Python 多线程</a></p>
<h3 id="队列常与线程合用"><a href="#队列常与线程合用" class="headerlink" title="队列常与线程合用"></a>队列常与线程合用</h3><p>测试例子</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">#!/usr/bin/env python</span><br><span class="line">import Queue</span><br><span class="line">import threading</span><br><span class="line"></span><br><span class="line">def read_waiting_file(upload_queue):</span><br><span class="line"> for f in range(20):</span><br><span class="line"> upload_queue.put(f)</span><br><span class="line"> print f</span><br><span class="line">def upload_to_genedock(uploader_proc):</span><br><span class="line"> while not upload_queue.empty():</span><br><span class="line"> a=upload_queue.get()</span><br><span class="line"> print a</span><br><span class="line"></span><br><span class="line">upload_queue = Queue.Queue(5)</span><br><span class="line">proc = threading.Thread(target=read_waiting_file, name='read_waiting_file', args=(upload_queue,))</span><br><span class="line">uploader_proc = threading.Thread(target=upload_to_genedock, name="upload_to_genedock", args=(upload_queue,))</span><br><span class="line">proc.start()</span><br><span class="line">uploader_proc.start()</span><br><span class="line">proc.join()</span><br><span class="line">uploader_proc.join()</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="Queue"><a href="#Queue" class="headerlink" title="Queue"></a>Queue</h3><p>Python的Queue模块中提供了同步的、线程安全的队列类,包括FIFO(先入先出)队列Queue,LIFO(后入先出)队列LifoQueue,和优先级队列PriorityQueue。这些队列都实现了锁原语,能够在多线程中直接使用。可以使用队列来实现线程间的同步。</p>
<p>Queue模块中的常用方法:</p>
<p>Queue.qsize() 返回队列的大小<br>Queue.empty() 如果队列为空,返回True,反之False<br>Queue.full() 如果队列满了,返回True,反之False<br>Queue.full 与 maxsize 大小对应<br>Queue.get([block[, timeout]])获取队列,timeout等待时间<br>Queue.get_nowait() 相当Queue.get(False)<br>Queue.put(item) 写入队列,timeout等待时间<br>Queue.put_nowait(item) 相当Queue.put(item, False)<br>Queue.task_done() 在完成一项工作之后,Queue.task_done()函数向任务已经完成的队列发送一个信号<br>Queue.join() 实际上意味着等到队列为空,再执行别的操作</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/python/python%E8%AF%AD%E6%B3%95%E6%9D%82%E8%B0%88/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/python/python%E8%AF%AD%E6%B3%95%E6%9D%82%E8%B0%88/" class="post-title-link" itemprop="url">python语法杂谈</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:14:05" itemprop="dateCreated datePublished" datetime="2022-05-20T14:14:05+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-12-20 15:16:33" itemprop="dateModified" datetime="2018-12-20T15:16:33+08:00">2018-12-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h3 id="if可否放在后面"><a href="#if可否放在后面" class="headerlink" title="if可否放在后面"></a>if可否放在后面</h3><p>a=4 if 3>2 不行<br>a=4 if 3>2 else 8 行<br>arr=[a for a in range(9) if a>4] 行</p>
<h3 id="输出不换行"><a href="#输出不换行" class="headerlink" title="输出不换行"></a>输出不换行</h3><p>print “abc”,</p>
<h3 id="python-不支持-–操作"><a href="#python-不支持-–操作" class="headerlink" title="python 不支持++ –操作"></a>python 不支持++ –操作</h3><h3 id="文件名:"><a href="#文件名:" class="headerlink" title="文件名:"></a>文件名:</h3><p>os.path.splitext(os.path.basename(file)))[0]</p>
<h3 id="查看模块方法:"><a href="#查看模块方法:" class="headerlink" title="查看模块方法:"></a>查看模块方法:</h3><p>dir(pysam)<br>help(pysam.depth)</p>
<h3 id="指定安装,指定库"><a href="#指定安装,指定库" class="headerlink" title="指定安装,指定库"></a>指定安装,指定库</h3><p>export PYTHONPATH=/hwfssz1/ST_CANCER/POL/SHARE/tools/PyMonitor/v1.4/lib<br>/share/app/python-2.7.10/bin/easy_install –install-dir=/hwfssz1/ST_CANCER/POL/SHARE/tools/PyMonitor/v1.4/lib drmaa</p>
<h3 id="python中的os-system-和os-popen-区别"><a href="#python中的os-system-和os-popen-区别" class="headerlink" title="python中的os.system()和os.popen()区别"></a>python中的os.system()和os.popen()区别</h3><p>python调用Shell脚本或者是调用系统命令,有两种方法:os.system(cmd)或os.popen(cmd),前者返回值是脚本的退出状态码,后者的返回值是脚本执行过程中的输出内容。实际使用时视需求情况而选择。a=os.popen(“echo aa;echo bbb;echo ccc”)<br>print a.readline() 读一行<br>print a.read() 读所有<br>tmp = os.popen(‘ls *.py’).readlines()<br><a target="_blank" rel="noopener" href="https://www.cnblogs.com/bergus/p/4811291.html">python笔记之调用系统命令</a></p>
<h3 id="数组类型转换"><a href="#数组类型转换" class="headerlink" title="数组类型转换"></a>数组类型转换</h3><p>a=range(10)<br>a=[str(i) for i in a]<br>print “\t”.join(a)</p>
<h3 id="包管理"><a href="#包管理" class="headerlink" title="包管理"></a>包管理</h3><h4 id="列出已安装的包"><a href="#列出已安装的包" class="headerlink" title="列出已安装的包"></a>列出已安装的包</h4><p>pip freeze 或 pip list</p>
<h4 id="卸载某包"><a href="#卸载某包" class="headerlink" title="卸载某包"></a>卸载某包</h4><p>pip uninstall pyopenssl=18.0.0</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/20/python/pysam%E7%9A%84%E4%BD%BF%E7%94%A8/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="John Doe">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hexo">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/05/20/python/pysam%E7%9A%84%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">pysam的使用</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2022-05-20 14:14:05" itemprop="dateCreated datePublished" datetime="2022-05-20T14:14:05+08:00">2022-05-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2018-09-07 11:59:41" itemprop="dateModified" datetime="2018-09-07T11:59:41+08:00">2018-09-07</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">