-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.xml
320 lines (249 loc) · 37.8 KB
/
feed.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
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2020-09-09T14:43:34+08:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Everest</title><subtitle>Theme based on <a href="http://materializecss.com">Materialize.css</a> for jekyll sites.
</subtitle><entry><title type="html">Vundle Usage Memo</title><link href="http://localhost:4000/2020/09/09/vundle-usage-memo" rel="alternate" type="text/html" title="Vundle Usage Memo" /><published>2020-09-09T00:00:00+08:00</published><updated>2020-09-09T00:00:00+08:00</updated><id>http://localhost:4000/2020/09/09/vundle-usage-memo</id><content type="html" xml:base="http://localhost:4000/2020/09/09/vundle-usage-memo"><blockquote>
<p>Some Vundle basic usage tips.</p>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#install-plugin" id="markdown-toc-install-plugin">Install Plugin</a></li>
<li><a href="#list-all-plugins" id="markdown-toc-list-all-plugins">List all Plugins</a></li>
<li><a href="#clean-plugin" id="markdown-toc-clean-plugin">Clean Plugin</a></li>
<li><a href="#update-plugin" id="markdown-toc-update-plugin">Update Plugin</a></li>
<li><a href="#reference" id="markdown-toc-reference">Reference</a></li>
</ul>
<h2 id="install-plugin">Install Plugin</h2>
<p>Launch vim and run</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>:PluginInstall
</code></pre></div></div>
<p>To install from command line: <code class="language-plaintext highlighter-rouge">vim +PluginInstall +qall</code>.</p>
<h2 id="list-all-plugins">List all Plugins</h2>
<p>Launch vim and run</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>:PluginList
</code></pre></div></div>
<h2 id="clean-plugin">Clean Plugin</h2>
<p>Launch vim and run</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>:PluginClean
</code></pre></div></div>
<p>It will remove all unused plugin folders in <code class="language-plaintext highlighter-rouge">.vim/bundle</code>.</p>
<h2 id="update-plugin">Update Plugin</h2>
<p>Launch vim and run</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>:PluginUpdate
</code></pre></div></div>
<p>It will update all the installed plugins.</p>
<h2 id="reference">Reference</h2>
<ul>
<li><a href="https://github.com/VundleVim/Vundle.vim">github - vundle</a></li>
<li><a href="https://linux.cn/article-9416-1.html">vundle tutorial - cn</a></li>
</ul>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["VIM"]" /><category term="vim" /><category term="vundle" /><summary type="html">Some Vundle basic usage tips.</summary></entry><entry><title type="html">Run Docker as Non-root User in Linux</title><link href="http://localhost:4000/2020/09/04/run-docker-as-non-root-user-in-linux" rel="alternate" type="text/html" title="Run Docker as Non-root User in Linux" /><published>2020-09-04T00:00:00+08:00</published><updated>2020-09-04T00:00:00+08:00</updated><id>http://localhost:4000/2020/09/04/run-docker-as-non-root-user-in-linux</id><content type="html" xml:base="http://localhost:4000/2020/09/04/run-docker-as-non-root-user-in-linux"><blockquote>
<p>The solution is simple:</p>
</blockquote>
<p>To fix the Docker permission denied error and use Docker as non-root user, create a group called “docker” with the following command:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>groupadd docker
</code></pre></div></div>
<p>Next, add your user to the docker group:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>usermod <span class="nt">-aG</span> docker <span class="nv">$USER</span>
</code></pre></div></div>
<p>After adding the user to the docker group, <em>log out</em> and <em>log back</em> in to take effect the changes.</p>
<!--more-->
<ul id="markdown-toc">
<li><a href="#reference" id="markdown-toc-reference">Reference:</a></li>
</ul>
<h2 id="reference">Reference:</h2>
<p><a href="https://ostechnix.com/how-to-run-docker-as-non-root-user-in-linux/">Run Docker as Non-root User in Linux</a></p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Operating System"]" /><category term="docker" /><summary type="html">The solution is simple: To fix the Docker permission denied error and use Docker as non-root user, create a group called “docker” with the following command: $ sudo groupadd docker Next, add your user to the docker group: $ sudo usermod -aG docker $USER After adding the user to the docker group, log out and log back in to take effect the changes.</summary></entry><entry><title type="html">Python Logging Export to File</title><link href="http://localhost:4000/2020/09/01/python-logging-export-to-file" rel="alternate" type="text/html" title="Python Logging Export to File" /><published>2020-09-01T00:00:00+08:00</published><updated>2020-09-01T00:00:00+08:00</updated><id>http://localhost:4000/2020/09/01/python-logging-export-to-file</id><content type="html" xml:base="http://localhost:4000/2020/09/01/python-logging-export-to-file"><blockquote>
<p>As for the need for logging from Python program, here is a memo for the use of the Python built-in module <code class="language-plaintext highlighter-rouge">logging</code></p>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#out-of-the-box-python-snippet" id="markdown-toc-out-of-the-box-python-snippet">Out-of-the-Box Python snippet</a></li>
<li><a href="#reference" id="markdown-toc-reference">Reference:</a></li>
</ul>
<h2 id="out-of-the-box-python-snippet">Out-of-the-Box Python snippet</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">logging</span>
<span class="n">log_save_dir</span> <span class="o">=</span> <span class="s">'/home'</span>
<span class="c1"># Setup Logging
# create a logger
</span><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">KFZ</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">)</span>
<span class="n">formatter</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">Formatter</span><span class="p">(</span><span class="s">'</span><span class="si">%(asctime)</span><span class="s">s - </span><span class="si">%(name)</span><span class="s">s - </span><span class="si">%(message)</span><span class="s">s'</span><span class="p">)</span>
<span class="c1"># set file handler
</span><span class="n">handler</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">FileHandler</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">log_save_dir</span><span class="p">,</span> <span class="s">'log.txt'</span><span class="p">))</span>
<span class="n">handler</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">formatter</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">handler</span><span class="p">)</span>
<span class="c1"># set stream handler
</span><span class="n">console</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">StreamHandler</span><span class="p">()</span>
<span class="n">console</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">formatter</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">console</span><span class="p">)</span>
</code></pre></div></div>
<h2 id="reference">Reference:</h2>
<p><a href="https://docs.python.org/3/library/logging.html">Official Doc</a>
<a href="https://www.jianshu.com/p/feb86c06c4f4">https://www.jianshu.com/p/feb86c06c4f4</a>
<a href="https://www.cnblogs.com/liujiacai/p/7804848.html">https://www.cnblogs.com/liujiacai/p/7804848.html</a></p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Python"]" /><category term="python" /><category term="logging" /><summary type="html">As for the need for logging from Python program, here is a memo for the use of the Python built-in module logging</summary></entry><entry><title type="html">Git Remove All Commit Clear Git History</title><link href="http://localhost:4000/2020/08/20/git-remove-all-commit-clear-git-history" rel="alternate" type="text/html" title="Git Remove All Commit Clear Git History" /><published>2020-08-20T00:00:00+08:00</published><updated>2020-08-20T00:00:00+08:00</updated><id>http://localhost:4000/2020/08/20/git-remove-all-commit-clear-git-history</id><content type="html" xml:base="http://localhost:4000/2020/08/20/git-remove-all-commit-clear-git-history"><blockquote>
<p>In this article i am showing how to clear Git history by removing all commits. You may need this if you want to delete sensitive data from the history of Git commits. After such cleanup you will have the latest version of your Git repository, but with the one commit only. Be aware that after resetting all the history of changes in your Git repository will be deleted as well.</p>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#1-create-a-temporary-branch-and-checkout" id="markdown-toc-1-create-a-temporary-branch-and-checkout">1. Create a temporary branch and checkout:</a></li>
<li><a href="#2-add-all-files-to-the-temporary-branch-and-commit-the-changes" id="markdown-toc-2-add-all-files-to-the-temporary-branch-and-commit-the-changes">2. Add all files to the temporary branch and commit the changes:</a></li>
<li><a href="#3-delete-the-master-branch" id="markdown-toc-3-delete-the-master-branch">3. Delete the master branch:</a></li>
<li><a href="#4-rename-the-temporary-branch-to-master" id="markdown-toc-4-rename-the-temporary-branch-to-master">4. Rename the temporary branch to master:</a></li>
<li><a href="#5-forcefully-update-the-remote-repository" id="markdown-toc-5-forcefully-update-the-remote-repository">5. Forcefully update the remote repository:</a></li>
<li><a href="#reference" id="markdown-toc-reference">Reference</a></li>
</ul>
<h3 id="1-create-a-temporary-branch-and-checkout">1. Create a temporary branch and checkout:</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git checkout --orphan temp_branch
</code></pre></div></div>
<h3 id="2-add-all-files-to-the-temporary-branch-and-commit-the-changes">2. Add all files to the temporary branch and commit the changes:</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git add -A
git commit -am "The first commit after purge"
</code></pre></div></div>
<h3 id="3-delete-the-master-branch">3. Delete the master branch:</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git branch -D master
</code></pre></div></div>
<h3 id="4-rename-the-temporary-branch-to-master">4. Rename the temporary branch to master:</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git branch -m master
</code></pre></div></div>
<h3 id="5-forcefully-update-the-remote-repository">5. Forcefully update the remote repository:</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git push -f origin master
</code></pre></div></div>
<h2 id="reference">Reference</h2>
<ul>
<li><a href="https://www.shellhacks.com/git-remove-all-commits-clear-git-history-local-remote/">Reference Link</a></li>
<li><a href="https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github">Reference from StackOverflow</a></li>
</ul>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Git"]" /><category term="git" /><summary type="html">In this article i am showing how to clear Git history by removing all commits. You may need this if you want to delete sensitive data from the history of Git commits. After such cleanup you will have the latest version of your Git repository, but with the one commit only. Be aware that after resetting all the history of changes in your Git repository will be deleted as well.</summary></entry><entry><title type="html">PPT Resolution Problem with 3D Format</title><link href="http://localhost:4000/2020/07/06/ppt-resolution-problem-with-3d-format" rel="alternate" type="text/html" title="PPT Resolution Problem with 3D Format" /><published>2020-07-06T00:00:00+08:00</published><updated>2020-07-06T00:00:00+08:00</updated><id>http://localhost:4000/2020/07/06/ppt-resolution-problem-with-3d-format</id><content type="html" xml:base="http://localhost:4000/2020/07/06/ppt-resolution-problem-with-3d-format"><p>PPT can normally export as PDF with very high resolution (the vectorized file). However, I encounter a weird problem today that cannot export a high resolution PDF. After “debugging” and “doing experiments”, I’ve finally found the problem. It’s because of the 3D format settings.</p>
<!--more-->
<ul id="markdown-toc">
<li><a href="#the-problem" id="markdown-toc-the-problem">The Problem:</a></li>
<li><a href="#solution" id="markdown-toc-solution">Solution:</a></li>
</ul>
<p>#To Make a long story short: Don’t use 3D formatting, if you want a vetor-quality PDF.</p>
<h2 id="the-problem">The Problem:</h2>
<p>According to the need of a recent task, I need to design and draw a figure for a proposal. I did all the procedures as normal, but in the last step. I got the problem as mentioned above, the exported PDF file was with unacceptable quality. It looks obvious that the vector objects in the PPT was rasterized before saving. But I don’t know why.</p>
<h2 id="solution">Solution:</h2>
<p>After at least one hour of various trials and analysis, I finally found that the PPT object will get rasterized when the <strong>3D format</strong> is added to it.</p>
<p>Therefore, BEWARE when you have to use 3D format to get some special designs when you using PPT, remember that it will sacrafice the vector property of the objects.</p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Design"]" /><category term="ppt" /><summary type="html">PPT can normally export as PDF with very high resolution (the vectorized file). However, I encounter a weird problem today that cannot export a high resolution PDF. After “debugging” and “doing experiments”, I’ve finally found the problem. It’s because of the 3D format settings.</summary></entry><entry><title type="html">Setup Checklist on Windows PC</title><link href="http://localhost:4000/2020/04/28/setup-checklist-on-windows-pc" rel="alternate" type="text/html" title="Setup Checklist on Windows PC" /><published>2020-04-28T00:00:00+08:00</published><updated>2020-04-28T00:00:00+08:00</updated><id>http://localhost:4000/2020/04/28/setup-checklist-on-windows-pc</id><content type="html" xml:base="http://localhost:4000/2020/04/28/setup-checklist-on-windows-pc"><blockquote>
<p>Just got a new working laptop with Windows 10. Here make a checklist of essential tools and software to be installed and configured on it.</p>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#cygwin" id="markdown-toc-cygwin">Cygwin</a></li>
<li><a href="#mobaxterm" id="markdown-toc-mobaxterm">MobaXTerm</a></li>
</ul>
<h2 id="cygwin">Cygwin</h2>
<p>Get Linux feeling on windows. Download <code class="language-plaintext highlighter-rouge">setup-x86_64.exe</code> from it’s offical website, then use the tsinghua TUNA url: <a href="https://mirrors.tuna.tsinghua.edu.cn/cygwin">https://mirrors.tuna.tsinghua.edu.cn/cygwin</a> as the download source.</p>
<h2 id="mobaxterm">MobaXTerm</h2>
<p>SSH client. It’s free, it’s good.</p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Windows"]" /><category term="windows" /><category term="checklist" /><summary type="html">Just got a new working laptop with Windows 10. Here make a checklist of essential tools and software to be installed and configured on it.</summary></entry><entry><title type="html">How to Setup a GIT server</title><link href="http://localhost:4000/2020/04/27/how-to-setup-a-git-server" rel="alternate" type="text/html" title="How to Setup a GIT server" /><published>2020-04-27T00:00:00+08:00</published><updated>2020-04-27T00:00:00+08:00</updated><id>http://localhost:4000/2020/04/27/how-to-setup-a-git-server</id><content type="html" xml:base="http://localhost:4000/2020/04/27/how-to-setup-a-git-server"><blockquote>
<p>remote git repo is actually no difference from a local one. Here’s how to setup a LOCAL git server.</p>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#1-install-git" id="markdown-toc-1-install-git">1. Install Git</a></li>
<li><a href="#2add-a-git-user" id="markdown-toc-2add-a-git-user">2.Add a “git” user</a></li>
<li><a href="#3-create-ssh-certified-login" id="markdown-toc-3-create-ssh-certified-login">3. Create SSH Certified Login</a></li>
<li><a href="#4-initialize-a-git-repo" id="markdown-toc-4-initialize-a-git-repo">4. Initialize a Git Repo</a></li>
<li><a href="#5-ban-the-shell-login-optional" id="markdown-toc-5-ban-the-shell-login-optional">5. Ban the Shell Login (Optional)</a></li>
<li><a href="#6-clone-remote-repository" id="markdown-toc-6-clone-remote-repository">6. Clone Remote Repository</a></li>
<li><a href="#7-git-remote" id="markdown-toc-7-git-remote">7. Git Remote</a> <ul>
<li><a href="#71-how-to-upload-a-local-directory-to-remote-repo" id="markdown-toc-71-how-to-upload-a-local-directory-to-remote-repo">7.1 How to upload a local directory to remote repo</a></li>
</ul>
</li>
<li><a href="#reference" id="markdown-toc-reference">Reference:</a></li>
</ul>
<h2 id="1-install-git">1. Install Git</h2>
<p>After setting up a linux system, e.g. Ubuntu server 16.06, install git:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt-get <span class="nb">install </span>git
</code></pre></div></div>
<h2 id="2add-a-git-user">2.Add a “git” user</h2>
<p>Create a git user by:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>adduser git
</code></pre></div></div>
<h2 id="3-create-ssh-certified-login">3. Create SSH Certified Login</h2>
<p>Collect all the public keys of possible users/machines (in their <code class="language-plaintext highlighter-rouge">id_rsa.pub</code> respectively). Put all the collected public keys in file <code class="language-plaintext highlighter-rouge">/home/git/.ssh/authorized_keys</code>.</p>
<ul>
<li>e.g. on a remote server, type <code class="language-plaintext highlighter-rouge">ssh-copy-id git@[you-git-server-ip-address]</code> to automatically add the current server’s public key to the <code class="language-plaintext highlighter-rouge">authorized_keys</code> of the git server.</li>
</ul>
<h2 id="4-initialize-a-git-repo">4. Initialize a Git Repo</h2>
<p>After logging in with <code class="language-plaintext highlighter-rouge">git</code>, select a folder, e.g. <code class="language-plaintext highlighter-rouge">/home/sample</code>, <code class="language-plaintext highlighter-rouge">cd</code> into this folder and type:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>git init <span class="nt">--bare</span> sample.git
</code></pre></div></div>
<p>With the command above, Git will generate a bare repository.
Since the Git repo on this server only aim for sharing, it doesn’t allow other users to login into the server and make changes. Therefore, we should set the owner:group of the repo as <code class="language-plaintext highlighter-rouge">git</code>:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo chown</span> <span class="nt">-R</span> git:git sample.git
</code></pre></div></div>
<h2 id="5-ban-the-shell-login-optional">5. Ban the Shell Login (Optional)</h2>
<p>Based on the security concern, our git account is not supposed to allow SSH login. So we can acheive this by modifying <code class="language-plaintext highlighter-rouge">/etc/passwd</code> file, in which we may find:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git:x:1001:1001:,,,:/home/git:bin/bash
</code></pre></div></div>
<p>we change this to:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
</code></pre></div></div>
<h2 id="6-clone-remote-repository">6. Clone Remote Repository</h2>
<p>Now we are able to clone remote git repo(s) on you local computer by:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone git@[you-git-server-ip]:sample/sample.git
</code></pre></div></div>
<h2 id="7-git-remote">7. Git Remote</h2>
<p>On the remote computer, just try pull/push etc. to use the remote repository.</p>
<h3 id="71-how-to-upload-a-local-directory-to-remote-repo">7.1 How to upload a local directory to remote repo</h3>
<h2 id="reference">Reference:</h2>
<p><a href="https://www.liaoxuefeng.com/wiki/896043488029600/899998870925664">» 搭建GIT服务器</a></p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="["Git"]" /><category term="git" /><category term="ubuntu" /><summary type="html">remote git repo is actually no difference from a local one. Here’s how to setup a LOCAL git server.</summary></entry><entry><title type="html">How to Use Selenium to Auto Login</title><link href="http://localhost:4000/2020/04/26/how-to-use-selenium-to-auto-login" rel="alternate" type="text/html" title="How to Use Selenium to Auto Login" /><published>2020-04-26T00:00:00+08:00</published><updated>2020-04-26T00:00:00+08:00</updated><id>http://localhost:4000/2020/04/26/how-to-use-selenium-to-auto-login</id><content type="html" xml:base="http://localhost:4000/2020/04/26/how-to-use-selenium-to-auto-login"><blockquote>
<blockquote>
<p>使用Selenium自动化操作网页,以自动登陆(办公网)系统。</p>
</blockquote>
</blockquote>
<!--more-->
<ul id="markdown-toc">
<li><a href="#1-selenium-and-chromedriver" id="markdown-toc-1-selenium-and-chromedriver">1. Selenium and ChromeDriver</a></li>
<li><a href="#2-开机自动启动" id="markdown-toc-2-开机自动启动">2. 开机自动启动</a></li>
<li><a href="#3-每12小时定时执行程序" id="markdown-toc-3-每12小时定时执行程序">3. 每12小时定时执行程序</a></li>
</ul>
<h2 id="1-selenium-and-chromedriver">1. Selenium and ChromeDriver</h2>
<p><a href="https://blog.csdn.net/qiaotong1/article/details/50541099">» selenium调用chrome</a>
selenium操作chrome浏览器需要有ChromeDriver驱动来协助。</p>
<h2 id="2-开机自动启动">2. 开机自动启动</h2>
<p>在/etc/rc.local文件中添加:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>su - <span class="o">[</span>username] <span class="nt">-c</span> <span class="o">[</span>/absolute/path/to/your/script/to/auto/run]
</code></pre></div></div>
<h2 id="3-每12小时定时执行程序">3. 每12小时定时执行程序</h2>
<p><a href="https://www.cnblogs.com/thinksasa/archive/2013/06/06/3121030.html">» linux 定时执行任务</a>
执行<code class="language-plaintext highlighter-rouge">crontab -e</code>命令,在弹出的文件中添加下面的代码:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">*</span> <span class="k">*</span>/12 <span class="k">*</span> <span class="k">*</span> <span class="k">*</span> <span class="o">[</span>/absolute/path/to/your/script/to/auto/run]
</code></pre></div></div>
<p>其中<code class="language-plaintext highlighter-rouge">*/12</code>表示每12小时执行一次。</p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="[]" /><category term="selenium" /><summary type="html">使用Selenium自动化操作网页,以自动登陆(办公网)系统。</summary></entry><entry><title type="html">Frequently used linux commands</title><link href="http://localhost:4000/2020/03/06/frequently-used-linux-commands" rel="alternate" type="text/html" title="Frequently used linux commands" /><published>2020-03-06T00:00:00+08:00</published><updated>2020-03-06T00:00:00+08:00</updated><id>http://localhost:4000/2020/03/06/frequently-used-linux-commands</id><content type="html" xml:base="http://localhost:4000/2020/03/06/frequently-used-linux-commands"><!--more-->
<ul id="markdown-toc">
<li><a href="#check-hardware-info" id="markdown-toc-check-hardware-info">Check Hardware Info:</a></li>
</ul>
<h1 id="check-hardware-info">Check Hardware Info:</h1>
<p>Check CPU:
<code class="language-plaintext highlighter-rouge">lscpu</code></p>
<p>or check the file <code class="language-plaintext highlighter-rouge">/proc/cpu</code></p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="[]" /><summary type="html"></summary></entry><entry><title type="html">How To Open A Port In CentOS 7 With Fiewalld</title><link href="http://localhost:4000/2019/12/02/how-to-open-a-port-in-centos-7-with-fiewalld" rel="alternate" type="text/html" title="How To Open A Port In CentOS 7 With Fiewalld" /><published>2019-12-02T00:00:00+08:00</published><updated>2019-12-02T00:00:00+08:00</updated><id>http://localhost:4000/2019/12/02/how-to-open-a-port-in-centos-7-with-fiewalld</id><content type="html" xml:base="http://localhost:4000/2019/12/02/how-to-open-a-port-in-centos-7-with-fiewalld"><h2 id="open-specific-port">Open Specific Port</h2>
<p>Opening a port in firewalld is fairly straightforward, in the below example we allow traffic in from any source IP address to TCP port 100. First we modify the persistent configuration, then we reload firewall-cmd to load this change into the running configuration.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[root@centos7 ~]# firewall-cmd --permanent --add-port=100/tcp
success
[root@centos7 ~]# firewall-cmd --reload
success
</code></pre></div></div>
<p>If the –permanent flag is not specified, this will only change the running configuration but will not be saved.</p>
<p>We can check the ports that are opened in the current default zone with ‘–list-ports’.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[root@centos7 ~]# firewall-cmd --list-ports
100/tcp
As expected we see that TCP port 100 is open.
Should we wish to remove a port, we can use ‘--remove-port=’ instead.
We can also open a range of ports in the same way.
[root@centos7 ~]# firewall-cmd --permanent --add-port=200-300/tcp
success
</code></pre></div></div>
<!--more-->
<ul id="markdown-toc">
<li><a href="#open-specific-port" id="markdown-toc-open-specific-port">Open Specific Port</a></li>
<li><a href="#reference" id="markdown-toc-reference">Reference</a></li>
</ul>
<h2 id="reference">Reference</h2>
<p><a href="https://www.rootusers.com/how-to-open-a-port-in-centos-7-with-firewalld/">» Check this link</a></p>
<p><br /><br /><strong><em>KF</em></strong></p></content><author><name></name></author><category term="[]" /><summary type="html">Open Specific Port Opening a port in firewalld is fairly straightforward, in the below example we allow traffic in from any source IP address to TCP port 100. First we modify the persistent configuration, then we reload firewall-cmd to load this change into the running configuration. [root@centos7 ~]# firewall-cmd --permanent --add-port=100/tcp success [root@centos7 ~]# firewall-cmd --reload success If the –permanent flag is not specified, this will only change the running configuration but will not be saved. We can check the ports that are opened in the current default zone with ‘–list-ports’. [root@centos7 ~]# firewall-cmd --list-ports 100/tcp As expected we see that TCP port 100 is open. Should we wish to remove a port, we can use ‘--remove-port=’ instead. We can also open a range of ports in the same way. [root@centos7 ~]# firewall-cmd --permanent --add-port=200-300/tcp success</summary></entry></feed>