Commit MetaInfo

修订版52d09ad4bef31ef84d20dac333a1d396815607c6 (tree)
时间2021-09-27 23:55:05
作者Erik <erikgronwal@user...>
CommiterErik

Log Message

Regular updates

更改概述

差异

--- a/cron.md
+++ b/cron.md
@@ -47,7 +47,7 @@ Min Hour Day Mon Weekday
4747 | `*/15 * * * *` | every 15 mins |
4848 | `0 */2 * * *` | every 2 hours |
4949 | `0 18 * * 0-6` | every week Mon-Sat at 6pm |
50-| `10 2 * * 6,7` | every Sat and Thu on 2:10am |
50+| `10 2 * * 6,7` | every Sat and Sun on 2:10am |
5151 | `0 0 * * 0` | every Sunday midnight |
5252 | --- | --- |
5353 | `@reboot` | every reboot |
--- a/curl.md
+++ b/curl.md
@@ -17,7 +17,8 @@ updated: 2020-03-09
1717 ```bash
1818 -v # --verbose
1919 -vv # Even more verbose
20--s # --silent
20+-s # --silent: don't show progress meter or errors
21+-S # --show-error: when used with --silent (-sS), show errors but no progress meter
2122 ```
2223
2324 ```bash
--- /dev/null
+++ b/grep.md
@@ -0,0 +1,102 @@
1+---
2+title: GNU grep
3+category: CLI
4+layout: 2017/sheet
5+updated: 2021-08-23
6+---
7+
8+### Usage
9+{: .-prime}
10+
11+```bash
12+grep <options> pattern <file...>
13+```
14+
15+### Matching options
16+
17+```bash
18+-e, --regexp=PATTERN
19+-f, --file=FILE
20+-i, --ignore-case
21+-v, --invert-match
22+-w, --word-regexp
23+-x, --line-regexp
24+```
25+
26+### Pattern options
27+
28+```bash
29+-F, --fixed-strings # list of fixed strings
30+-G, --basic-regexp # basic regular expression (default)
31+-E, --extended-regexp # extended regular expression
32+-P, --perl-regexp # perl compatible regular expression
33+```
34+
35+### Expressions
36+
37+#### Basic Regular Expressions (BRE)
38+
39+In BRE, these characters have a special meaning unless they are escaped with a backslash:
40+
41+`^ $ . * [ ] \`
42+
43+However, these characters do not have any special meaning unless they are escaped with a backslash:
44+
45+`? + { } | ( )`
46+
47+#### Extended Regular Expressions (ERE)
48+
49+ERE gives all of these characters a special meaning unless they are escaped with a backslash:
50+
51+`^ $ . * + ? [ ] ( ) | { }`
52+
53+#### Perl Compatible Regular Expressions (PCRE)
54+
55+PCRE has even more options such as additional anchors and character classes, lookahead/lookbehind, conditional expressions, comments, and more. See the [regexp cheatsheet](/regexp).
56+
57+### Output Options
58+
59+```bash
60+-c, --count # print the count of matching lines. suppresses normal output
61+ --color[=WHEN] # applies color to the matches. WHEN is never, always, or auto
62+-m, --max-count=NUM # stop reading after max count is reached
63+-o, --only-matching # only print the matched part of a line
64+-q, --quiet, --silent
65+-s, --no-messages # suppress error messages about nonexistent or unreadable files
66+```
67+
68+### Context Options
69+
70+```bash
71+-B NUM, --before-context=NUM # print NUM lines before a match
72+-A NUM, --after-context=NUM # print NUM lines after a match
73+-C NUM, -NUM, --context=NUM # print NUM lines before and after a match
74+```
75+
76+### Examples
77+
78+```bash
79+# Case insensitive: match any line in foo.txt
80+# that contains "bar"
81+grep -i bar foo.txt
82+
83+# match any line in bar.txt that contains
84+# either "foo" or "oof"
85+grep -E "foo|oof" bar.txt
86+
87+# match anything that resembles a URL in
88+# foo.txt and only print out the match
89+grep -oE "https?:\/\/((\w+[_-]?)+\.?)+" foo.txt
90+
91+# can also be used with pipes:
92+# match any line that contains "export" in
93+# .bash_profile, pipe to another grep that
94+# matches any of the first set of matches
95+# containing "PATH"
96+grep "export" .bash_profile | grep "PATH"
97+
98+# follow the tail of server.log, pipe to grep
99+# and print out any line that contains "error"
100+# and include 5 lines of context
101+tail -f server.log | grep -iC 5 error
102+```
--- /dev/null
+++ b/jinja.md
@@ -0,0 +1,101 @@
1+---
2+title: jinja
3+category: python
4+layout: 2017/sheet
5+---
6+
7+{% raw %}
8+### Basic usage
9+
10+```
11+- variable x has content: {{ x }}
12+- expression: {{ x + 1 }}
13+- escaped for HTML: {{ x | e }}
14+```
15+
16+### Control structures
17+
18+```
19+{% for x in range(5) %}
20+ {% if x % 2 == 0 %}
21+ {{ x }} is even!
22+ {% else %}
23+ {{ x }} is odd!
24+ {% endif %}
25+{% endfor %}
26+```
27+
28+### Whitespace trimming
29+
30+```
31+these are
32+{{ "three" }}
33+lines.
34+
35+this is conc
36+{{- "at" -}}
37+enated.
38+```
39+
40+### Special blocks
41+
42+```
43+{% filter e %}{% endraw %}
44+{ {%- if 0 -%}{%- endif -%} % raw %}
45+{%- raw -%}
46+ This is a raw block where {{nothing is evaluated}}
47+ {% not even this %}
48+ and <html is escaped> too with "e" filter
49+{% endraw %}
50+{ {%- if 0 -%}{%- endif -%} % endraw %}{% raw %}
51+{% endfilter %}
52+
53+{% macro myfunc(x) %}
54+ this is a reusable macro, with arguments: {{x}}
55+{% endmacro %}
56+
57+{{ myfunc(42) }}
58+
59+{#
60+this is a comment
61+#}
62+```
63+
64+
65+### Inheritance
66+
67+#### shared.html
68+
69+```
70+<html>
71+ <head>
72+ <title>{%block title %}{% endblock %}</title>
73+ </head>
74+ <body>
75+ <header><h1>{% block title %}{% endblock %}</h1></header>
76+ <main>{% block content %}{% endblock %}</main>
77+ </body>
78+</html>
79+```
80+
81+#### home.html
82+
83+```
84+{% extends "shared.html" %}
85+{% block title %}Welcome to my site{% endblock %}
86+{% block content %}
87+This is the body
88+{% endblock %}
89+```
90+
91+## Library
92+
93+### Basic usage
94+
95+```python
96+from jinja2 import Template
97+template = Template('Hello {{ name }}!')
98+template.render(name='John Doe') == u'Hello John Doe!'
99+```
100+
101+{% endraw %}
--- /dev/null
+++ b/jinja2.md
@@ -0,0 +1,5 @@
1+---
2+title: jinja
3+category: python
4+redirect_to: /jinja
5+---
--- a/jsdoc.md
+++ b/jsdoc.md
@@ -13,6 +13,8 @@ weight: -1
1313 * This is a function.
1414 *
1515 * @param {string} n - A string param
16+ * @param {string} [o] - A optional string param
17+ * @param {string} [d=DefaultValue] - A optional string param
1618 * @return {string} A good string
1719 *
1820 * @example
@@ -20,7 +22,7 @@ weight: -1
2022 * foo('hello')
2123 */
2224
23-function foo(n) {
25+function foo(n, o, d) {
2426 return n
2527 }
2628 ```
--- /dev/null
+++ b/mako.md
@@ -0,0 +1,114 @@
1+---
2+title: mako
3+category: python
4+layout: 2017/sheet
5+---
6+
7+### Basic usage
8+
9+```
10+Variable x has content: ${x}
11+Expression: ${x + 1}
12+Escaped for HTML: ${x | h}
13+```
14+
15+### Control structures
16+
17+```html
18+% for x in range(5):
19+ % if x % 2 == 0:
20+ ${x} is even!
21+ % else:
22+ ${x} is odd!
23+ % endif
24+% endfor
25+```
26+
27+### Including Python code
28+
29+```python
30+<%
31+ greeting = "Hello world!"
32+ # arbitrary python code
33+%>
34+
35+<%!
36+# arbitrary python code run at toplevel
37+# cannot access variables!
38+
39+def sign_string(number):
40+ if number > 0:
41+ return "positive"
42+ elif number < 0:
43+ return "negative"
44+ else:
45+ return "zero"
46+%>
47+```
48+
49+### Special blocks
50+
51+```html
52+<%text filter="h">
53+ This is a raw block where ${nothing is evaluated}
54+ <%
55+ not even this
56+ %>
57+ and <html is escaped> too with "h" filter
58+</%text>
59+
60+<%def name="myfunc(x)">
61+ this is a reusable macro, with arguments: ${x}
62+</%def>
63+
64+${myfunc(42)}
65+
66+<%doc>
67+ this is a comment
68+</%doc>
69+```
70+
71+### Inheritance
72+
73+#### shared.html
74+
75+```html
76+<html>
77+ <head>
78+ <title><%block name="title" /></title>
79+ </head>
80+ <body>
81+ <header><h1><%block name="title" /></h1></header>
82+ <main>${self.body()}</main>
83+ </body>
84+</html>
85+```
86+
87+#### home.html
88+
89+```html
90+<%inherit file="shared.html" />
91+<%block name="title">Welcome to my site</%block>
92+
93+This is the body
94+```
95+
96+#### article.html
97+
98+```html
99+<%inherit file="shared.html" />
100+<%block name="title">${post.title}</%block>
101+
102+${post.content}
103+```
104+
105+## Library
106+
107+### Basic usage
108+
109+```python
110+from mako.template import Template
111+
112+mytemplate = Template("hello, ${name}!")
113+print(mytemplate.render(name="jack"))
114+```
--- a/vimscript.md
+++ b/vimscript.md
@@ -140,7 +140,7 @@ function! s:Initialize(cmd, args)
140140 " a: prefix for arguments
141141 echo "Command: " . a:cmd
142142
143- return true
143+ return 1
144144 endfunction
145145 ```
146146
Show on old repository browser