Daemon for starting jobs to queue of calculations. It was written as proof-of-concept.
-But you may change path to configuration file or change parameters. To do it just copy (recommended) the source configuration file to new path
-and edit it. Then copy the source service file to /etc
:
-
@@ -91,7 +111,9 @@ Parameters:
Configuration
All settings are stored in /etc/queued.conf
. After edit them you must restart daemon
-systemctl restart queued
+{% highlight bash %}
+systemctl restart queued
+{% endhighlight %}
diff --git a/resources/css/syntax.css b/resources/css/syntax.css
new file mode 100644
index 0000000..2774b76
--- /dev/null
+++ b/resources/css/syntax.css
@@ -0,0 +1,60 @@
+.highlight { background: #ffffff; }
+.highlight .c { color: #999988; font-style: italic } /* Comment */
+.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+.highlight .k { font-weight: bold } /* Keyword */
+.highlight .o { font-weight: bold } /* Operator */
+.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
+.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
+.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #aa0000 } /* Generic.Error */
+.highlight .gh { color: #999999 } /* Generic.Heading */
+.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
+.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
+.highlight .go { color: #888888 } /* Generic.Output */
+.highlight .gp { color: #555555 } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
+.highlight .gt { color: #aa0000 } /* Generic.Traceback */
+.highlight .kc { font-weight: bold } /* Keyword.Constant */
+.highlight .kd { font-weight: bold } /* Keyword.Declaration */
+.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
+.highlight .m { color: #009999 } /* Literal.Number */
+.highlight .s { color: #d14 } /* Literal.String */
+.highlight .na { color: #008080 } /* Name.Attribute */
+.highlight .nb { color: #0086B3 } /* Name.Builtin */
+.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
+.highlight .no { color: #008080 } /* Name.Constant */
+.highlight .ni { color: #800080 } /* Name.Entity */
+.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
+.highlight .nn { color: #555555 } /* Name.Namespace */
+.highlight .nt { color: #000080 } /* Name.Tag */
+.highlight .nv { color: #008080 } /* Name.Variable */
+.highlight .ow { font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #009999 } /* Literal.Number.Float */
+.highlight .mh { color: #009999 } /* Literal.Number.Hex */
+.highlight .mi { color: #009999 } /* Literal.Number.Integer */
+.highlight .mo { color: #009999 } /* Literal.Number.Oct */
+.highlight .sb { color: #d14 } /* Literal.String.Backtick */
+.highlight .sc { color: #d14 } /* Literal.String.Char */
+.highlight .sd { color: #d14 } /* Literal.String.Doc */
+.highlight .s2 { color: #d14 } /* Literal.String.Double */
+.highlight .se { color: #d14 } /* Literal.String.Escape */
+.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
+.highlight .si { color: #d14 } /* Literal.String.Interpol */
+.highlight .sx { color: #d14 } /* Literal.String.Other */
+.highlight .sr { color: #009926 } /* Literal.String.Regex */
+.highlight .s1 { color: #d14 } /* Literal.String.Single */
+.highlight .ss { color: #990073 } /* Literal.String.Symbol */
+.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #008080 } /* Name.Variable.Class */
+.highlight .vg { color: #008080 } /* Name.Variable.Global */
+.highlight .vi { color: #008080 } /* Name.Variable.Instance */
+.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
diff --git a/ru/_posts/.2011-01-14-about-zshrchtml b/ru/_posts/.2011-01-14-about-zshrchtml
deleted file mode 100644
index d2851fc..0000000
--- a/ru/_posts/.2011-01-14-about-zshrchtml
+++ /dev/null
@@ -1,406 +0,0 @@
----
-layout: paper
-date: 14 January 2014
-last: 14 January 2014
-tags: zshrc, configuration, linux
-title: About zshrc
-short: about-zshrc
-description: It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my .zshrc
and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (original).
-commentIssueId: 5
----
-Prepare
-
First install recommended minima:
-pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
-pkgfile is a very useful utility. Alo this command will install shell, additional completion and syntax highlighting.
-
-Shell configuration
-
All options are avaible here.
-
-Set history file and number of commands in cache of the current session and in the history file:
-# history
-HISTFILE=~/.zsh_history
-HISTSIZE=500000
-SAVEHIST=500000
-
-I can not remember all Ctrl+
combinations so I bind keys to its default usages:
-# bindkeys
-bindkey '^[[A' up-line-or-search # up arrow for back-history-search
-bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search
-bindkey '\e[1~' beginning-of-line # home
-bindkey '\e[2~' overwrite-mode # insert
-bindkey '\e[3~' delete-char # del
-bindkey '\e[4~' end-of-line # end
-bindkey '\e[5~' up-line-or-history # page-up
-bindkey '\e[6~' down-line-or-history # page-down
-But in this case Up
/Down
arrows are used to navigate through the history based on already entered part of a command. And PgUp
/PgDown
will ignore already entered part of a command.
-
-Command autocomplete:
-# autocomplete
-autoload -U compinit
-compinit
-zstyle ':completion:*' insert-tab false
-zstyle ':completion:*' max-errors 2
-Full command autocomplete will be enabled. insert-tab false
will enable autocomplete for non-entered commands. max-errors
sets maximum number of errors that could be corrected.
-
-Prompt:
-# promptinit
-autoload -U promptinit
-promptinit
-
-Enable colors:
-# colors
-autoload -U colors
-colors
-
-Here are some other options.
-Change directory without cd
:
-# autocd
-setopt autocd
-Correcting of typos (and question template):
-# correct
-setopt CORRECT_ALL
-SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
-Disable f#$%ing beep:
-# disable beeps
-unsetopt beep
-Enable calculator:
-# calc
-autoload zcalc
-Append history (do not recreate the history file):
-# append history
-setopt APPEND_HISTORY
-Do not save dups to history file:
-# ignore dups in history
-setopt HIST_IGNORE_ALL_DUPS
-...and additional spaces:
-# ignore dups in history
-setopt HIST_IGNORE_SPACE
-...and blank lines too:
-# reduce blanks in history
-setopt HIST_REDUCE_BLANKS
-Enable pkgfile
:
-# pkgfile
-source /usr/share/doc/pkgfile/command-not-found.zsh
-
-Syntax highlighting
-
# highlighting
-source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
-# brackets
-ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold'
-ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold'
-ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold'
-ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
-# cursor
-#ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue'
-# main
-# default
-ZSH_HIGHLIGHT_STYLES[default]='none'
-# unknown
-ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
-# command
-ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold'
-ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold'
-ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold'
-ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold'
-ZSH_HIGHLIGHT_STYLES[command]='fg=green'
-ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold'
-ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow'
-ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'
-ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold'
-ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold'
-# path
-ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold'
-ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan'
-# shell
-ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue'
-ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta'
-ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue'
-# quotes
-ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline'
-ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
-# pattern example
-#ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
-# root example
-#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
-In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (rm -rf *
in the example). Also root
and cursor
highlighting may be turned on. Colors syntax is understandable, fg
is font color, bg
is background color.
-
-$PROMPT and $RPROMPT
-
The general idea is the use single .zshrc
for root and normal user:
-# PROMPT && RPROMPT
-if [[ $EUID == 0 ]]; then
-# [root@host dir]#
- PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
-%{$fg_bold[red]%}%n%{$reset_color%}\
-%{$fg_bold[white]%}@%{$reset_color%}\
-%{$fg_no_bold[red]%}%m %{$reset_color%}\
-%{$fg_bold[yellow]%}%1/%{$reset_color%}\
-%{$fg_bold[white]%}]# %{$reset_color%}"
-else
-# [user@host dir]$
- PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
-%{$fg_bold[green]%}%n%{$reset_color%}\
-%{$fg_bold[white]%}@%{$reset_color%}\
-%{$fg_no_bold[green]%}%m %{$reset_color%}\
-%{$fg_bold[yellow]%}%1/%{$reset_color%}\
-%{$fg_bold[white]%}]$ %{$reset_color%}"
-fi
-
-fg
is font color, bg
is background color. \_bold
and \_no_bold
regulate the tint. Commands should be in %{ ... %}
so they do not appear. Avaible colors are:
-black
-red
-green
-yellow
-blue
-magenta
-cyan
-white
-
-Avaible variables are:
-%n - the username
-%m - the computer's hostname (truncated to the first period)
-%M - the computer's hostname
-%l - the current tty
-%? - the return code of the last-run application.
-%# - the prompt based on user privileges (# for root and % for the rest)
-%T - system time(HH:MM)
-%* - system time(HH:MM:SS)
-%D - system date(YY-MM-DD)
-%d - the current working directory
-%~ - the same as %d but if in $HOME, this will be replaced by ~
-%1/ - the same as %d but only last directory
-
-RPROMPT (acpi
package is necessary):
-precmd () {
- # battery charge
- function batcharge {
- bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
- if [[ $bat_perc < 15 ]]; then
- col="%{$fg_bold[red]%}"
- elif [[ $bat_perc < 50 ]]; then
- col="%{$fg_bold[yellow]%}"
- else
- col="%{$fg_bold[green]%}"
- fi
- echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
- }
- # last command
- returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
- RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
-%{$fg_bold[cyan]%}%T%{$reset_color%}\
-%{$fg_bold[white]%}] %{$reset_color%}"\
-$(batcharge)\
-"%{$fg_bold[white]%}[%{$reset_color%}"\
-$returncode\
-"%{$fg_bold[white]%}]%{$reset_color%}"
-My RPROMPT shows current time, battery change and last returned code. precmd()
is necessary for automatic updating. The construct $(if.true.false)
is conditional statement in zsh
.
-
-Aliases
-
Copy only those aliases that you need. If any alias uses application that is not installed it will leads to fail of loading of configuration file.
-
-Small useful (or maybe not) function:
-show_which() {
- OUTPUT=$(which $1 | cut -d " " -f7-)
- echo "Running '$OUTPUT'" 1>&2
-}
-
-Here is the first group of aliases:
-## alias
-# colored grep
-alias grep='grep --colour=auto'
-# change top to htop
-alias top='show_which top && htop'
-# chromium with different proxy servers (i2p and tor included)
-alias chrommsu='show_which chrommsu && chromium --proxy-server=cache.msu:3128'
-alias chromtor='show_which chromtor && chromium --proxy-server="socks://localhost:9050" --incognito'
-alias chromi2p='show_which chromi2p && chromium --proxy-server="http=127.0.0.1:4444;https=127.0.0.1:4445" --incognito'
-# human-readable df and du
-alias df='show_which df && df -k --print-type --human-readable'
-alias du='show_which du && du -k --total --human-readable'
-# change less and zless to vimpager
-alias less='vimpager'
-alias zless='vimpager'
-# more interactive rm
-alias rm='show_which rm && rm -I'
-
-Here are ls aliases (see man ls):
-alias ls='show_which ls && ls --color=auto'
-alias ll='show_which ll && ls --group-directories-first -l --human-readable'
-alias lr='show_which lr && ls --recursive'
-alias la='show_which la && ll --almost-all'
-alias lx='show_which lx && ll -X --ignore-backups'
-alias lz='show_which lz && ll -S --reverse'
-alias lt='show_which lt && ll -t --reverse'
-alias lm='show_which lm && la | more'
-
-Here are aliases to quick file view from console (just type a file name!):
-# alias -s
-alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv
-alias -s {mp3,flac}=qmmp
-alias -s {odt,doc,xls,ppt,docx,xlsx,pptx,csv}=libreoffice
-alias -s {pdf}=okular
-autoload -U pick-web-browser
-alias -s {html,htm}=opera
-
-Here are "sudo" aliases:
-# sudo alias
-if [[ $EUID == 0 ]]; then
- alias fat32mnt='show_which fat32mnt && mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
- alias synctime='show_which synctime && { ntpd -qg; hwclock -w; date; }'
-else
- alias fat32mnt='show_which fat32mnt && sudo mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
- alias umount='show_which umount && sudo umount'
- alias mount='show_which mount && sudo mount'
- alias netctl='show_which netctl && sudo netctl'
- alias synctime='show_which synctime && { sudo ntpd -qg; sudo hwclock -w; date; }'
- alias wifi-menu='show_which wifi-menu && sudo wifi-menu'
- alias dhcpcd='show_which dhcpcd && sudo dhcpcd'
- alias journalctl='show_which journalctl && sudo journalctl'
- alias systemctl='show_which systemctl && sudo systemctl'
- alias modprobe='show_which modprobe && sudo modprobe'
- alias rmmod='show_which rmmod && sudo rmmod'
- alias staging-i686-build='show_which staging-i686-build && sudo staging-i686-build'
- alias staging-x86_64-build='show_which staging-x86_64-build && sudo staging-x86_64-build'
-fi
-
-Here are global aliases. If they are enable the command cat foo g bar
will be equivalent the command cat foo | grep bar
:
-# global alias
-alias -g g="| grep"
-alias -g l="| less"
-alias -g t="| tail"
-alias -g h="| head"
-alias -g dn="&> /dev/null &"
-
-Functions
-
Here is a special function for xrandr
:
-
-# function to contorl xrandr
-# EXAMPLE: projctl 1024x768
-projctl () {
- if [ $1 ] ; then
- if [ $1 = "-h" ]; then
- echo "Usage: projctl [ off/resolution ]"
- return
- fi
- if [ $1 = "off" ]; then
- echo "Disable VGA1"
- xrandr --output VGA1 --off --output LVDS1 --mode 1366x768
- else
- echo "Using resolution: $1"
- xrandr --output VGA1 --mode $1 --output LVDS1 --mode $1
- fi
- else
- echo "Using default resolution"
- xrandr --output VGA1 --mode 1366x768 --output LVDS1 --mode 1366x768
- fi
-}
-
-Unfortunately I can not remember tar
flags thus I use special functions:
-# function to extract archives
-# EXAMPLE: unpack file
-unpack () {
- if [[ -f $1 ]]; then
- case $1 in
- *.tar.bz2) tar xjfv $1 ;;
- *.tar.gz) tar xzfv $1 ;;
- *.tar.xz) tar xvJf $1 ;;
- *.bz2) bunzip2 $1 ;;
- *.gz) gunzip $1 ;;
- *.rar) unrar x $1 ;;
- *.tar) tar xf $1 ;;
- *.tbz) tar xjvf $1 ;;
- *.tbz2) tar xjf $1 ;;
- *.tgz) tar xzf $1 ;;
- *.zip) unzip $1 ;;
- *.Z) uncompress $1 ;;
- *.7z) 7z x $1 ;;
- *) echo "I don't know how to extract '$1'" ;;
- esac
- else
- case $1 in
- *help) echo "Usage: unpack ARCHIVE_NAME" ;;
- *) echo "'$1' is not a valid file" ;;
- esac
- fi
-}
-# function to create archives
-# EXAMPLE: pack tar file
-pack () {
- if [ $1 ]; then
- case $1 in
- tar.bz2) tar -cjvf $2.tar.bz2 $2 ;;
- tar.gz) tar -czvf $2.tar.bz2 $2 ;;
- tar.xz) tar -cf - $2 | xz -9 -c - > $2.tar.xz ;;
- bz2) bzip $2 ;;
- gz) gzip -c -9 -n $2 > $2.gz ;;
- tar) tar cpvf $2.tar $2 ;;
- tbz) tar cjvf $2.tar.bz2 $2 ;;
- tgz) tar czvf $2.tar.gz $2 ;;
- zip) zip -r $2.zip $2 ;;
- 7z) 7z a $2.7z $2 ;;
- *help) echo "Usage: pack TYPE FILES" ;;
- *) echo "'$1' cannot be packed via pack()" ;;
- esac
- else
- echo "'$1' is not a valid file"
- fi
-}
-
-Here is a special function for su
:
-su () {
- checksu=0
- for flags in $*; do
- if [[ $flags == "-" ]]; then
- checksu=1
- fi
- done
- if [[ $checksu == 0 ]]; then
- echo "Use 'su -', Luke"
- /usr/bin/su - $*
- else
- /usr/bin/su $*
- fi
-}
-
-Functions with automatic rehash after installing/removing packages are:
-pacman () {
- /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
-}
-yaourt () {
- /usr/bin/yaourt $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
-}
-# for testing repo
-yatest () {
- /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
-}
-But autocomplete for yaourt -Ss
will require root privileges.
-
-Variables
-
It is recommended to set own variables in ~/.zshenv
. But I have everything stored in the single file.
-
-Here are path, mask of new files, editor and pager:
-# path
-export PATH="$PATH:$HOME/.local/bin"
-# umask
-umask 022
-# editor
-export EDITOR="vim"
-export PAGER="vimpager"
-
-Here is hashes. If they are enable the command ~global
will be equivalent the command /mnt/global
:
-# hash
-hash -d global=/mnt/global
-hash -d windows=/mnt/windows
-hash -d iso=/mnt/iso
-hash -d u1=/mnt/usbdev1
-hash -d u2=/mnt/usbdev2
-
-Screenshot
-

-
-File
-
Here is my .zshrc
.
diff --git a/ru/_posts/2014-01-14-about-zshrc.html b/ru/_posts/2014-01-14-about-zshrc.html
index e79d5a6..05aca8f 100644
--- a/ru/_posts/2014-01-14-about-zshrc.html
+++ b/ru/_posts/2014-01-14-about-zshrc.html
@@ -11,20 +11,25 @@ commentIssueId: 5
---
Подготовка
Сначала установите необходимый минимум:
-pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
+{% highlight bash %}
+pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
+{% endhighlight %}
pkgfile очень полезная утилита. Данная команда также установит шелл, дополнения к нему и подсветку синтаксиса.
Настройка шелла
Все доступные опции приведены здесь.
Указываем файл с историей, число команд хранящихся в кэше текущего сеанса и число команд, хранящихся в файле:
-# history
+{% highlight bash %}
+# history
HISTFILE=~/.zsh_history
HISTSIZE=500000
-SAVEHIST=500000
+SAVEHIST=500000
+{% endhighlight %}
Я не могу запомнить все комбинации Ctrl+
, поэтому я назначаю клавиши на их стандартное использование:
-# bindkeys
+{% highlight bash %}
+# bindkeys
bindkey '^[[A' up-line-or-search # up arrow for back-history-search
bindkey '^[[B' down-line-or-search # down arrow for fwd-history-search
bindkey '\e[1~' beginning-of-line # home
@@ -32,59 +37,85 @@ bindkey '\e[2~' overwrite-mode # insert
bindkey '\e[3~' delete-char # del
bindkey '\e[4~' end-of-line # end
bindkey '\e[5~' up-line-or-history # page-up
-bindkey '\e[6~' down-line-or-history # page-down
+bindkey '\e[6~' down-line-or-history # page-down
+{% endhighlight %}
Но здесь важно, что стрелки вверх
/вниз
служат для навигации по истории с учетом уже введенной части команды. А PgUp
/PgDown
проигнорирую уже введенную часть команды.
Автодополнение команд:
-# autocomplete
+{% highlight bash %}
+# autocomplete
autoload -U compinit
compinit
zstyle ':completion:*' insert-tab false
-zstyle ':completion:*' max-errors 2
+zstyle ':completion:*' max-errors 2
+{% endhighlight %}
Подключается полное автодополнение команд. insert-tab false
включит автодополнение для невведенной команды (не знаю, зачем). max-errors
устанавливает максимальное число опечаток, которые могут быть исправлены.
Приглашение:
-# promptinit
+{% highlight bash %}
+# promptinit
autoload -U promptinit
-promptinit
+promptinit
+{% endhighlight %}
Включим цвета:
-# colors
+{% highlight bash %}
+# colors
autoload -U colors
-colors
+colors
+{% endhighlight %}
Различные опции.
Смена директории без ввода cd
:
-# autocd
-setopt autocd
+{% highlight bash %}
+# autocd
+setopt autocd
+{% endhighlight %}
Корректировка опечаток (и шаблон вопроса):
-# correct
+{% highlight bash %}
+# correct
setopt CORRECT_ALL
-SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
+SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
+{% endhighlight %}
Отключаем е#$%ую пищалку:
-# disable beeps
-unsetopt beep
+{% highlight bash %}
+# disable beeps
+unsetopt beep
+{% endhighlight %}
Включаем калькулятор:
-# calc
-autoload zcalc
+{% highlight bash %}
+# calc
+autoload zcalc
+{% endhighlight %}
Дополнение истории (а не перезапись файла):
-# append history
-setopt APPEND_HISTORY
+{% highlight bash %}
+# append history
+setopt APPEND_HISTORY
+{% endhighlight %}
Не сохранять дубликаты в историю:
-# ignore dups in history
-setopt HIST_IGNORE_ALL_DUPS
+{% highlight bash %}
+# ignore dups in history
+setopt HIST_IGNORE_ALL_DUPS
+{% endhighlight %}
...и дополнительные пробелы:
-# ignore spaces in history
-setopt HIST_IGNORE_SPACE
+{% highlight bash %}
+# ignore spaces in history
+setopt HIST_IGNORE_SPACE
+{% endhighlight %}
...и пустые линии тоже:
-# reduce blanks in history
-setopt HIST_REDUCE_BLANKS
+{% highlight bash %}
+# reduce blanks in history
+setopt HIST_REDUCE_BLANKS
+{% endhighlight %}
Включаем pkgfile
:
-# pkgfile
-source /usr/share/doc/pkgfile/command-not-found.zsh
+{% highlight bash %}
+# pkgfile
+source /usr/share/doc/pkgfile/command-not-found.zsh
+{% endhighlight %}
Подсветка синтаксиса
-# highlighting
+{% highlight bash %}
+# highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
# brackets
@@ -127,12 +158,14 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' # конс
# pattern
#ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
# root
-#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
+#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
+{% endhighlight %}
В первой строке включаем подсветку. Затем включаем основную подсветку, а также подсветку скобок и шаблонов. Шаблоны указываются ниже (rm -rf *
в примере). Также может быть включена подсветка команд от root
и курсора cursor
. Синтаксис настроек понятен, fg
цвет шрифта, bg
цвет фона.
$PROMPT и $RPROMPT
Я хочу использовать один файл .zshrc
для рута и обычного пользователя:
-# PROMPT && RPROMPT
+{% highlight bash %}
+# PROMPT && RPROMPT
if [[ $EUID == 0 ]]; then
# [root@host dir]#
PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
@@ -149,20 +182,24 @@ else
%{$fg_no_bold[green]%}%m %{$reset_color%}\
%{$fg_bold[yellow]%}%1/%{$reset_color%}\
%{$fg_bold[white]%}]$ %{$reset_color%}"
-fi
+fi
+{% endhighlight %}
fg
цвет шрифта, bg
цвет фона. _bold
и _no_bold
регулируют оттенок. Команды должны быть обрамлены в %{ ... %}
, чтобы не показывались. Доступные цвета:
-black
+{% highlight bash %}
+black
red
green
yellow
blue
magenta
cyan
-white
+white
+{% endhighlight %}
Доступные переменные:
-%n - имя пользователя
+{% highlight bash %}
+%n - имя пользователя
%m - хостнейм (выставляется только в начале сессии)
%M - хостнейм
%l - текущая tty
@@ -173,10 +210,12 @@ white
%D - дата (YY-MM-DD)
%d - текущая директория
%~ - то же, домашняя директория будет заменена на ~
-%1/ - то же, но только последняя директория
+%1/ - то же, но только последняя директория
+{% endhighlight %}
RPROMPT (необходим пакет acpi
):
-precmd () {
+{% highlight bash %}
+precmd () {
# battery charge
function batcharge {
bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
@@ -197,20 +236,24 @@ white
$(batcharge)\
"%{$fg_bold[white]%}[%{$reset_color%}"\
$returncode\
-"%{$fg_bold[white]%}]%{$reset_color%}"
+"%{$fg_bold[white]%}]%{$reset_color%}"
+{% endhighlight %}
Мой RPROMPT показывает текущее время, заряд батареи и код возврата последнего приложения. precmd()
необходимо для автоматического обновления. Конструкция $(if.true.false)
является условным оператором в zsh
.
Аллиасы
Копируйте только те аллиасы, которые Вам необходимы. Если какой-либо аллиас использует приложение, которое не установлено, это приведет к сбою загрузки конфигурационного файла.
Полезная (или не очень) функция:
-show_which() {
+{% highlight bash %}
+show_which() {
OUTPUT=$(which $1 | cut -d " " -f7-)
echo "Running '$OUTPUT'" 1>&2
-}
+}
+{% endhighlight %}
Первая группа аллиасов:
-## alias
+{% highlight bash %}
+## alias
# цветной grep
alias grep='grep --colour=auto'
# замена top на htop
@@ -226,29 +269,35 @@ alias du='show_which du && du -k --total --human-readable'
alias less='vimpager'
alias zless='vimpager'
# более интерактивный rm
-alias rm='show_which rm && rm -I'
+alias rm='show_which rm && rm -I'
+{% endhighlight %}
ls аллиасы (смотри man ls):
-alias ls='show_which ls && ls --color=auto'
+{% highlight bash %}
+alias ls='show_which ls && ls --color=auto'
alias ll='show_which ll && ls --group-directories-first -l --human-readable'
alias lr='show_which lr && ls --recursive'
alias la='show_which la && ll --almost-all'
alias lx='show_which lx && ll -X --ignore-backups'
alias lz='show_which lz && ll -S --reverse'
alias lt='show_which lt && ll -t --reverse'
-alias lm='show_which lm && la | more'
+alias lm='show_which lm && la | more'
+{% endhighlight %}
Аллиасы для быстрого просмотра файлов из консоли (просто набери имя файла!):
-# alias -s
+{% highlight bash %}
+# alias -s
alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv
alias -s {mp3,flac}=qmmp
alias -s {odt,doc,xls,ppt,docx,xlsx,pptx,csv}=libreoffice
alias -s {pdf}=okular
autoload -U pick-web-browser
-alias -s {html,htm}=opera
+alias -s {html,htm}=opera
+{% endhighlight %}
"sudo" аллиасы:
-# sudo alias
+{% highlight bash %}
+# sudo alias
if [[ $EUID == 0 ]]; then
alias fat32mnt='show_which fat32mnt && mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
alias synctime='show_which synctime && { ntpd -qg; hwclock -w; date; }'
@@ -266,20 +315,24 @@ else
alias rmmod='show_which rmmod && sudo rmmod'
alias staging-i686-build='show_which staging-i686-build && sudo staging-i686-build'
alias staging-x86_64-build='show_which staging-x86_64-build && sudo staging-x86_64-build'
-fi
+fi
+{% endhighlight %}
Некоторые глобальные аллиасы. Если они включены, команда cat foo g bar
будет эквивалентна cat foo | grep bar
:
-# global alias
+{% highlight bash %}
+# global alias
alias -g g="| grep"
alias -g l="| less"
alias -g t="| tail"
alias -g h="| head"
-alias -g dn="&> /dev/null &"
+alias -g dn="&> /dev/null &"
+{% endhighlight %}
Функции
Специальная функция для xrandr
:
-# function to contorl xrandr
+{% highlight bash %}
+# function to contorl xrandr
# EXAMPLE: projctl 1024x768
projctl () {
if [ $1 ] ; then
@@ -298,10 +351,12 @@ projctl () {
echo "Using default resolution"
xrandr --output VGA1 --mode 1366x768 --output LVDS1 --mode 1366x768
fi
-}
+}
+{% endhighlight %}
К сожалению, я не могу запомнить флаги tar
, поэтому я использую специальные функции:
-# function to extract archives
+{% highlight bash %}
+# function to extract archives
# EXAMPLE: unpack file
unpack () {
if [[ -f $1 ]]; then
@@ -349,10 +404,12 @@ pack () {
else
echo "'$1' is not a valid file"
fi
-}
+}
+{% endhighlight %}
Специальная функция для su
:
-su () {
+{% highlight bash %}
+su () {
checksu=0
for flags in $*; do
if [[ $flags == "-" ]]; then
@@ -365,10 +422,12 @@ pack () {
else
/usr/bin/su $*
fi
-}
+}
+{% endhighlight %}
Функция для автоматических обновлений путей после установки пакето:
-pacman () {
+{% highlight bash %}
+pacman () {
/usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash
}
yaourt () {
@@ -377,28 +436,33 @@ yaourt () {
# for testing repo
yatest () {
/usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash
-}
+}
+{% endhighlight %}
Но автодополнение для yaourt -Ss
будет требовать привилегий рута.
Переменные
Рекомендуется хранить свои переменные в ~/.zshenv
. Но я все храню в одном файле.
Пути, маска создаваемых файлов, редактор и пейджер:
-# path
+{% highlight bash %}
+# path
export PATH="$PATH:$HOME/.local/bin"
# umask
umask 022
# editor
export EDITOR="vim"
-export PAGER="vimpager"
+export PAGER="vimpager"
+{% endhighlight %}
Хэши. Если они включены, команда ~global
будет эквивалентна команде /mnt/global
:
-# hash
+{% highlight bash %}
+# hash
hash -d global=/mnt/global
hash -d windows=/mnt/windows
hash -d iso=/mnt/iso
hash -d u1=/mnt/usbdev1
-hash -d u2=/mnt/usbdev2
+hash -d u2=/mnt/usbdev2
+{% endhighlight %}
Скриншот

diff --git a/ru/about.html b/ru/about.html
index 81d04c3..4518823 100644
--- a/ru/about.html
+++ b/ru/about.html
@@ -36,7 +36,9 @@ The Trusted User (TU) is a member of the community charged with keeping the AUR
© ArchWiki
Вся контактная информация может быть найдена слева. Не стесняйтесь связываться со мной по любому вопросу (если что - пошлю). Ах да, чуть не забыл. Если Вы будете писать мне через ICQ или Jabber, Вы должны корректно ответить на вопрос антиспам бота. Вопрос:
-int i = 1;
+{% highlight c %}
+int i = 1;
i = ++i + ++i;
-return i;
+return i;
+{% endhighlight %}
Правильный ответ 5
(или 6
, как больше нравится).
diff --git a/ru/authors.html b/ru/authors.html
index 9041a70..f10fdf1 100644
--- a/ru/authors.html
+++ b/ru/authors.html
@@ -15,25 +15,20 @@ title: Авторы
Код и контент данного сайта лицензирован под Beerware:
"THE BEER-WARE LICENSE" (Revision 42):
-Evgeniy Alekseev wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return
+Evgeniy Alekseev wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.
(Ну, в общем, там про пиво говорится. Запомните, Вы должны мне пиво.)
-Исходная тема была создана Steve Smith и лицензирована под Creative Commons Attribution-ShareAlike 3.0 Unported License.
-
-Блок комментариев был создан Ivan Žužak и лицензирован под MIT License.
-
-Код для спойлеров был предложен markeley, и, судя по всему, он не имеет никакой лицензии.
-
-Данный сайт использует:
-
- - Jekyll, который лицензирован под MIT License
-
-
-Google Custom Search имеет собственную лицензию.
-
-Sharethis тоже имеет собственную лицензию.
-
-Liberation font лицензирован под The SIL Open Font License.
+This site uses:
+
+
Отдельное спасибо Monztruo, я позаимствовал у него иконку.
diff --git a/ru/projects/git-etc.html b/ru/projects/git-etc.html
index 12e9466..8c36286 100644
--- a/ru/projects/git-etc.html
+++ b/ru/projects/git-etc.html
@@ -15,7 +15,8 @@ links:
Информация
Простой демон, который создает git репозиторий в указанной директории и создает коммит в указанный промежуток времени.
-$ git-etc --help
+{% highlight bash %}
+$ git-etc --help
Simple daemon written on BASH for monitoring changes in files
Usage: git-etc [ -c | --config /etc/git-etc.conf ] [ -h | --help ] [ -v | --version ]
@@ -25,8 +26,10 @@ Parametrs:
-h --help - show this help and exit
-v --version - show version and exit
-See "man 1 git-etc" for more details
-$ ctrlconf --help
+See "man 1 git-etc" for more details
+{% endhighlight %}
+{% highlight bash %}
+$ ctrlconf --help
GUI for git-etc daemon
Usage: ctrlconf [ --default ] [ -h | --help ] [ -v | --version ]
@@ -36,7 +39,8 @@ Additional parametrs:
-h --help - show this help and exit
-v --version - show version and exit
-See "man 1 ctrlconf" for more details
+See "man 1 ctrlconf" for more details
+{% endhighlight %}
Разработчики
@@ -58,9 +62,13 @@ See "man 1 ctrlconf" for more details
Скачайте архив с актуальной версией исходных файлов.
Извлеките из него файлы и установите приложение:
-./install.sh "/путь/к/корню/"
+{% highlight bash %}
+./install.sh "/путь/к/корню/"
+{% endhighlight %}
Если Вы хотите установить в /
, Вы должны запустить это, как root:
-sudo ./install.sh
+{% highlight bash %}
+sudo ./install.sh
+{% endhighlight %}
Если путь не указан, пакет будет установлен в /
.
@@ -79,23 +87,37 @@ See "man 1 ctrlconf" for more details
Использование
Если Вы хотите запустить демон в /etc
, просто запустите
-
systemctl start git-etc
+{% highlight bash %}
+systemctl start git-etc
+{% endhighlight %}
Если Вы хотите включить автозагрузку демона, запутите
-systemctl enable git-etc
+{% highlight bash %}
+systemctl enable git-etc
+{% endhighlight %}
Но Вы можете изменить путь к конфигурационному файлу или изменить параметры. Для этого, скопируйте (рекомендуется) исходный конфигурационный файл
-cp /etc/git-etc.conf /новый/путь/к/git-etc.conf
+{% highlight bash %}
+cp /etc/git-etc.conf /новый/путь/к/git-etc.conf
+{% endhighlight %}
и отредактируйте его. Затем скопируйте исходный service-файл в /etc
:
-cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service
+{% highlight bash %}
+cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service
+{% endhighlight %}
Замените следующую строку в этом файле:
-ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf
+{% highlight bash %}
+ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf
+{% endhighlight %}
на
-ExecStart=/usr/bin/git-etc -c /новый/путь/к/git-etc.conf
+{% highlight bash %}
+ExecStart=/usr/bin/git-etc -c /новый/путь/к/git-etc.conf
+{% endhighlight %}
Настройка
Все настройки хранятся в /etc/git-etc.conf
. После редактирования, Вы должны перезапустить демон
-systemctl restart git-etc
+{% highlight bash %}
+systemctl restart git-etc
+{% endhighlight %}
Options
diff --git a/ru/projects/oblikuestrategies.html b/ru/projects/oblikuestrategies.html
index 1916c38..c8ad6be 100644
--- a/ru/projects/oblikuestrategies.html
+++ b/ru/projects/oblikuestrategies.html
@@ -37,21 +37,29 @@ links:
Скачайте архив с актуальной версией исходных файлов.
Извлеките из него файлы и установите приложение. Для глобальной установки наберите:
-cd /путь/куда/распакован/архив
+{% highlight bash %}
+cd /путь/куда/распакован/архив
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
-sudo make install
+sudo make install
+{% endhighlight %}
Для локальной:
-cd /where/your/applet/is/installed
+{% highlight bash %}
+cd /where/your/applet/is/installed
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` -DCMAKE_BUILD_TYPE=Release ../
make
-make install
+make install
+{% endhighlight %}
Перезапустите plasma, чтобы загрузить апплет:
-kquitapp plasma-desktop && sleep 2 && plasma-desktop
+{% highlight bash %}
+kquitapp plasma-desktop && sleep 2 && plasma-desktop
+{% endhighlight %}
Также Вам может потребоваться запустить kbuildsycoca4
, чтобы распознать *.desktop
файл:
-kbuildsycoca4 &> /dev/null
+{% highlight bash %}
+kbuildsycoca4 &> /dev/null
+{% endhighlight %}
Зависимости
diff --git a/ru/projects/pytextmonitor.html b/ru/projects/pytextmonitor.html
index 2f9271f..99ccd33 100644
--- a/ru/projects/pytextmonitor.html
+++ b/ru/projects/pytextmonitor.html
@@ -38,21 +38,29 @@ links:
Скачайте архив с актуальной версией исходных файлов.
Извлеките из него файлы и установите DataEngine:
-cd /путь/к/извлеченным/файлам/
+{% highlight bash %}
+cd /путь/к/извлеченным/файлам/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` -DCMAKE_BUILD_TYPE=Release ../
make
-make install
+make install
+{% endhighlight %}
Для глобальной установки наберите:
-cd /путь/к/извлеченным/файлам/
+{% highlight bash %}
+cd /путь/к/извлеченным/файлам/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
-sudo make install
+sudo make install
+{% endhighlight %}
Установите плазмоид:
-plasmapkg -i py-text-monitor-1.5.0.plasmoid
+{% highlight bash %}
+plasmapkg -i py-text-monitor-1.5.0.plasmoid
+{% endhighlight %}
Для глобальной установки наберите:
-sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid
+{% highlight bash %}
+sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid
+{% endhighlight %}
Зависимости
diff --git a/ru/projects/queued.html b/ru/projects/queued.html
index 71b3c05..7473395 100644
--- a/ru/projects/queued.html
+++ b/ru/projects/queued.html
@@ -14,7 +14,8 @@ links:
Информация
Демон для запуска задач в очередь вычислений. Был создан, как proof-of-concept.
-$ queued --help
+{% highlight bash %}
+$ queued --help
Simple daemon written on BASH for starting jobs to queue of calculations
Usage: queued [ -c /etc/queued.conf ] [ -v | --version ] [ -h | --help ]
@@ -22,15 +23,18 @@ Parametrs:
-c PATH - path to configuration file. Default is '/etc/queued.conf'
-v --version - show version and exit
- -h --help - show this help and exit
-$ add_queued --help
+ -h --help - show this help and exit
+{% endhighlight %}
+{% highlight bash %}
+$ add_queued --help
add_queued [ -c /etc/queued.conf ] [ -p NUM ] [ -u USER ] [ -h | --help ] /path/to/script
Parameters:
-c PATH - path to configuration file. Default is '/etc/queued.conf'
-p NUM - job priority
-u USER - username
- -h --help - show this help and exit
+ -h --help - show this help and exit
+{% endhighlight %}
Разработчики
@@ -52,9 +56,13 @@ Parameters:
Скачайте архив с актуальной версией исходных файлов.
Извлеките из него файлы и установите приложение:
-./install.sh "/путь/к/корню/"
+{% highlight bash %}
+./install.sh "/путь/к/корню/"
+{% endhighlight %}
Если Вы хотите установить в /
, Вы должны запустить это, как root:
-sudo ./install.sh
+{% highlight bash %}
+sudo ./install.sh
+{% endhighlight %}
Если путь не указан, пакет будет установлен в /
.
@@ -69,17 +77,29 @@ Parameters:
Использование
Если Вы хотите запустить демон, просто запустите
-
systemctl start queued
+{% highlight bash %}
+systemctl start queued
+{% endhighlight %}
Если Вы хотите включить автозагрузку демона, запутите
-systemctl enable queued
+{% highlight bash %}
+systemctl enable queued
+{% endhighlight %}
Но Вы можете изменить путь к конфигурационному файлу или изменить параметры. Для этого, скопируйте (рекомендуется) исходный конфигурационный файл
-cp /etc/queued.conf /новый/путь/к/queued.conf
+{% highlight bash %}
+cp /etc/queued.conf /новый/путь/к/queued.conf
+{% endhighlight %}
и отредактируйте его. Затем скопируйте исходный service-файл в /etc
:
-cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service
+{% highlight bash %}
+cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service
+{% endhighlight %}
Замените следующую строку в этом файле:
-ExecStart=/usr/bin/queued
+{% highlight bash %}
+ExecStart=/usr/bin/queued
+{% endhighlight %}
на
-ExecStart=/usr/bin/queued -c /path/to/new/queued.conf
+{% highlight bash %}
+ExecStart=/usr/bin/queued -c /path/to/new/queued.conf
+{% endhighlight %}
Добавление задачи
@@ -92,7 +112,9 @@ Parameters:
Настройка
Все настройки хранятся в /etc/queued.conf
. После редактирования, Вы должны перезапустить демон
-systemctl restart queued
+{% highlight bash %}
+systemctl restart queued
+{% endhighlight %}