1. [a-zA-Z0-9] 字母和数字保持不变
  2. “.”,”-“,”*“,”_” 保持不变
  3. “ “(space)转化 加号”+”
  4. 其它字符Character都是不安全的,需要转换表示方法,即编码。根据选定的编码方案可能转化为多个字节(byte),每个字节的表示形式为 3-character的字符串”%xy”,其中xy均为2位的16进制数,表示一个byte的value. 推荐使用的编码方式是UTF-8.如果没有明确指定编码方式,则采用OS默认的编码方案encode scheme.

URL编码(shell版本)

sed 默认的是basic regularexpression, ()要用 \转义, 或者有-E 扩展正则表达式,就不需要为小括号转义了

后台程序读取终端将进入暂停状态

需要从STDIN读取输入的程序,后台运行时出行 suspended(tty input) 状态,在后台处于暂停工作状态。

  • 演示:
    $cat cread.sh
    while read foo; do

    echo Foo is $foo

    done
    $ ./cread.sh
    this
    Foo is this
    ^C
    ~/work/shell choe@MBP⌚ 14:20:11
    $ ./cread.sh &
    [2] 2357
    [2] + 2357 suspended (tty input) ./cread.sh
    ~/work/shell choe@MBP⌚ 14:20:20
    $ fg
    [2] - 2357 continued ./cread.sh

    Foo is
    ~/work/shell choe@MBP⌚ 14:20:56

    引入 STDIN redirect 功能

    $ ./cread.sh < /dev/null &
    [2] 2368
    [2] - 2368 done ./cread.sh < /dev/null
    ~/work/shell choe@MBP⌚ 14:21:13
    $ ps -ef|grep cread

    501  2346   564   0  2:20下午 ttys005    0:00.00 sh ./cread.sh

    ssh dynamic forward 后台运行

    $ ssh -T -D 1080 root@192.168.66.100 </dev/null &
    [1] 2665
    ~/blog on  master! choe@MBP⌚ 14:33:12
    $ Last failed login: Fri Nov 24 06:33:09 UTC 2017 from 192.168.145.21 on ssh:notty
    There were 4667 failed login attempts since the last successful login.

    [1] + 2665 done ssh -T -D 1080 root@192.168.66.100 < /dev/null
    加入STDIN重定向</dev/null 后,然而ssh 自动退出了,
    ~/blog on  master! choe@MBP⌚ 14:33:16
    $ ps -ef|grep ssh

    501  1426     1   0 10:56上午 ??         0:00.05 /usr/bin/ssh-agent -l

    ~/blog on  master! choe@MBP⌚ 14:38:37
    $ ssh -TnN -D 1080 root@192.168.66.100 &
    [1] 2706
    ~/blog on  master! choe@MBP⌚ 14:38:57
    $ ps -ef|grep ssh

    501  1426     1   0 10:56上午 ??         0:00.05 /usr/bin/ssh-agent -l
    501  2706   499   0  2:38下午 ttys001    0:00.03 ssh -TnN -D 1080 root@192.168.66.100

    ~/blog on  master! choe@MBP⌚ 14:39:09

If a background process tries to read from the terminal, it will be stopped. This is normal terminal and shell behavior. Only foreground processes are allowed to control the terminal like that.

To prevent it from reading from the terminal, run it with nohup to prevent it from accessing the terminal. This will redirect stdout/stderr automatically, but NOT redirect stdin , while stdout and stderr will be saved to a file in the current directory.

man hup
NAME
nohup – invoke a utility immune to hangups

SYNOPSIS
nohup [–] utility [arguments]

DESCRIPTION
The nohup utility invokes utility with its arguments and at this time sets the signal SIGHUP to
be ignored. If the standard output is a terminal, the standard output is appended to the file
nohup.out in the current directory. If standard error is a terminal, it is directed to the same
place as the standard output.

Some shells may provide a builtin nohup command which is similar or identical to this utility. Consult the builtin(1) manual page.

$ ps -ef|grep ssh
  501  1426     1   0 10:56上午 ??         0:00.05 /usr/bin/ssh-agent -l
  501  2706   499   0  2:38下午 ttys001    0:00.08 ssh -TnN -D 1080 root@192.168.66.40
  501  2863   499   0  3:04下午 ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn ssh
~/blog on  master! choe@MBP⌚ 15:04:07
$ kill 2706
[1]  + 2706 done       ssh -TnN -D 1080 root@192.168.66.40
~/blog on  master! choe@MBP⌚ 15:04:15
$ kill 2706
kill: kill 2706 failed: no such process
~/blog on  master! choe@MBP⌚ 15:04:22
$ ps -ef|grep ssh
  501  1426     1   0 10:56上午 ??         0:00.05 /usr/bin/ssh-agent -l
  501  2893   499   0  3:04下午 ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn ssh
~/blog on  master! choe@MBP⌚ 15:04:24

nohup+ssh+& 可正常工作, 但是在随后的命令行提示后,回车下出再suspended,可推测nohup并没有重定向stdin

$ nohup ssh -T -D 1080 root@192.168.66.40 &
[1] 3101
appending output to nohup.out
~/blog on  master! choe@MBP⌚ 15:17:54
$此处回车后
[1]  + 3101 suspended (tty input)  nohup ssh -T -D 1080 root@192.168.66.40
~/blog on  master! choe@MBP⌚ 15:18:15
$
~/blog on  master! choe@MBP⌚ 15:18:16
~/blog on  master! choe@MBP⌚ 15:18:16
$ ps -ef|grep ssh
  501  1426     1   0 10:56上午 ??         0:00.05 /usr/bin/ssh-agent -l
  501  3101   499   0  3:17下午 ttys001    0:00.05 ssh -T -D 1080 root@192.168.66.40
  501  3138   499   0  3:21下午 ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn ssh

结论:

  1. 后台程序读取终端输入导致程序暂停
  2. < /dev/null可 重定向 stdin
  3. nohup app 的作用
  • 使程序忽略sighup信号
  • 仅重定向 stdout/stderr,不重定向stdin

#tar

tar 不支持in-place更新文件!
To pull your file from your archive, you can use tar xzf archive.tar.gz my/path/to/file.txt. Note that the directories in the file’s path will be created as well. Use tar t (i.e. tar tzf archive.tar.gz) to list the files in the archive.

tar does not support “in-place” updating of files. However, you can add files to the end of an archive, even if they have the same path as a file already in the archive. In that case, both copies of the file will be in the archive, and the file added later will override the earlier one. The command to use for this is tar r (or tar u to only add files that are newer than the archive) is the command to use. The . in the path should not be a problem.

There is a catch, though: you can’t add to a compressed archive. So you would have to do:

gunzip archive.tar.gz
tar rf archive.tar data/data/com.myapp.backup/./files/settings.txt
gzip archive.tar

Which is probably not what you want to hear, since it means rewriting the entire archive twice over. If it’s not a very large archive, it might be better to untar the whole thing and then re-tar it after editing. Alternately, you could use an uncompressed archive.

gzip -dc archive.tar.gz | tar -r data/data/com.myapp.backup/./files/settings.txt | gzip >archive_new.tar.gz

[TOC]

表格中打出br

Shift + Enter

html 图片自加超链接 链接图片自身

1
2
3
4
5
6
7
8
9
10
11
12
13

<a href="www.yourdomain.com" target="_blank">
<img src="/i/eg_buttonnext.gif" width="675" height="900" border="0" />
</a>
choe: 将热点文字 替换为 图片即可

# beautify
<a href="/path/imageName.png" target="_blank">
<img src="/path/imageName.png" width="675" height="900" border="0" />
</a>

# oneline version for copy
<a href="/path/imageName.png" target="_blank"><img src="/path/imageName.png" width="675" height="900" border="0" /></a>

mermaid docs

markdown绘图插件—-mermaid简介

Setext

标题1

标题2

空格,空行和Tab在Mark是分隔的作用。空格的个数也是关键的.

Atx

1

2

3

4
5
6

#换行
行末尾加个2+个空格

引用 ^>+1空格 表示引用,内部可以嵌套多个引用

段落引用1
段落引用2

段落引用嵌套
嵌套引用

无序列表 +,-, * +1Backspace

  • b
  • a
  • c
  • item1
  • item2
  • item1
  • itme2

有序列表 数字+英文名号+1Backspace

  1. item1
  2. item2
  3. item3

code

行内代码 反斜杠` (esc 下的那个键)
代码段落 靠格式缩进控制 ^4Blankspace 或 ^Tab

bash>$echo "haha"

root#ll
root#fdisk
root#df -h

强调 星号* or 下划线_

1星 = 斜体
2星 = 加粗

1_ = 斜体
2_ = 加粗

link

inline or Refrence
inline: [linkname](http_url_href “optional title”)
refrence:用于解决 多处需要引用同一个URL.
语法:调用部分[link_name][ref]
定义部分 [ref]: http://wwww.xxx.com/url 可选的标题
tip: ref中不区分大小写
inline_url
[refrence_url][my_ref]
[my_ref]: http://91kuaile.cn

picture

markdown 不支持调整 图像的位置 align,可以利用 html tag image来实现。

Markdown doesn’t allow you to tweak alignment directly (see docs here: http://daringfireball.net/projects/markdown/syntax#img), but you can just use a raw HTML ‘img’ tag and do the alignment with inline css.

Unabridged version

The Markdown syntax doesn’t provide one with the ability to control the position of an image.

In fact, it would be borderline against the Markdown philosophy to allow such formatting, as stated in the “Philosophy” section

“A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. “

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
This works just fine: <img align="..." src="..." alt="...">

<p align="center">
<img />
</p>

didn't worked to me in GitHub. <p align="center"><img src="image" /></p> nor <p style="align:center"><img src="image" /></p>


Original markdown processes markdown syntax within span tags. So some thing like the following should work:
<span style="display:block;text-align:center">![Test Automation]Automated-Testing.png)</span>


<img src="url" alt="alt text" width="whatever" height="whatever">
<a href="https://your-image-url.type"><img src="https://your-image-url.type" width="100" height="100"/></a>


<div style="text-align:center"><img src="..." /></div>

与link比较相似, 区别是中括号前加!, !不能控制图片大小(可以考虑html <img>)

Inline示例:![替代文本](/assets/images/jian.jpg “可选的title”)
Reference示例:![替代文本][pic]
[pic]: /assets/images/ship.jpg “可选的title”
HTML示例:<img src=”/assets/images/jian.jpg” alt=”替代文本” title=”标题文本” width=”200” />

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<table style="width:100%">
<tr>
<th> 1 </th>
<th>2 </th>
<th>3</th>
</tr>
<tr>
<td>
<img src="photo20190523.assets/image-20190523113956315.png" align="left" width="200"/>
</td>
<td>
<img src="photo20190523.assets/image-20190523113956315.png" align="right" width="200"/>
</td>
<td>comment</td>
</tr>
</table>

image-20190523151040567

自动链接

使用尖括号,可以为输入的URL或者邮箱自动创建链接 xcuiwm@hotmail.com http://91kuaile.cn

Asset Folders

_config.yml
post_asset_folder: true
下一行格式下:>+1Tab,不加Tab,是不行的,还加一个空行。

{% asset_path slug %}
图片显示:\{% asset_img slug [title] %}
下载连接:\{% asset_link slug [title] %}

{% asset_img example.jpg This is an example image %}
{% asset_img "spaced asset.jpg" "spaced title" %}

tips: 前面有2+空格时,导致不起作用

分隔线

3+{*,_,-}, 其中可以有空格但不能有其它字符

转义字符 \

需要转义的字符:

  • 反斜杠 \
  • 反引号 `
  • 星号 *
  • 下划线_
  • 大括号{}
  • 中括号[]
  • 小括号()
  • 标题符号#
  • 序号+
  • 序号-
  • 序号.
  • 叹号!

如何让 MarkDown 不解析某些内容?
引用:
ref1.
github语法教程
Markdown语法教程

Hexo下的Markdown语法(GFM)写博客

hello, buddy!
test only

[TOC]

jekyll vs hugo vs hexo

https://www.techiediaries.com/jekyll-hugo-hexo/

typora插件 key 解析

github部署后的相对路径 typora-copy-images-to: ffmpeg
typora软件中查看图片的根路径 typora-root-url: ../_posts

Hexo

Hexo update

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

1.全局升级hexo-cli
$hexo version
$npm install hexo-cli -g
$hexo version

2、安装npm-check, Check for outdated, incorrect, and unused dependencies.
# https://www.npmjs.com/package/npm-check
$npm install -g npm-check
$npm-check #检查系统中的插件是否有升级的

3、安装npm-upgrade, Interactive CLI utility to easily update outdated NPM dependencies with changelogs inspection support.
# https://www.npmjs.com/package/npm-upgrade
$npm install -g npm-upgrade
$npm-upgrade #升级系统中的插件

4、
$npm update -g
$npm update --save


found 475 vulnerabilities (350 low, 1 moderate, 124 high)
run `npm audit fix` to fix them, or `npm audit` for details

Refer:

https://lanvnal.com/2020/02/16/hexo-ban-ben-sheng-ji/
What is the –save option for npm install?

https://hexo.io/docs/

https://blog.peiyingchi.com/2017/03/11/hexo-user-notes/

https://zhuanlan.zhihu.com/p/26877716

https://linlif.github.io/2017/05/27/Hexo%E4%BD%BF%E7%94%A8%E6%94%BB%E7%95%A5-%E6%B7%BB%E5%8A%A0%E5%88%86%E7%B1%BB%E5%8F%8A%E6%A0%87%E7%AD%BE/

https://blog.csdn.net/Likianta/article/details/78943573

https://lanjingling.github.io/2015/09/24/use-of-hexo-2/

https://blog.csdn.net/kunkun5love/article/details/79130956

http://theme-next.iissnan.com/theme-settings.html#categories-page

Hexo常见问题解决方案

https://xuanwo.io/2014/08/14/hexo-usual-problem/

Your site _config.yml (Optional):

Your theme _config.yml (Optional):

theme-next

https://github.com/theme-next/hexo-theme-next

https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md

blog style

https://github.com/iissnan/hexo-theme-next/issues/119

https://blog.csdn.net/dataiyangu/article/details/85057957

https://www.oncecoupled.com/sidebar-show-mobile/

https://io-oi.me/tech/hexo-next-optimization.html

enable sidebar on mobile移动设备上开启侧栏

https://github.com/iissnan/hexo-theme-next/pull/1717

1
2
3
4
5
6
7
$ cd hexo
$ ls
_config.yml node_modules package.json public scaffolds source themes

~/blog/themes on  master! ⌚ 16:59:21
$ ls
landscape next next-reloaded

[yaml]~/blog/_config.yml

1
2
3
##Themes: https://hexo.io/themes/

theme: next-reloaded

Set theme in main Hexo root config _config.yml file:

1
theme: next

移动端显示 back-to-top 按钮和侧栏

文件位置:~/blog/themes/next/_config.yml

1
`# Enable sidebar on narrow viewonmobile: true`
1
2
3
4
5
6
7
8
9
10
find . -name "*config.yml" -type f
./next/_config.yml

./node_modules/hexo/node_modules/hexo-cli/assets/_config.yml
./node_modules/hexo/node_modules/hexo-cli/assets/themes/landscape/_config.yml

./_config.yml
./themes/next/_config.yml
./themes/next-reloaded/_config.yml
./themes/landscape/_config.yml

hexo images 统一的图片存放地

https://hexo.io/docs/asset-folders.html

Global Asset Folder

Assets are non-post files in the source folder, such as images, CSS or JavaScript files. For instance, If you are only going to have a few images in the Hexo project, then the easiest way is to keep them in a source/images directory. Then, you can access them using something like ![](/images/image.jpg)

插件地址

https://hexo.io/plugins/index.html

  • hexo-filter-plantuml

    Generate PlantUML Diagram with markdown code fence

  • hexo-filter-sequence

    Generate UML sequence diagrams for Hexo.

  • hexo-tag-plantuml

    hexo-tag-plantuml is a tag plugin for Hexo. It can work with plantuml to draw uml.

插件的安装

npm install -g hexo-cli

npm install hexo-deployer-git –save

npm install hexo-generator-feed

npm install hexo-generator-sitemap

npm install hexo-generator-sitemap –save

npm install hexo-generator-feed –save

npm install hexo-generator-baidu-sitemap –save

npm install hexo-browsersync –save

npm install –save-dev hexo-typora-image

1
[npm install --save hexo-filter-flowchart](https://www.npmjs.com/package/hexo-filter-flowchart)

hexo install:

$ npm install -g hexo-cli
#test

$ hexo

config your blog: https://hexo.io/docs/configuration.html
_config.yml

language: zh-CN
timezone: Asia/Shanghai
note: Asia\Shanghai cause error: TypeError: Cannot read property ‘offset’ of null
generate blog: https://hexo.io/docs/commands.html

Deployment

Hexo provides a fast and easy deployment strategy. You only need one single command to deploy your site to your servers.
$ hexo deploy
Before your first deployment, you will have to modify some settings in _config.yml. A valid deployment setting must have a type field. For example:
Git
Install hexo-deployer-git.
$ npm install hexo-deployer-git –save
Edit settings.
deploy:
type: git
repo: git@github.com:cuiwm/cuiwm.github.io.git #
branch: master
message: [message]

同时托管到github和coding
hexo干货系列:(四)将hexo博客同时托管到github和coding

image-20180801151622486

configure domain

configure your domain dns setting in your dns isp site
$ echo “91kuaile.cn” > source/CNAME
reference:

$npm install hexo-generator-feed
$npm install hexo-generator-sitemap
#插件
插件是配置是在hexo 目录下的_config.yml ,不是theme下的next下的_config.yml

Extensions

Plugins:

  • hexo-generator-feed

  • hexo-generator-sitemap

    Feed Atom

    feed:
    type: atom
    path: atom.xml
    limit: 20

    sitemap

    sitemap:
    path: sitemap.xml

Reference:

$ hexo new page “tags”
INFO Created: ~/blog/source/tags/index.md

$ hexo new draft “My First Blog Post”
creates -> ./source/_drafts/My-First-Blog-Post.md

The stuff between the dashes — at the top of the markdown file is called “front-matter”. It is metadata that is used by Hexo and the active theme. See the Hexo documentation on Front-Matter for more information.
Ensure that your Markdown content for the page sits BELOW the front-matter dashes — or the content will not display (and you’ll likely see a YAMLException error in the server output).

Saving changes to your Markdown files will be automatically detected by the running hexo server and regenerated as static HTML files, but you must refresh the browser to view the changes.

If you dislike having to manually refresh the browser each time, the hexo-livereload or hexo-browsersync plugins can do it automatically.

To install the hexo-browsersync plugin (my personal favorite):

$ npm install hexo-browsersync –save

$ hexo server –draft –open # restart the server

阅读全文 »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment