-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
416 lines (267 loc) · 21 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hexo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="en">
<meta name="twitter:card" content="summary">
<link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">Hexo</a>
</h1>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-set-up-the-blog" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/06/set-up-the-blog/" class="article-date">
<time datetime="2019-11-05T16:43:18.000Z" itemprop="datePublished">2019-11-06</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/06/set-up-the-blog/">博客搭建</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>[toc]</p>
<h2 id="GitHub创建个人仓库"><a href="#GitHub创建个人仓库" class="headerlink" title="GitHub创建个人仓库"></a>GitHub创建个人仓库</h2><ol>
<li><p>登录进GitHub,点击New repository创建新的仓库,仓库命名为:<strong>GitHub用户名</strong>.github.io</p>
<p> 例如:我的仓库名即为 Beau-Yang.github.io</p>
</li>
</ol>
<h2 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h2><p>Git是开源的分布式版本控制系统,可以有效、高速地处理不同规模的项目版本管理。</p>
<ol>
<li>从<a href="https://git-scm.com/downloads" target="_blank" rel="noopener">Git官网</a>下载对应系统版本的安装包,直接按默认设置安装即可。安装后需要在命令行中输入<code>git</code>测试是否安装成功。</li>
</ol>
<p>成功安装后,需要将Git与GitHub账号绑定,避免每次推送需要重新输入账号密码。</p>
<ol start="2">
<li>打开Git Bash程序,设置 user.name和user.email 配置信息:</li>
</ol>
<figure class="highlight bash"><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">git config --global user.name <span class="string">"GitHub用户名"</span></span><br><span class="line">git config --global user.email <span class="string">"GitHub注册邮箱"</span></span><br></pre></td></tr></table></figure>
<ol start="3">
<li>配置后生成ssh密钥文件:</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C <span class="string">"GitHub注册邮箱"</span></span><br></pre></td></tr></table></figure>
<p>之后连续三次回车,生成密钥。</p>
<ol start="4">
<li><p>在路径下的.ssh文件夹中找到id_rsa.pub密钥,以记事本程序打开,复制全部内容。</p>
</li>
<li><p>在<a href="https://github.com/settings/keys" target="_blank" rel="noopener">GitHub_Settings_keys</a>界面中点击new SSH Key。设置任意的Title,Key设置为刚刚密钥内容,点击Add SSH Key,完成生成过程。</p>
</li>
<li><p>在Git Bash中检测GitHub公钥设置是否成功,输入<code>ssh [email protected]</code></p>
</li>
</ol>
<p>若如下图所示,则表明Git与GitHub账户绑定成功。</p>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-Git与GitHub账户绑定成功.png" alt="博客搭建-2019-11-6-Git与GitHub账户绑定成功.png">
<p>绑定成功后,每次推送时,git会匹配本地私钥与GitHub上公钥,若成功匹配则认为是合法用户,允许推送。</p>
<h2 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="安装Node.js"></a>安装Node.js</h2><p>Hexo基于Node.js运行,Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,下载地址为<a href="http://nodejs.cn/download/" target="_blank" rel="noopener">Download | Node.js</a>,其中会包含包管理工具npm的安装。</p>
<p>下载安装Node.js。</p>
<p>在命令行中输入 node -v,检测Node.js是否安装成功,如下所示。</p>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-Node.js安装成功.png" alt="博客搭建-2019-11-6-Node.js安装成功.png">
<p>在命令行中输入 npm -v,检测npm是否安装成功,如下所示。</p>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-npm安装成功.png" alt="博客搭建-2019-11-6-npm安装成功.png">
<h2 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h2><p>在电脑中创建一个文件夹,可以命令为Blog,存放Hexo框架和以后发布的网页。</p>
<p>创建好后进入文件夹中,运行命令行切换为国内源,这样下载包能有较快的速率。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm config <span class="built_in">set</span> registry http://registry.npm.taobao.org/</span><br></pre></td></tr></table></figure>
<p>之后再安装Hexo:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>
<p>显示如下:</p>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-安装Hexo.png" alt="博客搭建-2019-11-6-安装Hexo.png">
<p>安装完成后,初始化博客,输入命令:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init blog</span><br></pre></td></tr></table></figure>
<p>显示如下:</p>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-初始化博客.png" alt="博客搭建-2019-11-6-初始化博客.png">
<p>之后切换到blog文件夹中,检测网站雏形,依次输入命令,作用分别是新建博客、生成网页、启动服务预览:</p>
<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></pre></td><td class="code"><pre><span class="line">hexo new test_my_site</span><br><span class="line">hexo g</span><br><span class="line">hexo s</span><br></pre></td></tr></table></figure>
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-新建博客.png" alt="博客搭建-2019-11-6-新建博客.png">
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-生成网页.png" alt="博客搭建-2019-11-6-生成网页.png">
<img src="https://raw.githubusercontent.com/Beau-Yang/Image-Hosting-Service/master/img/博客搭建-2019-11-6-启动服务预览.png" alt="博客搭建-2019-11-6-启动服务预览.png">
<p>完成后打开地址 localhost:4000 就可以看到刚刚的测试博客。</p>
<h2 id="推送网站"><a href="#推送网站" class="headerlink" title="推送网站"></a>推送网站</h2><p>找到blog根目录下的站点配置文件 _config.yml ,以VSCode编辑它,将它最后部分修改为</p>
<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><span class="line">deploy:</span><br><span class="line"> <span class="built_in">type</span>: git</span><br><span class="line"> repo: GitHub上仓库的完整路径.git</span><br><span class="line"> branch: master</span><br></pre></td></tr></table></figure>
<p>保存站点配置文件,之后需要安装Git部署插件,在blog路径下输入:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>这时,再输入命令:</p>
<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></pre></td><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>
<p>完成后,在浏览器中打开个人网站的仓库路径,即可访问。</p>
<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><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">npm install hexo -g <span class="comment">#安装Hexo</span></span><br><span class="line">npm update hexo -g <span class="comment">#升级</span></span><br><span class="line">hexo init <span class="comment">#初始化博客</span></span><br><span class="line"></span><br><span class="line">命令简写</span><br><span class="line">hexo n <span class="string">"我的博客"</span> == hexo new <span class="string">"我的博客"</span> <span class="comment">#新建文章</span></span><br><span class="line">hexo g == hexo generate <span class="comment">#生成</span></span><br><span class="line">hexo s == hexo server <span class="comment">#启动服务预览</span></span><br><span class="line">hexo d == hexo deploy <span class="comment">#部署</span></span><br><span class="line"></span><br><span class="line">hexo server <span class="comment">#Hexo会监视文件变动并自动更新,无须重启服务器</span></span><br><span class="line">hexo server -s <span class="comment">#静态模式</span></span><br><span class="line">hexo server -p 5000 <span class="comment">#更改端口</span></span><br><span class="line">hexo server -i 192.168.1.1 <span class="comment">#自定义 IP</span></span><br><span class="line">hexo clean <span class="comment">#清除缓存,若是网页正常情况下可以忽略这条命令</span></span><br></pre></td></tr></table></figure>
<p><a href="https://github.com/Molunerfinn/PicGo" target="_blank" rel="noopener">图片上传工具PicGO</a></p>
<p><a href="https://github.com/PicGo/vs-picgo" target="_blank" rel="noopener">PicGo-VS code</a></p>
<p>参考来源:</p>
<p><a href="https://zhuanlan.zhihu.com/p/26625249" target="_blank" rel="noopener">GitHub+Hexo搭建个人网站详细教程</a></p>
<p><a href="https://www.jianshu.com/p/2756724a5dee" target="_blank" rel="noopener">GitHub图床+PicGo搭建</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/06/set-up-the-blog/" data-id="ck2ml70uk00041omw30hka0tz" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-LeetCodeNotes" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/03/LeetCodeNotes/" class="article-date">
<time datetime="2019-11-03T03:26:03.000Z" itemprop="datePublished">2019-11-03</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/03/LeetCodeNotes/">LeetCode笔记</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="1-两数之和"><a href="#1-两数之和" class="headerlink" title="1.两数之和"></a>1.两数之和</h1><h2 id="amp-,-和-and,or-之间的区别"><a href="#amp-,-和-and,or-之间的区别" class="headerlink" title="&,| 和 and,or 之间的区别"></a><code>&</code>,<code>|</code> 和 <code>and</code>,<code>or</code> 之间的区别</h2><p>两组运算符都用于变量的比较,形如 <code>a & b</code> 或 <code>a and b</code> 。而变量一般分为数值变量与逻辑变量。</p>
<ul>
<li><code>a</code>,<code>b</code> 是数值变量时,<code>&</code>,<code>|</code> 表示位运算,<code>and</code>,<code>or</code> 依据是否非0来决定输出。</li>
<li><code>a</code>,<code>b</code> 是逻辑变量时,二者用法一致。</li>
</ul>
<p>注意:由于运算符优先级顺序,使用运算符时需要对比较的变量加括号以保证结果正确。</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/03/LeetCodeNotes/" data-id="ck2ml70u700001omw4bqn2t5p" class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul>
</footer>
</div>
</article>
<article id="post-This-is-my-first-blog" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/03/This-is-my-first-blog/" class="article-date">
<time datetime="2019-11-02T17:26:35.000Z" itemprop="datePublished">2019-11-03</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/03/This-is-my-first-blog/">这是我的一个博客</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>这是我的第一个博客,啦啦啦<br>这是测试文字啦</p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/03/This-is-my-first-blog/" data-id="ck2ml70ui00031omwcx06edi5" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/11/03/hello-world/" class="article-date">
<time datetime="2019-11-02T16:29:39.362Z" itemprop="datePublished">2019-11-03</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/11/03/hello-world/">Hello World</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/one-command-deployment.html" target="_blank" rel="noopener">Deployment</a></p>
</div>
<footer class="article-footer">
<a data-url="http://yoursite.com/2019/11/03/hello-world/" data-id="ck2ml70ue00011omw0wps11eh" class="article-share-link">Share</a>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Tags</h3>
<div class="widget">
<ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Tag Cloud</h3>
<div class="widget tagcloud">
<a href="/tags/python/" style="font-size: 10px;">python</a>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">November 2019</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2019/11/06/set-up-the-blog/">博客搭建</a>
</li>
<li>
<a href="/2019/11/03/LeetCodeNotes/">LeetCode笔记</a>
</li>
<li>
<a href="/2019/11/03/This-is-my-first-blog/">这是我的一个博客</a>
</li>
<li>
<a href="/2019/11/03/hello-world/">Hello World</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2019 John Doe<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>