diff options
Diffstat (limited to '_notes')
-rw-r--r-- | _notes/bash.md | 66 | ||||
-rw-r--r-- | _notes/latex.md | 39 | ||||
-rw-r--r-- | _notes/markdown.md | 44 |
3 files changed, 0 insertions, 149 deletions
diff --git a/_notes/bash.md b/_notes/bash.md deleted file mode 100644 index 353f011..0000000 --- a/_notes/bash.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: GNU bash ---- -(Associative) arrays --------------------- - -### Declaration - -`"${#xs[@]}"` doesn't work with `nounset` if `xs` wasn't defined, i.e. was -declared with either of - - local -a xs - declare -a xs - local -A xs - declare -A xs - -Therefore, if you want to extract the length of an array, append `=()` to the -statements above. - - local -a xs=() - declare -a xs=() - ... - -And now `"${#xs[@]}"` works with `nounset`. -It doesn't affect expansion (see below) though. - -### Expansion - -#### Do - - func ${arr[@]+"${arr[@]}"} - -#### Don't - - func "${arr[@]}" # Doesn't work with `nounset`. - func "${arr[@]+"${arr[@]}"}" # Doesn't work properly with `declare -a arr=('')`. - -### `unset` - -#### Do - - unset -v 'arr[x]' - unset -v 'arr[$i]' - -#### Don't - - unset -v arr[x] # May break due to globbing. - unset -v arr[$i] # The same as above + a possible problem with quotation. - unset -v 'arr["x"]' # Doesn't work for some reason. - unset -v 'arr["]"]' # The same as above; just highlighting the problem with funny characters in array indices. - unset -v 'arr["$i"]' # Also rejected. - - # An insightful discussion on the topic: https://lists.gnu.org/archive/html/help-bash/2016-09/msg00020.html. - -`errexit` ---------- - -### Do - - bar_output="$( bar )" - foo "$bar_output" - -### Don't - - foo "$( bar )" # With `errexit`, foo will still get executed. - # I don't know why. diff --git a/_notes/latex.md b/_notes/latex.md deleted file mode 100644 index c131efe..0000000 --- a/_notes/latex.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Basic LaTeX document -custom_css: - - syntax.css ---- -A more-or-less complete, but still very basic LaTeX document follows. - -```tex -\documentclass[11pt]{article} - -% Basic setup -\usepackage{cmap} -\usepackage[utf8]{inputenc} -\usepackage[T2A]{fontenc} -\usepackage[russian]{babel} - -% Completely arbitrary settings follow: - -% Sans serif font by default -\renewcommand\familydefault{\sfdefault} - -% Document margins -\usepackage[margin=2.5cm]{geometry} - -% Paragraph indents -\usepackage{parskip} -\setlength\parindent{0cm} -\setlength\parskip{0cm} - -% URLs -\usepackage[colorlinks=true,urlcolor=blue]{hyperref} - -\begin{document} - -Привет, \LaTeX! -Ссылка на репозиторий: \href{https://github.com/egor-tensin/notes}{https://github.com/egor-tensin/notes}. - -\end{document} -``` diff --git a/_notes/markdown.md b/_notes/markdown.md deleted file mode 100644 index dee25f4..0000000 --- a/_notes/markdown.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Markdown style guide ---- - -* `diff`- and HTML-friendliness is valued over human-readability. -* Every sentence starts on a new line ("semantic newlines"). -* Lines are at most 79 characters long, not counting neither the carriage -return, nor the line feed characters. - * Not 80 characters, because when you display a 80-character line with a -line feed at the end in Windows' `cmd`, an extra empty line is added. -* No hanging indents in lists. - * Nested lists are indented with 4 spaces. - * No hanging indents in those also. - * Longer items wrap at 79 characters and continue from the leftmost -character column. -Additional sentences start there also. -* Prefer reference-style links over inline links. -Omit the second pair of brackets `[]` entirely where appropriate. -For example, [Google] is preferred over both [Google](https://ya.ru) and -[I'm feeeling lucky][google] (see [this document's source]). -* First- and second-level headers are underlined with strings of `=` and `-`. -The number of `=`/`-` signs must be equal to the number of characters in the -header. -* File paths are enclosed in double quotes. -Environment variable names are enclosed in a pair of backticks (\`) unless it's -a part of a path. -Executable names are enclosed in a pair of backticks (\`) unless it's a part of -a path, a link or a header. -* Code blocks are indented with 4 spaces. - - Code blocks inside lists are indented according to the spec - (https://github.github.com/gfm/#list-items), i.e. the column of the first - non-whitespace character in the item + 4. - -* Don't mix fenced code blocks with indented code blocks in a single document. - -| In a table, | the first | row | is underlined. -| ----------- | --------- | ----- | -------------- -| Leftmost | vertical | lines | are required. -| Rightmost | vertical | lines | are omitted. -{: .table .table-bordered } - -[Google]: https://www.google.com/ -[this document's source]: https://raw.githubusercontent.com/{{ site.github.repository_nwo }}/{{ site.github.source.branch }}/{{ page.path }} |