-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
678 lines (534 loc) · 28.6 KB
/
atom.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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[My Octopress Blog]]></title>
<link href="http://nx26.com/atom.xml" rel="self"/>
<link href="http://nx26.com/"/>
<updated>2014-10-29T21:22:08+08:00</updated>
<id>http://nx26.com/</id>
<author>
<name><![CDATA[Your Name]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[linux下go语言获得系统进程cpu使用情况]]></title>
<link href="http://nx26.com/blog/2014/08/09/golangn-huo-de-xi-tong-jin-cheng-cpu-shi-yong-qing-kuang/"/>
<updated>2014-08-09T00:07:33+08:00</updated>
<id>http://nx26.com/blog/2014/08/09/golangn-huo-de-xi-tong-jin-cheng-cpu-shi-yong-qing-kuang</id>
<content type="html"><![CDATA[<h1>[转]linux下通过go语言获得系统进程cpu使用情况</h1>
<ul>
<li>来源: <a href="http://www.sharejs.com/codes/go/5662">http://www.sharejs.com/codes/go/5662</a></li>
</ul>
<!-- more -->
<p>linux下通过go语言获得系统进程cpu使用情况,这段代码通过linux的系统命令 ps来分析cpu的使用情况.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>package main
</span><span class='line'>
</span><span class='line'>import (
</span><span class='line'> "bytes"
</span><span class='line'> "log"
</span><span class='line'> "os/exec"
</span><span class='line'> "strconv"
</span><span class='line'> "strings"
</span><span class='line'>)
</span><span class='line'>
</span><span class='line'>type Process struct {
</span><span class='line'> pid int
</span><span class='line'> cpu float64
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>func main() {
</span><span class='line'> cmd := exec.Command("ps", "aux")
</span><span class='line'> var out bytes.Buffer
</span><span class='line'> cmd.Stdout = &out
</span><span class='line'> err := cmd.Run()
</span><span class='line'> if err != nil {
</span><span class='line'> log.Fatal(err)
</span><span class='line'> }
</span><span class='line'> processes := make([]*Process, 0)
</span><span class='line'> for {
</span><span class='line'> line, err := out.ReadString('\n')
</span><span class='line'> if err!=nil {
</span><span class='line'> break;
</span><span class='line'> }
</span><span class='line'> tokens := strings.Split(line, " ")
</span><span class='line'> ft := make([]string, 0)
</span><span class='line'> for _, t := range(tokens) {
</span><span class='line'> if t!="" && t!="\t" {
</span><span class='line'> ft = append(ft, t)
</span><span class='line'> }
</span><span class='line'> }
</span><span class='line'> log.Println(len(ft), ft)
</span><span class='line'> pid, err := strconv.Atoi(ft[1])
</span><span class='line'> if err!=nil {
</span><span class='line'> continue
</span><span class='line'> }
</span><span class='line'> cpu, err := strconv.ParseFloat(ft[2], 64)
</span><span class='line'> if err!=nil {
</span><span class='line'> log.Fatal(err)
</span><span class='line'> }
</span><span class='line'> processes = append(processes, &Process{pid, cpu})
</span><span class='line'> }
</span><span class='line'> for _, p := range(processes) {
</span><span class='line'> log.Println("Process ", p.pid, " takes ", p.cpu, " % of the CPU")
</span><span class='line'> }
</span><span class='line'>}
</span><span class='line'>//该代码片段来自于: http://www.sharejs.com/codes/go/5662</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Octopress(jekyll) Variables]]></title>
<link href="http://nx26.com/blog/2014/08/06/octopress-jekyll-variables/"/>
<updated>2014-08-06T14:43:16+08:00</updated>
<id>http://nx26.com/blog/2014/08/06/octopress-jekyll-variables</id>
<content type="html"><![CDATA[<ul>
<li>参考:
<ul>
<li><a href="http://jekyllrb.com/docs/variables/">http://jekyllrb.com/docs/variables/</a></li>
</ul>
</li>
</ul>
<!-- more -->
<h1>Variables</h1>
<p>Jekyll traverses your site looking for files to process. Any files with <code>YAML front matter</code> are subject to processing. For each of these files, Jekyll makes a variety of data available via the <code>Liquid templating system</code>. The following is a reference of the available data.</p>
<h2>Global Variables</h2>
<table>
<thead>
<tr>
<th style="text-align:left;"> VARIABLE </th>
<th style="text-align:left;"> DESCRIPTION </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> <code>site</code> </td>
<td style="text-align:left;"> Sitewide information + configuration settings from <strong>_config.yml</strong>. See below for details. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page</code> </td>
<td style="text-align:left;"> Page specific information + the <code>YAML front matter</code>. Custom variables set via the YAML Front Matter will be available here. See below for details. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>content</code> </td>
<td style="text-align:left;"> In layout files, the rendered content of the Post or Page being wrapped. Not defined in Post or Page files. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator</code> </td>
<td style="text-align:left;"> When the <strong>paginate</strong> configuration option is set, this variable becomes available for use. See <strong>Pagination</strong> for details. </td>
</tr>
</tbody>
</table>
<h2>Site Variables</h2>
<table>
<thead>
<tr>
<th style="text-align:left;"> VARIABLE </th>
<th style="text-align:left;"> DESCRIPTION</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> <code>site.time</code> </td>
<td style="text-align:left;"> The current time (when you run the jekyll command). </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.pages</code> </td>
<td style="text-align:left;"> A list of all Pages. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.posts</code> </td>
<td style="text-align:left;"> A reverse chronological list of all Posts. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.related_posts</code> </td>
<td style="text-align:left;"> If the page being processed is a Post, this contains a list of up to ten related Posts. By default, these are low quality but fast to compute. For high quality but slow to compute results, run the <strong>jekyll</strong> command with the <strong>–lsi</strong> (latent semantic indexing) option. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.static_files</code> </td>
<td style="text-align:left;"> A list of all static files (i.e. files not processed by Jekyll’s converters or the Liquid renderer). Each file has three properties: <strong>path</strong>, <strong>modified_time</strong> and <strong>extname</strong>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.html_pages</code> </td>
<td style="text-align:left;"> A list of all HTML Pages. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.collections</code> </td>
<td style="text-align:left;"> A list of all the collections. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.data</code> </td>
<td style="text-align:left;"> A list containing the data loaded from the YAML files located in the <strong>_data</strong> directory. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.documents</code> </td>
<td style="text-align:left;"> A list of all the documents in every collection. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.categories.CATEGORY</code> </td>
<td style="text-align:left;"> The list of all Posts in category <strong>CATEGORY</strong>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.tags.TAG</code> </td>
<td style="text-align:left;"> The list of all Posts with tag <strong>TAG</strong>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>site.[CONFIGURATION_DATA]</code> </td>
<td style="text-align:left;"> All the variables set via the command line and your <strong>_config.yml</strong> are available through the <strong>site variable</strong>. For example, if you have <strong>url: <a href="http://mysite.com**">http://mysite.com**</a> in your configuration file, then in your Posts and Pages it will be stored in </strong>site.url<strong>. Jekyll does not parse changes to </strong>_config.yml<strong> in </strong>watch** mode, you must restart Jekyll to see changes to variables. </td>
</tr>
</tbody>
</table>
<h2>Page Variables</h2>
<table>
<thead>
<tr>
<th style="text-align:left;"> VARIABLE </th>
<th style="text-align:left;"> DESCRIPTION </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> <code>page.content</code> </td>
<td style="text-align:left;"> The content of the Page, rendered or un-rendered depending upon what Liquid is being processed and what <code>page</code> is. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.title</code> </td>
<td style="text-align:left;"> The title of the Page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.excerpt</code> </td>
<td style="text-align:left;"> The un-rendered excerpt of the Page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.url</code> </td>
<td style="text-align:left;"> The URL of the Post without the domain, but with a leading slash, e.g. <strong>/2008/12/14/my-post.html</strong> </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.date</code> </td>
<td style="text-align:left;"> The Date assigned to the Post. This can be overridden in a Post’s front matter by specifying a new date/time in the format <strong>YYYY-MM-DD HH:MM:SS</strong> (assuming UTC), or <strong>YYYY-MM-DD HH:MM:SS +/-TTTT</strong> (to specify a time zone using an offset from UTC. e.g. <strong>2008-12-14 10:30:00 +0900)</strong>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.id</code> </td>
<td style="text-align:left;"> An identifier unique to the Post (useful in RSS feeds). e.g. <strong>/2008/12/14/my-post</strong> </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.categories</code> </td>
<td style="text-align:left;"> The list of categories to which this post belongs. Categories are derived from the directory structure above the <strong>_posts</strong> directory. For example, a post at <strong>/work/code/_posts/2008-12-24-closures.md</strong> would have this field set to <strong>[‘work’, ‘code’]</strong>. These can also be specified in the <code>YAML Front Matter</code>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.tags</code> </td>
<td style="text-align:left;"> The list of tags to which this post belongs. These can be specified in the <code>YAML Front Matter</code>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.path</code> </td>
<td style="text-align:left;"> The path to the raw post or page. Example usage: Linking back to the page or post’s source on GitHub. This can be overridden in the <code>YAML Front Matter</code>. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.next</code> </td>
<td style="text-align:left;"> The next post relative to the position of the current post in <strong>site.posts</strong>. Returns <strong>nil</strong> for the last entry. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>page.previous</code> </td>
<td style="text-align:left;"> The previous post relative to the position of the current post in <strong>site.posts</strong>. Returns <strong>nil</strong> for the first entry. </td>
</tr>
</tbody>
</table>
<blockquote><p><code>ProTip™</code></p>
<blockquote><p>Use Custom Front Matter` | Any custom front matter that you specify will be available under <strong>page</strong>. For example, if you specify <strong>custom_css</strong>: true in a page’s front matter, that value will be available as <strong>page.custom_css</strong>.</p></blockquote></blockquote>
<h2>Paginator</h2>
<table>
<thead>
<tr>
<th style="text-align:left;"> VARIABLE </th>
<th style="text-align:left;"> DESCRIPTION </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> <code>paginator.per_page</code> </td>
<td style="text-align:left;"> Number of Posts per page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.posts</code> </td>
<td style="text-align:left;"> Posts available for that page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.total_posts</code> </td>
<td style="text-align:left;"> Total number of Posts. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.total_pages</code> </td>
<td style="text-align:left;"> Total number of Pages. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.page</code> </td>
<td style="text-align:left;"> The number of the current page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.previous_page</code> </td>
<td style="text-align:left;"> The number of the previous page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.previous_page_path</code> </td>
<td style="text-align:left;"> The path to the previous page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.next_page</code> </td>
<td style="text-align:left;"> The number of the next page. </td>
</tr>
<tr>
<td style="text-align:left;"> <code>paginator.next_page_path</code> </td>
<td style="text-align:left;"> The path to the next page. </td>
</tr>
</tbody>
</table>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[教程:一步步在github上建立octopress博客]]></title>
<link href="http://nx26.com/blog/2014/08/05/jiao-cheng-yi-bu-bu-zai-githubshang-jian-li-octopressbo-ke/"/>
<updated>2014-08-05T21:57:06+08:00</updated>
<id>http://nx26.com/blog/2014/08/05/jiao-cheng-yi-bu-bu-zai-githubshang-jian-li-octopressbo-ke</id>
<content type="html"><![CDATA[<ul>
<li>参考:
<ul>
<li><a href="http://never.doubting.me/2013/04/18/2013-04-18-setup-octopress-on-github-step-by-step/">http://never.doubting.me/2013/04/18/2013-04-18-setup-octopress-on-github-step-by-step/</a></li>
<li><a href="http://caiqinghua.github.io/blog/2013/08/26/deploy-octopress-to-github-pages/">http://caiqinghua.github.io/blog/2013/08/26/deploy-octopress-to-github-pages/</a></li>
<li><a href="http://www.cnblogs.com/oec2003/archive/2013/05/31/3109577.html">http://www.cnblogs.com/oec2003/archive/2013/05/31/3109577.html</a></li>
<li><a href="http://codemacro.com/2012/07/18/add-tag-to-octopress/">http://codemacro.com/2012/07/18/add-tag-to-octopress/</a></li>
</ul>
</li>
</ul>
<!-- more -->
<hr />
<h1>[转]教程:一步步在github上建立octopress博客</h1>
<p><em>照此教程,可搭建此博客.</em></p>
<p><img src="http://never.doubting.me/fancybox/image/octopress_logo.jpg" alt="image" /></p>
<h2>目标</h2>
<p>创建网址为<code>http://never.doubting.me</code>的博客.博客使用octopress程序,搭建在github的服务器上.网页与本地机器的<code>never.doubting.me</code>文件夹同步.</p>
<h3>步骤</h3>
<h4>0) 配置环境</h4>
<p>octopress需要ruby和git支持. 因此我们需要先安装这两个程序. 这儿分windows和Mac分别讲下.</p>
<h5>Windows(简略说下,详细教程请搜索):</h5>
<p>下载并安装git:</p>
<blockquote><p><a href="http://git-scm.com/download">http://git-scm.com/download</a></p></blockquote>
<p>下载并安装Ruby和开发组件(DEVELOPMENT KIT),共两个文件,Ruby推荐1.9.3版,对octopuses支持很好:</p>
<blockquote><p><a href="http://rubyinstaller.org/downloads/">http://rubyinstaller.org/downloads/</a></p></blockquote>
<h5>Mac:</h5>
<p>Mac本身自带了git,因此不需要单独安装.</p>
<p>Octopress需要带openssl组件的ruby支持.</p>
<p>但新版本的ruby似乎编译对参数–with-openssl-dir=my/openssl/dir支持有问题, 因此推荐使用rvm安装管理多版本的Ruby, rvm默认安装Ruby 2.0版本, 这儿为了不发生兼容性问题, 除了默认的2.0, 再安装个带openssl的1.9.3版.</p>
<ul>
<li><p>确认Xcode和其自带的命令行工具已经安装.</p>
<p>如没有,Xcode可在App Store免费下载.<code>命令行工具</code>可以在<code>Xcode- Preferences - Download</code> 中 点击安装 <code>Command Line Tools</code>.</p></li>
<li>安装rvm, rvm是个软件管理工具,和Linux上的apt-get,yum之类类似.</li>
</ul>
<blockquote><p>sudo curl -L <a href="https://get.rvm.io">https://get.rvm.io</a> | bash -s stable</p></blockquote>
<p>在~/.bash_profile文件末尾添加:</p>
<blockquote><p>echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”</p></blockquote>
<p>加载下配置文件:</p>
<blockquote><p>source ~/.bash_profile</p></blockquote>
<ul>
<li>安装1.93版支持openssl的Ruby.</li>
</ul>
<blockquote><p>rvm install 1.9.3 –with-gcc=clang —-with-openssl-dir=$HOME/.rvm/usr</p>
<p>rvm use 1.9.3 –default</p></blockquote>
<h4>1) 下载octopress至本地never.doubting.me文件夹</h4>
<p>octopress的源代码同样在github上管理,因此我们使用git克隆一份到本地的<code>never.doubting.me</code>文件夹,并进入此文件夹. 如你没有域名,可以使用github提供的默认域名:<code>yourname.github.com</code>,yourname是你github的用户名.</p>
<blockquote><p>git clone git://github.com/imathis/octopress.git never.doubting.me</p>
<p>cd never.doubting.me</p></blockquote>
<h4>2) 安装相关组件</h4>
<blockquote><p>gem install bundler
bundle install</p></blockquote>
<h4>3) 安装主题</h4>
<blockquote><p>rake install</p></blockquote>
<p>上条命令安装默认主题,在<code>https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes</code>可以找到许多第三方主题,这儿我们选择<code>slash</code>主题,如询问是否覆盖,选择是:</p>
<blockquote><p>git clone git://github.com/tommy351/Octopress-Theme-Slash.git .themes/slash</p>
<p>rake install[‘slash’]</p></blockquote>
<h4>4) 在github上创建repository</h4>
<p>去Github上注册个账户,选择免费套餐.
新建一个repository.
注意:repository的名字一定要<code>yourname.github.com</code>这样的格式. yourname是你注册时的用户名.
这儿我创建名为znithy.github.com的repository,创建好后拷贝ssh地址.</p>
<blockquote><p>[email protected]:znithy/znithy.github.com.git</p></blockquote>
<h4>5) 建立本地与github的联系</h4>
<blockquote><p>rake setup_github_pages</p></blockquote>
<p>输入上述ssh地址,注意区分大小写. 如遇验证问题,提示类似</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rake aborted!
</span><span class='line'>undefined method
</span><span class='line'>[]' for nil:NilClass
</span><span class='line'>
</span><span class='line'>Tasks: TOP => setup_github_pages
</span><span class='line'>(See full trace by running task with --trace)</span></code></pre></td></tr></table></div></figure>
<p>的信息,请看此文:<a href="http://never.doubting.me/2013/04/18/2013-04-18-github-set-up-ssh-keys/">github设置ssh验证</a></p>
<h4>6) 绑定域名</h4>
<p>首先把你的域名指向207.97.227.245,如不知怎么操作,请咨询域名注册商. 在source文件夹下建立CNAME文件:</p>
<blockquote><p>echo ‘never.doubting.me’ >> source/CNAME</p></blockquote>
<h4>7) 生成网页并推送到github</h4>
<blockquote><p>rake generate</p>
<p>rake deploy</p></blockquote>
<p>稍等几分钟,你就可通过域名访问博客了.并且收到一封博客建立的信件.</p>
<h4>8) 自定义博客</h4>
<p>博客的基本信息在_config.yml文件中修改. 自定义css等在source文件夹中. 修改后别忘了:</p>
<blockquote><p>rake generate</p>
<p>rake deploy</p></blockquote>
<h4>9) 发表文章</h4>
<blockquote><p>rake new_post[“教程:一步步在github上建立octopress博客”]</p></blockquote>
<p>这儿我新建了一篇名为教程:一步步在github上建立octopress博客的文章. 之后去source/_post/文件夹找到对应.markdown文件修改.
打开文件后可以看到文件头包含一些文章的信息,这儿我修改为:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>---
</span><span class='line'>layout: post
</span><span class='line'>title: "教程:一步步在github上建立octopress博客"
</span><span class='line'>date: 2013-04-18 01:13
</span><span class='line'>author: znithy
</span><span class='line'>comments: true
</span><span class='line'>categories:
</span><span class='line'>- 教程
</span><span class='line'>- github
</span><span class='line'>- octopress
</span><span class='line'>published: false
</span><span class='line'>---</span></code></pre></td></tr></table></div></figure>
<p>第一张指明此篇是post,后面是标题,时间和作者,我加了教程 github octopuses 三个标签,并且允许评论,published: false表示不要发表,如想要发表改成published: true或者直接删掉这行.</p>
<p>文章直接写在这部分内容下面.</p>
<h4>10) 发表外链文章</h4>
<p>点击标题转向其他网页.创建方法同上,只是需要添加external-url这个条目. 下面是一个例子:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>---
</span><span class='line'>layout: post
</span><span class='line'>title: "非常不错的科学博客"
</span><span class='line'>date: 2013-04-18 01:13
</span><span class='line'>comments: true
</span><span class='line'>external-url: http://keep.doubting.me/
</span><span class='line'>---</span></code></pre></td></tr></table></div></figure>
<h4>11) 发表页面</h4>
<p>创建网址为 <a href="http://never.doubting.me/about/i.html">http://never.doubting.me/about/i.html</a> 的网页:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rake new_page[about/i.html]</span></code></pre></td></tr></table></div></figure>
<p>与post不同的是,此时没有categories这个条目,但多了sharing和footer,具体有什么作用,不妨自己试下.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>---
</span><span class='line'>layout: page
</span><span class='line'>title: "Super Awesome"
</span><span class='line'>date: 2011-07-03 5:59
</span><span class='line'>comments: true
</span><span class='line'>sharing: true
</span><span class='line'>footer: true
</span><span class='line'>---</span></code></pre></td></tr></table></div></figure>
<h4>12) 管理文章</h4>
<p>直接增加或删除.markdown文件即可. 每次更新文件后别忘了:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rake generate
</span><span class='line'>rake deploy</span></code></pre></td></tr></table></div></figure>
<h4>其他</h4>
<h5>git设置用户名</h5>
<p>默认情况下直接使用系统的用户名,也可通过下面的命令自定义:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git config --global user.name author #将用户名设为author
</span><span class='line'>git config --global user.email [email protected] #将用户邮箱设为[email protected]</span></code></pre></td></tr></table></div></figure>
<h5>关于怎样使用git,这份教程很不错,推荐.</h5>
<blockquote><p><a href="http://znithy.com/download/%E7%9C%8B%E6%97%A5%E8%AE%B0%E5%AD%A6git.pdf">看日记学git.pdf</a></p></blockquote>
<h5>第三方插件地址:</h5>
<blockquote><p><a href="https://github.com/imathis/octopress/wiki/3rd-party-plugins">https://github.com/imathis/octopress/wiki/3rd-party-plugins</a></p></blockquote>
<h5>中文问题:</h5>
<p>如遇到此类提示(可能因设置了中文的catagory):</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>...
</span><span class='line'>Liquid Exception: invalid byte sequence in UTF-8 in atom.xml
</span><span class='line'>/Documents/never.doubting.me/plugins/octopress_filters.rb:75:in `gsub'
</span><span class='line'>/Documents/never.doubting.me/plugins/octopress_filters.rb:75:in `cdata_escape'
</span><span class='line'>...</span></code></pre></td></tr></table></div></figure>
<p>最方便的方法是换用kramdown.首先安装kramdown:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>gem install kramdown</span></code></pre></td></tr></table></div></figure>
<p>之后修改<code>_config.yml</code>文件:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>markdown: kramdown</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
</feed>