-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
303 lines (225 loc) · 56.9 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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Chenjiangtao's Blog</title>
<link href="/atom.xml" rel="self"/>
<link href="http://itdog.cf/"/>
<updated>2018-01-21T13:19:45.520Z</updated>
<id>http://itdog.cf/</id>
<author>
<name>chenjiangtao</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>mysql常用命令</title>
<link href="http://itdog.cf/2018/01/21/mysql%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/"/>
<id>http://itdog.cf/2018/01/21/mysql常用命令/</id>
<published>2018-01-21T12:59:46.000Z</published>
<updated>2018-01-21T13:19:45.520Z</updated>
<content type="html"><p>###启动mysql服务<br>1 使用service启动<br><a id="more"></a><br><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">service mysqld start(5.0版本是mysql)</span><br><span class="line">service mysql start(5.5.7版本是mysql)</span><br></pre></td></tr></table></figure></p>
</content>
<summary type="html">
<p>###启动mysql服务<br>1 使用service启动<br>
</summary>
<category term="mysql" scheme="http://itdog.cf/tags/mysql/"/>
</entry>
<entry>
<title>Ubuntu英文服务器安装中文支持</title>
<link href="http://itdog.cf/2016/10/03/ubuntu%E8%8B%B1%E6%96%87%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%AE%89%E8%A3%85%E4%B8%AD%E6%96%87%E6%94%AF%E6%8C%81/"/>
<id>http://itdog.cf/2016/10/03/ubuntu英文服务器安装中文支持/</id>
<published>2016-10-03T11:02:33.000Z</published>
<updated>2018-01-13T05:50:59.147Z</updated>
<content type="html"><ol>
<li>安装中文支持: <code>sudo apt-get install language-pack-zh-hant language-pack-zh-hans</code></li>
<li>添加中文支持:<br> <code>sudo vim /var/lib/locales/supported.d/local</code><br>设置如下:<br><code>en_US.UTF-8 UTF-8</code><br><code>zh_CN.UTF-8 UTF-8</code><br><code>zh_CN.GBK GBK</code><br><code>zh_CN GB2312</code></li>
</ol>
<p>运行sudo locale-gen 或者 sudo dpkg-reconfigure locales<br>3. 修改配置文件:<br> <code>sudo vim /etc/environment</code><br> 1、如果你需要一个纯中文的系统的话,设定LC_ALL= zh_CN.XXXX,或者LANG= zh_CN.XXXX都可以.<br> 2、如果你只想要一个可以输入中文的环境,而保持菜单、标题,系统信息等等为英文界面,那么只需要设定 LC_CTYPE=zh_CN.XXXX,LANG=en_US.XXXX就可以了。<br> 我的配置如下:</p>
<pre><code>PATH=&quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&quot;
LANG=&quot;en_US.UTF-8&quot;
LANGUAGE=&quot;zh_CN:zh:en_US:en&quot;
LC_CTYPE=&quot;zh_CN.UTF-8&quot;
</code></pre><p><a href="http://blog.csdn.net/bing19880122/article/details/5047172" target="_blank" rel="external">refre</a></p>
</content>
<summary type="html">
租了个阿里云服务器,安装的服务器是ubuntu 14.04英文版。布置程序时发现不支持中文。经过摸索终于搞定了。
</summary>
<category term="服务器" scheme="http://itdog.cf/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/"/>
<category term="linux" scheme="http://itdog.cf/tags/linux/"/>
</entry>
<entry>
<title>用Python爬取教务系统成绩</title>
<link href="http://itdog.cf/2016/08/16/%E7%94%A8Python%E7%88%AC%E5%8F%96%E6%95%99%E5%8A%A1%E7%B3%BB%E7%BB%9F%E6%88%90%E7%BB%A9/"/>
<id>http://itdog.cf/2016/08/16/用Python爬取教务系统成绩/</id>
<published>2016-08-16T14:27:56.000Z</published>
<updated>2018-01-13T05:45:14.103Z</updated>
<content type="html"><p>本文主要参考:<a href="http://www.w2bc.com/article/39034" target="_blank" rel="external">python爬虫实战之模拟正方教务系统登录查询成绩</a></p>
<p>每次查成绩都要手动登录去查,最近在学Python,就想着用Python写一个脚本自己获取成绩,由于学校用的是方正教务系统,于是随手搜了一下有现成的,但是并不能直接用,经过摸索修改终于可以了。先看看效果<br><img src="http://ww3.sinaimg.cn/large/c28b7899jw1f6vz3stsdhj20gl0fi0wj.jpg" alt="查成绩"><br>好吧,暴露了我的学渣属性……</p>
<p>我们学校教务系统总共采取了三种措施来认证访问的合法性:<br> 1,随机的Hash值<br> 2,随机的Viewstate值<br> 3,Referer值<br>第二条在我们参考的那篇文章中已经解决。</p>
<p>我们学校在登录上做了一丢丢手脚,去掉了Cookies,但是第一次访问登录页面时会返回一个随机的Hash值,并且这个Hash值会一直伴随着本次登录,直到用户退出。</p>
<p><img src="http://ww1.sinaimg.cn/large/c28b7899jw1f6vznxelvfj20eu03a3yz.jpg" alt="Hash"></p>
<p>也就是当我们访问<a href="http://202.200.112.200" target="_blank" rel="external">http://202.200.112.200</a> 时它会跳转到一个“不确定”的页面,其实只要获取这个Hash值就可以了,按F12看看</p>
<p><img src="http://ww2.sinaimg.cn/large/c28b7899jw1f6w01b4wwdj20wl0ghagd.jpg" alt="302跳转"><br>果真做了一次302跳转,我们只要从返回的headers中获取这串Hash码就行</p>
<figure class="highlight plain"><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">import request</span><br><span class="line">url = &apos;http://202.200.112.200/default6.aspx&apos;</span><br><span class="line">headers = requests.head(url).headers</span><br><span class="line">val = headers[&apos;location&apos;]</span><br><span class="line">return val[:28]</span><br></pre></td></tr></table></figure>
<p>以后只要在url中添上这串字符就可以了。</p>
<p>至此终于可以登录进去系统了,但是在访问查询成绩的页面时又碰到了钉子,再F12看看,<br><img src="http://ww2.sinaimg.cn/large/c28b7899jw1f6w0n2u7aij20er0fctcn.jpg" alt="Referer"><br>发现Headers中多了个个Referer属性,这个值是记录你上次访问的页面地址,也就是你从那个页面跳转到这个页面的,要是不符合规则就会访问失败,因此在每次访问时要在Headers中更新Referer信息。<br>完整代码:<a href="https://github.com/chmoyan/ScoreSpider/blob/master/ScoreSpider.py" target="_blank" rel="external">ScoreSpider.py</a></p>
</content>
<summary type="html">
(已失效)本文主要介绍用Python爬取教务系统成绩课表等,由于相关访问点已经关闭,故已经无法使用,不过还是有一定的参考价值。
</summary>
<category term="Python" scheme="http://itdog.cf/tags/Python/"/>
</entry>
<entry>
<title>vim自动补全插件YouCompleteMe安装</title>
<link href="http://itdog.cf/2016/08/07/vim%E8%87%AA%E5%8A%A8%E8%A1%A5%E5%85%A8%E6%8F%92%E4%BB%B6YouCompleteMe%E5%AE%89%E8%A3%85/"/>
<id>http://itdog.cf/2016/08/07/vim自动补全插件YouCompleteMe安装/</id>
<published>2016-08-06T16:14:11.000Z</published>
<updated>2018-01-13T05:30:09.867Z</updated>
<content type="html"><h4 id="YouCompleteMe简介"><a href="#YouCompleteMe简介" class="headerlink" title="YouCompleteMe简介"></a>YouCompleteMe简介</h4><p>YCM基于语义引擎(比如C家族的libclang)提供了语义补全,是通过分析源文件,经过语法分析之后进行补全。对于C家族的语言这种基于语义的自动补全依赖于clang/llvm,其他语言 ,会调用vim设置的omnifunc来匹配,详细信息可以查看<a href="https://github.com/Valloric/YouCompleteMe" target="_blank" rel="external">github</a></p>
<h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><p>使用Vundle来安装<a href="http://itdog.cf/2016/07/14/vim%E5%AE%89%E8%A3%85Markdown%E5%AE%9E%E6%97%B6%E9%A2%84%E8%A7%88%E6%8F%92%E4%BB%B6/#%E5%AE%89%E8%A3%85">没安装Vundle的戳这里</a><br>安装好Vunle后在vimrc文件中添加<code>Pluing &#39;Valloric/YouCompleteMe&#39;</code>,执行<code>PlugingInstall</code>安装,要下载的文件较多,请耐心等待。<br>由于使用的是kali和ubuntu属于同系系统,可采用ubuntu系统的安装方式。<br>执行下面步骤前请确保</p>
<ol>
<li>你的vim版本在7.3.598以上并且支持python2或python3</li>
<li>安装了cmake和python-dev,若没有安装,执行<code>sudo apt-get install build-essential cmake</code>,<code>sudo apt-get install python-dev python3-dev</code>。</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd ~/.vim/bundle/YouCompleteMe</span><br><span class="line">sudo ./install.py</span><br></pre></td></tr></table></figure>
<p>希望支持c族语言则<code>./install.py --clang-completer</code>;<br>C# :<code>./install.py --omnisharp-completer</code>;<br>JavaScript: <code>./install.py --tern-completer</code>;<br>如果安装过程中出错尝试使用root权限安装。</p>
<h4 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h4><p>打开默认的配置文件<br><code>vim ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py</code><br>在flags[ * ]数组的后面添加你想要的路径,例如: stdio.h等C语言的头文件包含在/usr/include中,那么您需要添加这样一条<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># c语言</span><br><span class="line">&apos;-isystem&apos;,</span><br><span class="line">&apos;/usr/include&apos;,</span><br><span class="line"># c++</span><br><span class="line">&apos;-isystem&apos;,</span><br><span class="line">&apos;/usr/include/c++/5.3.1&apos;,</span><br></pre></td></tr></table></figure></p>
<p>注释掉下面这4行<br><figure class="highlight plain"><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"># try:</span><br><span class="line"># final_flags.remove( &apos;-stdlib=libc++&apos; )</span><br><span class="line"># except ValueError:</span><br><span class="line"># pass</span><br></pre></td></tr></table></figure></p>
<p>接下来打开 ~/ 下的.vimrc文件添加<code>let g:ycm_global_ycm_extra_conf = &#39;~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py&#39;</code>即指定默认配置文件路径。</p>
</content>
<summary type="html">
本文主要介绍YouComplete的安装和配置,以及在此过程中遇到的问题。
</summary>
<category term="vim" scheme="http://itdog.cf/tags/vim/"/>
</entry>
<entry>
<title>C&C++中const的用法</title>
<link href="http://itdog.cf/2016/07/26/c%E5%92%8Cc++%E4%B8%ADconst%E7%9A%84%E7%94%A8%E6%B3%95%E5%92%8C%E5%8C%BA%E5%88%AB/"/>
<id>http://itdog.cf/2016/07/26/c和c++中const的用法和区别/</id>
<published>2016-07-26T14:13:23.000Z</published>
<updated>2018-01-13T05:51:38.499Z</updated>
<content type="html"><h4 id="C语言中const的用法"><a href="#C语言中const的用法" class="headerlink" title="C语言中const的用法"></a>C语言中const的用法</h4><p>1、在C语言中<code>const</code>关键字比较霸道,被他修饰的变量的值不允许被改变(只读),即为“常量”;正因为如此在声明常量时必须赋给初值。<br>2、<code>const</code>功力深厚可以穿透类型。</p>
<p> 只要把握好这两点就可以很好的掌握const的语义<br> 下面就这两条规则进行详细说明<br><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><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line">/* const int 与 int const*/</span><br><span class="line"></span><br><span class="line">const int a = 10;</span><br><span class="line">int const a = 10;</span><br><span class="line">/*</span><br><span class="line"> * 上面这两条语句语义相同,都是限定整形a的值不允许不改变</span><br><span class="line"> * 语义相同 对应第二条const穿透类型定义“int”直接作用于“a”</span><br><span class="line"> * a值不允许改变对应第一条</span><br><span class="line"> */</span><br><span class="line">const int a = 10;//合法,声明时初始化</span><br><span class="line">a = 10;//试图修改常量a的值</span><br><span class="line">const int b;//这样也是可以的,但是b的值将是一个不确定的值并且无法改变</span><br><span class="line"></span><br><span class="line">/* 指向常量的指针*/</span><br><span class="line">const int *p;</span><br><span class="line">int const *p;</span><br><span class="line">/*</span><br><span class="line"> * 同样上面两条语句意思也是一样的 const修饰的是<span class="string">"*p"</span></span><br><span class="line"> * 这意味这*p的值无法改变,但是p的指向可以改变</span><br><span class="line"> * 因此我们可以在声明指针p的时候不赋给初值</span><br><span class="line"> */</span><br><span class="line"></span><br><span class="line">const int a = 10;</span><br><span class="line">const int b = 20;</span><br><span class="line">const int *p;</span><br><span class="line">p = &amp;10;</span><br><span class="line">p = &amp;20;//合法,改变p的指向</span><br><span class="line">*p = 30;//非法,*p的值不允许被改变</span><br><span class="line"></span><br><span class="line">/*</span><br><span class="line"> * p也可以指向变量</span><br><span class="line"> */</span><br><span class="line">int c = 10;</span><br><span class="line">p = &amp;c;</span><br><span class="line">c = 20;//合法,c为变量,*p的值也会改变(废话!)</span><br><span class="line">*p = 20;//非法,*p为常量</span><br><span class="line"></span><br><span class="line">/*这种特性在函数传参时非常有用*/</span><br><span class="line">void show(const int *p)</span><br><span class="line">/*show()是一个打印函数我们只希望他读取传进去的值(只读),而不希望他拥有改变(只读)的权限*/</span><br><span class="line">show(&amp;c);</span><br><span class="line"></span><br><span class="line">/* 常指针 即指针本身为常量*/</span><br><span class="line">int* const p = &amp;a;//为常量,声明时赋值</span><br><span class="line">p = &amp;b;//非法,试图改变常量的值</span><br><span class="line"></span><br><span class="line">/*指向常量的常指针*/</span><br><span class="line">const int* const p = &amp;a;</span><br><span class="line">int const* const p1 = &amp;b;</span><br><span class="line"></span><br><span class="line">p = &amp;b;//错误,p为常指针</span><br><span class="line">*p = b;//错误,*p(p所指的值)为常量</span><br></pre></td></tr></table></figure></p>
</content>
<summary type="html">
介绍const关键字在C&C++语言中的用法与特点。
</summary>
<category term="c" scheme="http://itdog.cf/tags/c/"/>
<category term="c++" scheme="http://itdog.cf/tags/c/"/>
</entry>
<entry>
<title>vim安装markdown实时预览工具</title>
<link href="http://itdog.cf/2016/07/14/vim%E5%AE%89%E8%A3%85Markdown%E5%AE%9E%E6%97%B6%E9%A2%84%E8%A7%88%E6%8F%92%E4%BB%B6/"/>
<id>http://itdog.cf/2016/07/14/vim安装Markdown实时预览插件/</id>
<published>2016-07-14T14:10:21.000Z</published>
<updated>2018-01-21T13:19:13.952Z</updated>
<content type="html"><h4 id="语法"><a href="#语法" class="headerlink" title="语法"></a>语法</h4><p>MarkDown语法简答,易学<a href="http://wowubuntu.com/markdown/" target="_blank" rel="external">详见</a></p>
<h5 id="先简单介绍一下这个插件"><a href="#先简单介绍一下这个插件" class="headerlink" title="先简单介绍一下这个插件"></a>先简单介绍一下这个插件</h5><ol>
<li>这是一款vim插件</li>
<li>可以实时预览,你可以看到你敲的每一个字符的转换效果</li>
<li>预览时随着你编辑的文件的滚动,生成的页面也会自己滚动</li>
<li>可以设置用vim打开md文件时自动打开预览页面</li>
</ol>
<h5 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h5><p>我们使用Vundle(一个Vim插件管理器)来安装<br><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">$ Git <span class="built_in">clone</span> https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle</span><br></pre></td></tr></table></figure></p>
<p> 配置vimrc文件</p>
<pre><code>插播一段 vimrc的存放位置:
系统 vimrc 文件: &quot;$VIM/vimrc&quot;
用户 vimrc 文件: &quot;$HOME/.vimrc&quot;
用户 exrc 文件: &quot;$HOME/.exrc&quot;
系统 gvimrc 文件: &quot;$VIM/gvimrc&quot;
用户 gvimrc 文件: &quot;$HOME/.gvimrc&quot;
系统菜单文件: &quot;$VIMRUNTIME/menu.vim&quot;
$VIM 预设值: &quot;/usr/share/vim&quot;
</code></pre><p>配置不同地方的vimrc文件作用的范围也就不同。由于我们的vundle是安装在当前用户的目录下的,所以我们修改当前用户的vimrc配置文件即可,即只对当前用户有效。<br>打开配置文件<br>vim ~/.vimrc<br>添加如下信息<br><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"><span class="built_in">set</span> rtp+=~/.vim/bundle/vundle/ </span><br><span class="line">call vundle<span class="comment">#rc() </span></span><br><span class="line">Plugin <span class="string">'iamcco/markdown-preview.vim'</span></span><br></pre></td></tr></table></figure></p>
<p>然后运行<code>:PluginInstall</code><br>稍等片刻左下角出现”Done”则说明markdown-preview安装成功<br><img src="http://ww1.sinaimg.cn/large/c28b7899jw1f5tvudj1klj20ou0fwaes.jpg" alt="PluginInstall"></p>
<h4 id="使用和设置"><a href="#使用和设置" class="headerlink" title="使用和设置"></a>使用和设置</h4><h5 id="命令"><a href="#命令" class="headerlink" title="命令"></a>命令</h5><pre><code>MarkdownPreview
&quot; 在打开 markdown 文件后,使用该命令可以打开预览窗口
MarkdownPreviewStop
&quot; 关闭 markdown 预览窗口,并停止开启的服务进程
</code></pre><h5 id="修改配置文件"><a href="#修改配置文件" class="headerlink" title="修改配置文件"></a>修改配置文件</h5><p><code>vim ~/.vim/bundle/markdown-preview.vim/plugin/mkdp.vim</code></p>
<pre><code>vth_to_chrome = &quot;firefox &amp;&gt;log&quot;
&quot; 设置 浏览器 的路径(或是启动 浏览器 的命令)
let g:mkdp_auto_start = 1
&quot; 设置为 1 可以在打开 markdown 文件的时候自动打开浏览器预览,只在打开
&quot; markdown 文件的时候打开一次
let g:mkdp_auto_open = 1
&quot; 设置为 1 在编辑 markdown 的时候检查预览窗口是否已经打开,否则自动打开预
&quot; 览窗口
let g:mkdp_auto_close = 1
&quot; 在切换 buffer 的时候自动关闭预览窗口,设置为 0 则在切换 buffer 的时候不
&quot; 自动关闭预览窗口
let g:mkdp_refresh_slow = 0
&quot; 设置为 1 则只有在保存文件,或退出插入模式的时候更新预览,默认为 0,实时
&quot; 更新预览
let g:mkdp_command_for_global = 0
&quot; 设置为 1 则所有文件都可以使用 MarkdownPreview 进行预览,默认只有 markdown
&quot; 文件可以使用改命令im ~/.vimrc
</code></pre><p><a href="https://github.com/iamcco/markdown-preview.vim" target="_blank" rel="external">详细信息</a></p>
</content>
<summary type="html">
尽管MarkDown语法简答,但也不能排除有用错的时候,特别是刚开始使用的时候。难道要每次写完用hexo生成页面之后再改?没错,以前我就是这样干的。写了一篇我就忍不了了,于是搜了搜有没有实时预览的插件。有时候真是只有想不到没有做不到,markdown-preview,就是这样一款神器。
</summary>
<category term="Markdown" scheme="http://itdog.cf/tags/Markdown/"/>
<category term="vim" scheme="http://itdog.cf/tags/vim/"/>
</entry>
<entry>
<title>vim配置和常用命令</title>
<link href="http://itdog.cf/2016/07/09/vim%E9%85%8D%E7%BD%AE%E5%92%8C%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/"/>
<id>http://itdog.cf/2016/07/09/vim配置和常用命令/</id>
<published>2016-07-09T15:19:46.000Z</published>
<updated>2018-01-13T08:12:24.115Z</updated>
<content type="html"><h3 id="1、vim基本配置"><a href="#1、vim基本配置" class="headerlink" title="1、vim基本配置"></a>1、vim基本配置</h3><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><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">"语法高亮</span><br><span class="line">syntax on</span><br><span class="line"></span><br><span class="line">"</span>显示行号</span><br><span class="line"><span class="built_in">set</span> number</span><br><span class="line"></span><br><span class="line"><span class="string">"侦测文件类型</span><br><span class="line">filetype on</span><br><span class="line">"</span> 不同文件设置不同缩进</span><br><span class="line">filetype indent on</span><br><span class="line"></span><br><span class="line"><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">"</span><br><span class="line">"</span>文本格式和排版</span><br><span class="line"><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">""</span><span class="string">"</span><br><span class="line">"</span>自动格式化</span><br><span class="line"><span class="built_in">set</span> formatoptions=tcrqn</span><br><span class="line"><span class="string">"继承前一行的缩进方式</span><br><span class="line">set autoindent</span><br><span class="line">"</span>为C程序提供自动缩进</span><br><span class="line"><span class="built_in">set</span> smartindent</span><br><span class="line"></span><br><span class="line"><span class="string">"统一缩进为4</span><br><span class="line">set tabstop=4</span><br><span class="line">set shiftwidth=4</span><br><span class="line"></span><br><span class="line">"</span>不要使用空格代替Tab</span><br><span class="line"><span class="built_in">set</span> noexpandtab</span><br><span class="line"></span><br><span class="line"><span class="string">"不自动换行</span><br><span class="line">set nowrap</span><br><span class="line">"</span>行首段首自动缩进</span><br><span class="line"><span class="built_in">set</span> smarttab</span><br><span class="line"></span><br><span class="line"><span class="string">"显示匹配的括号</span><br><span class="line">set showmatch</span><br><span class="line"></span><br><span class="line">"</span>修改保存后自动生成备份</span><br><span class="line"><span class="keyword">if</span> has(<span class="string">"vms"</span>)</span><br><span class="line"> <span class="built_in">set</span> nobackup</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"> <span class="built_in">set</span> backup</span><br><span class="line">endif</span><br></pre></td></tr></table></figure>
<h3 id="2、vim使用技巧"><a href="#2、vim使用技巧" class="headerlink" title="2、vim使用技巧"></a>2、vim使用技巧</h3><ul>
<li><p>同时打开多个文件<br><code>:vsplit</code> 左右分屏<br><code>:split</code> 上下分屏</p>
</li>
<li><p>粘贴模式<br><code>set paste</code> 取消自动缩进<br><code>set nopaste</code> 退出粘贴模式</p>
</li>
<li><p>多行注释</p>
<ol>
<li>按CTRL+V进入(VISUAL BLOCK)模式</li>
<li>移动光标选择多行的开头</li>
<li>选择完毕后按大写的I</li>
<li>输入//</li>
<li>按ESC退出</li>
</ol>
</li>
<li><p>取消多行注释<br>前两步与上面相同,选择完毕后按d,然后按ESC</p>
</li>
<li><p>查找替换</p>
</li>
</ul>
</content>
<summary type="html">
本文主要记录自己平常编程过程中使用vim的一些设置和命令等,记录的可能会有些乱,每隔一段时间会进行整理,方便自己遗忘时查阅。
</summary>
<category term="vim" scheme="http://itdog.cf/tags/vim/"/>
</entry>
<entry>
<title>用github Page和hexo搭建个人静态博客</title>
<link href="http://itdog.cf/2016/07/06/%E7%94%A8hexo%E6%90%AD%E5%BB%BAgithub%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/"/>
<id>http://itdog.cf/2016/07/06/用hexo搭建github静态博客/</id>
<published>2016-07-06T15:34:45.000Z</published>
<updated>2018-01-21T13:08:56.660Z</updated>
<content type="html"><h3 id="安装和配置git"><a href="#安装和配置git" class="headerlink" title="安装和配置git"></a>安装和配置git</h3><p>kali2.0默认安装有git,若没有安装,执行<em>sudo apt-get install git</em>安装</p>
<h4 id="1-检查ssh-key"><a href="#1-检查ssh-key" class="headerlink" title="1.检查ssh key"></a>1.检查ssh key</h4><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">$ <span class="built_in">cd</span> ~/.ssh</span><br></pre></td></tr></table></figure>
<p>如果显示“No such file or directory”,跳到第三步,否则继续。</p>
<h4 id="2、备份和移除原来的ssh-key设置:"><a href="#2、备份和移除原来的ssh-key设置:" class="headerlink" title="2、备份和移除原来的ssh key设置:"></a>2、备份和移除原来的ssh key设置:</h4><p>因为已经存在key文件,所以需要备份旧的数据并删除:<br><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></pre></td><td class="code"><pre><span class="line">$ ls</span><br><span class="line">config id_rsa id_rsa.pub known_hosts</span><br><span class="line">$ mkdir key_backup</span><br><span class="line">$ cp id_rsa* key_backup</span><br><span class="line">$ rm id_rsa*</span><br></pre></td></tr></table></figure></p>
<h4 id="3、生成新的SSH-Key:"><a href="#3、生成新的SSH-Key:" class="headerlink" title="3、生成新的SSH Key:"></a>3、生成新的SSH Key:</h4><p>输入下面的代码,就可以生成新的key文件,这里全部保持默认按三次回车就行,<br><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">"邮件地址@youremail.com"</span></span><br></pre></td></tr></table></figure></p>
<h4 id="4、添加SSH-Key到GitHub"><a href="#4、添加SSH-Key到GitHub" class="headerlink" title="4、添加SSH Key到GitHub"></a>4、添加SSH Key到GitHub</h4><p>在本机设置SSH Key之后,需要添加到GitHub上,以完成SSH链接的设置、这样以后用本用户同步文章就不需要输入密码了。<br><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><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">cat ~/.ssh/id\_rsa.pub</span><br><span class="line">将输出到终端的内容手动复制下来。这里不用vim打开的原因是,vim会自动增加换行符从而产生错误。</span><br><span class="line">登陆github系统。点击右上角的 头像-&gt; Settings—&gt; SSH and GPG keys —&gt; New SSH keys</span><br><span class="line">把你本地生成的密钥复制到里面(key文本框中), 点击 add key </span><br><span class="line">测试</span><br><span class="line">可以输入下面的命令,看看设置是否成功,[email protected]的部分不要修改:</span><br><span class="line"></span><br><span class="line">$ ssh -T [email protected]</span><br><span class="line"></span><br><span class="line">如果是下面的反馈:</span><br><span class="line"></span><br><span class="line">The authenticity of host <span class="string">'github.com (207.97.227.239)'</span> can<span class="string">'t be established.</span><br><span class="line">RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.</span><br><span class="line">Are you sure you want to continue connecting (yes/no)?</span><br><span class="line">不要紧张,输入yes就好,然后会看到:</span><br><span class="line"></span><br><span class="line">Hi cnfeat! You'</span>ve successfully authenticated, </span><br><span class="line">but GitHub does not provide shell access.</span><br><span class="line"></span><br><span class="line">设置用户信息:</span><br><span class="line">现在你已经可以通过SSH链接到GitHub了,还有一些个人信息需要完善的。</span><br><span class="line">Git会根据用户的名字和邮箱来记录提交。</span><br><span class="line">GitHub也是用这些信息来做权限的处理,输入下面的代码进行个人信息的设置,把名称和邮箱替换成你自己的。</span><br><span class="line">$ git config --global user.name <span class="string">"cnfeat"</span>//用户名</span><br><span class="line">$ git config --global user.email <span class="string">"[email protected]"</span>//填写自己的邮箱</span><br><span class="line"></span><br><span class="line">SSH Key配置成功,本机已成功连接到github。</span><br></pre></td></tr></table></figure></p>
<h3 id="安装nodejs"><a href="#安装nodejs" class="headerlink" title="安装nodejs"></a>安装nodejs</h3><p>进入<a href="https://nodejs.org/en/" target="_blank" rel="external">nodejs官网</a>下载最新版安装包。<br>这里下载的是编译好的二进制文件,进入下载目录解压并拷贝到相应系统目录就行。<br><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"><span class="variable">$tar</span> -xf node-v4.4.6-linux-x64.tar.xz </span><br><span class="line"><span class="variable">$cd</span> node-v4.4.6-linux-x64</span><br><span class="line"><span class="variable">$sudo</span> cp bin/* /usr/bin/</span><br><span class="line"><span class="variable">$node</span> -v</span><br></pre></td></tr></table></figure></p>
<p><img src="http://ww1.sinaimg.cn/large/c28b7899jw1f5a7vru74dj20fp02rq3r.jpg" alt="安装nodejs"><br>参考: <a href="http://http://www.xitongzhijia.net/xtjc/20150202/36680.html" target="_blank" rel="external">Linux安装Nodejs的三大方法</a></p>
<h3 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h3><p>nodejs 安装好后就可以安装hexo了,安装过程中会有警告出现,但是并不影响使用</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"><span class="variable">$sudo</span> npm install hexo-cli -g</span><br><span class="line"><span class="variable">$sudo</span> npm install hexo --save</span><br><span class="line">$ hexo -v</span><br></pre></td></tr></table></figure>
<p>安装成功会有如下信息<br><img src="http://ww4.sinaimg.cn/large/c28b7899jw1f5a8j03huvj20hb0a9tbu.jpg" alt="安装hexo"></p>
<h3 id="初始化Hexo"><a href="#初始化Hexo" class="headerlink" title="初始化Hexo"></a>初始化Hexo</h3><p>在你的用户home目录下新建一个hexo目录,这个目录将是hexo的工作目录,名字可以随便起<br><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">$ <span class="built_in">cd</span> ~/</span><br><span class="line">$ mkdir hexo</span><br><span class="line"><span class="variable">$cd</span> hexo</span><br><span class="line"><span class="variable">$hexo</span> init</span><br></pre></td></tr></table></figure></p>
<p>新建文章<br><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 n [layout] &lt;title&gt; <span class="comment">#其中layout为文章布局,默认为post title 为文章名</span></span><br></pre></td></tr></table></figure></p>
<p>生成页面<br><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">$ hexo g</span><br><span class="line">$ hexo s</span><br></pre></td></tr></table></figure></p>
<p>接着会有提示<br><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">INFO Start processing</span><br><span class="line">INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.</span><br></pre></td></tr></table></figure></p>
<p>在浏览器中打开<a href="http://localhost:4000" target="_blank" rel="external">http://localhost:4000</a> 即可看见生成的博客。</p>
<h3 id="将博客同步到github"><a href="#将博客同步到github" class="headerlink" title="将博客同步到github"></a>将博客同步到github</h3><p>还是在刚才创建的那个目录下面,在_config.yml文件中,找到Deployment,然后按照如下修改yourname为你的github用户名。<br><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: [email protected]:yourname/yourname.github.io.git</span><br><span class="line">branch: master</span><br></pre></td></tr></table></figure></p>
<p>修改完成后执行<em>sudo npm install hexo-deployer-git –save</em>来安装所需的插件<br>接下来执行 hexo d 即可同步到github,超级方便有木有!<br>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>
</content>
<summary type="html">
本文主要记录自己用hexo 和 github pages搭建这个博客的过程遇到的问题,对整个搭建过程不详细描述,使用的环境为kali2.0 64位。
</summary>
<category term="hexo" scheme="http://itdog.cf/tags/hexo/"/>
</entry>
</feed>