added syntax highlighting

This commit is contained in:
arcan1s 2014-01-17 23:11:53 +04:00
parent 4fd5d71767
commit 06b0518bb6
17 changed files with 542 additions and 645 deletions

View File

@ -9,6 +9,7 @@
<link rel="license" type="text/html" href="/authors" />
<link rel="stylesheet" href="/resources/css/styles.css">
<link rel="stylesheet" href="/resources/css/syntax.css">
<link rel="shortcut icon" href="/resources/icon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>

View File

@ -11,20 +11,25 @@ commentIssueId: 5
---
<h3><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p align="justify">First install recommended minima:</p>
<pre>pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting</pre>
{% highlight bash %}
pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
{% endhighlight %}
<p align="justify"><a href="https://www.archlinux.org/packages/pkgfile/">pkgfile</a> is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.</p>
<h3><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
<p align="justify">All options are avaible <a href="http://zsh.sourceforge.net/Doc/Release/Options.html">here</a>.</p>
<p align="justify">Set history file and number of commands in cache of the current session and in the history file:</p>
<pre># history
{% highlight bash %}
# history
HISTFILE=~/.zsh_history
HISTSIZE=500000
SAVEHIST=500000</pre>
SAVEHIST=500000
{% endhighlight %}
<p align="justify">I can not remember all <code>Ctrl+</code> combinations so I bind keys to its default usages:</p>
<pre># 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</pre>
bindkey '\e[6~' down-line-or-history # page-down
{% endhighlight %}
<p align="justify">But in this case <code>Up</code>/<code>Down</code> arrows are used to navigate through the history based on <b>already entered part</b> of a command. And <code>PgUp</code>/<code>PgDown</code> <b>will ignore</b> already entered part of a command.</p>
<p align="justify">Command autocomplete:</p>
<pre># autocomplete
{% highlight bash %}
# autocomplete
autoload -U compinit
compinit
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' max-errors 2</pre>
zstyle ':completion:*' max-errors 2
{% endhighlight %}
<p align="justify">Full command autocomplete will be enabled. <code>insert-tab false</code> will enable autocomplete for <b>non-entered</b> commands. <code>max-errors</code> sets maximum number of errors that could be corrected.</p>
<p align="justify">Prompt:</p>
<pre># promptinit
{% highlight bash %}
# promptinit
autoload -U promptinit
promptinit</pre>
promptinit
{% endhighlight %}
<p align="justify">Enable colors:</p>
<pre># colors
{% highlight bash %}
# colors
autoload -U colors
colors</pre>
colors
{% endhighlight %}
<p align="justify">Here are some other options.</p>
<p align="justify">Change directory without <code>cd</code>:</p>
<pre># autocd
setopt autocd</pre>
{% highlight bash %}
# autocd
setopt autocd
{% endhighlight %}
<p align="justify">Correcting of typos (and question template):</p>
<pre># correct
{% highlight bash %}
# correct
setopt CORRECT_ALL
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "</pre>
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
{% endhighlight %}
<p align="justify">Disable f#$%ing beep:</p>
<pre># disable beeps
unsetopt beep</pre>
{% highlight bash %}
# disable beeps
unsetopt beep
{% endhighlight %}
<p align="justify">Enable calculator:</p>
<pre># calc
autoload zcalc</pre>
{% highlight bash %}
# calc
autoload zcalc
{% endhighlight %}
<p align="justify">Append history (<b>do not recreate</b> the history file):</p>
<pre># append history
setopt APPEND_HISTORY</pre>
{% highlight bash %}
# append history
setopt APPEND_HISTORY
{% endhighlight %}
<p align="justify">Do not save dups to history file:</p>
<pre># ignore spaces in history
setopt HIST_IGNORE_ALL_DUPS</pre>
{% highlight bash %}
# ignore spaces in history
setopt HIST_IGNORE_ALL_DUPS
{% endhighlight %}
<p align="justify">...and additional spaces:</p>
<pre># ignore dups in history
setopt HIST_IGNORE_SPACE</pre>
{% highlight bash %}
# ignore dups in history
setopt HIST_IGNORE_SPACE
{% endhighlight %}
<p align="justify">...and blank lines too:</p>
<pre># reduce blanks in history
setopt HIST_REDUCE_BLANKS</pre>
{% highlight bash %}
# reduce blanks in history
setopt HIST_REDUCE_BLANKS
{% endhighlight %}
<p align="justify">Enable <code>pkgfile</code>:</p>
<pre># pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh</pre>
{% highlight bash %}
# pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh
{% endhighlight %}
<h3><a name="highlighting" class="anchor" href="#highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
<pre># 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 example
#ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
# root example
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'</pre>
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
{% endhighlight %}
<p align="justify">In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (<code>rm -rf *</code> in the example). Also <code>root</code> and <code>cursor</code> highlighting may be turned on. Colors syntax is understandable, <code>fg</code> is font color, <code>bg</code> is background color.</p>
<h3><a name="prompt" class="anchor" href="#prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
<p align="justify">The general idea is the use single <code>.zshrc</code> for root and normal user:</p>
<pre># 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</pre>
fi
{% endhighlight %}
<p align="justify"><code>fg</code> is font color, <code>bg</code> is background color. <code>_bold</code> and <code>_no_bold</code> regulate the tint. Commands should be in <code>%{ ... %}</code> so they do not appear. Avaible colors are:</p>
<pre>black
{% highlight bash %}
black
red
green
yellow
blue
magenta
cyan
white</pre>
white
{% endhighlight %}
<p align="justify">Avaible variables are:</p>
<pre>%n - the username
{% highlight bash %}
%n - the username
%m - the computer's hostname (truncated to the first period)
%M - the computer's hostname
%l - the current tty
@ -173,10 +210,12 @@ white</pre>
%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</pre>
%1/ - the same as %d but only last directory
{% endhighlight %}
<p align="justify">RPROMPT (<code>acpi</code> package is necessary):</p>
<pre>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</pre>
$(batcharge)\
"%{$fg_bold[white]%}[%{$reset_color%}"\
$returncode\
"%{$fg_bold[white]%}]%{$reset_color%}"</pre>
"%{$fg_bold[white]%}]%{$reset_color%}"
{% endhighlight %}
<p align="justify">My RPROMPT shows current time, battery change and last returned code. <code>precmd()</code> is necessary for automatic updating. The construct <code>$(if.true.false)</code> is conditional statement in <code>zsh</code>.</p>
<h3><a name="aliases" class="anchor" href="#aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
<p align="justify"><b>Copy only those aliases that you need.</b> If any alias uses application that is not installed it will leads to fail of loading of configuration file.</p>
<p align="justify">Small useful (or maybe not) function:</p>
<pre>show_which() {
{% highlight bash %}
show_which() {
OUTPUT=$(which $1 | cut -d " " -f7-)
echo "Running '$OUTPUT'" 1>&2
}</pre>
}
{% endhighlight %}
<p align="justify">Here is the first group of aliases:</p>
<pre>## alias
{% highlight bash %}
## alias
# colored grep
alias grep='grep --colour=auto'
# change top to htop
@ -226,29 +269,35 @@ alias du='show_which du && du -k --total --human-readable'
alias less='vimpager'
alias zless='vimpager'
# more interactive rm
alias rm='show_which rm && rm -I'</pre>
alias rm='show_which rm && rm -I'
{% endhighlight %}
<p align="justify">Here are ls aliases (see <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ls">man ls</a>):</p>
<pre>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'</pre>
alias lm='show_which lm && la | more'
{% endhighlight %}
<p align="justify">Here are aliases to quick file view from console (just type a file name!):</p>
<pre># 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</pre>
alias -s {html,htm}=opera
{% endhighlight %}
<p align="justify">Here are "sudo" aliases:</p>
<pre># 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</pre>
fi
{% endhighlight %}
<p align="justify">Here are global aliases. If they are enable the command <code>cat foo g bar</code> will be equivalent the command <code>cat foo | grep bar</code>:</p>
<pre># 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 &"</pre>
alias -g dn="&> /dev/null &"
{% endhighlight %}
<h3><a name="functions" class="anchor" href="#functions"><span class="octicon octicon-link"></span></a>Functions</h2>
<p align="justify">Here is a special function for <code>xrandr</code>:</p>
<pre># 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
}</pre>
}
{% endhighlight %}
<p align="justify">Unfortunately I can not remember <code>tar</code> flags thus I use special functions:</p>
<pre># 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
}</pre>
}
{% endhighlight %}
<p align="justify">Here is a special function for <code>su</code>:</p>
<pre>su () {
{% highlight bash %}
su () {
checksu=0
for flags in $*; do
if [[ $flags == "-" ]]; then
@ -365,10 +422,12 @@ pack () {
else
/usr/bin/su $*
fi
}</pre>
}
{% endhighlight %}
<p align="justify">Functions with automatic rehash after installing/removing packages are:</p>
<pre>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
}</pre>
}
{% endhighlight %}
<p align="justify">But autocomplete for <code>yaourt -Ss</code> <a href="https://github.com/zsh-users/zsh-completions/pull/205">will require</a> root privileges.</p>
<h3><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Variables</h2>
<p align="justify">It is recommended to set own variables in <code>~/.zshenv</code>. But I have everything stored in the single file.</p>
<p align="justify">Here are path, mask of new files, editor and pager:</p>
<pre># path
{% highlight bash %}
# path
export PATH="$PATH:$HOME/.local/bin"
# umask
umask 022
# editor
export EDITOR="vim"
export PAGER="vimpager"</pre>
export PAGER="vimpager"
{% endhighlight %}
<p align="justify">Here is hashes. If they are enable the command <code>~global</code> will be equivalent the command <code>/mnt/global</code>:</p>
<pre># 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</pre>
hash -d u2=/mnt/usbdev
{% endhighlight %}
<h3><a name="screenshot" class="anchor" href="#screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
<p align="justify"><a href="/resources/screenshots/zshrc_demo.png"><img src="/resources/preview/zshrc_demo_prev.jpg"></a></p>

View File

@ -35,7 +35,9 @@ The Trusted User (TU) is a member of the community charged with keeping the AUR
<p align="right">&copy; <a href="https://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines/">ArchWiki</a></p>
<p align="justify">All contact information can be found on the left. Feel free to contact me with any questions. Oh, wait! If you will write me to ICQ or jabber you must correctly answer antispam bot's question first. The question is:</p>
<pre><code>int i = 1;
{% highlight c %}
int i = 1;
i = ++i + ++i;
return i;</code></pre>
return i;
{% endhighlight %}
<p align="justify">And the correct answer is <code>5</code> (or <code>6</code>, as you wish).</p>

View File

@ -14,24 +14,19 @@ title: Authors
<p align="justify">The code and content of this site is licensed under <a href="http://people.freebsd.org/~phk">Beerware</a> license:</p>
<blockquote><p align="justify">"THE BEER-WARE LICENSE" (Revision 42):<br>
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</p></blockquote>
<p align="justify">The source theme was created by <a href="https://github.com/orderedlist/minimal">Steve Smith</a> and licensed under <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution-ShareAlike 3.0 Unported</a> License.</p>
<p align="justify">The comment block was created by <a href="https://github.com/izuzak/izuzak.github.com">Ivan Žužak</a> and licensed under <a href="http://opensource.org/licenses/MIT">MIT</a> License.</p>
<p align="justify">The spoiler block was created by <a href="http://www.cyberforum.ru/post5368179.html">markeley</a> and it looks like it has no any license.</p>
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.</p></blockquote>
<p align="justify">This site uses:
<ul>
<li><a href="http://jekyllrb.com/">Jekyll</a> that licensed under <a href="http://opensource.org/licenses/MIT">MIT</a> License</li>
</ul></p>
<p align="justify">Google Custom Search is licensed under own custom <a href="https://support.google.com/customsearch/answer/1714300">license</a>.</p>
<p align="justify">Sharethis have own custom <a href="http://www.sharethis.com/legal/publisher-terms-of-use">license</a> too.</p>
<p align="justify"><a href="https://www.redhat.com/promo/fonts/">Liberation font</a> is licensed under <a href="http://scripts.sil.org/OFL">The SIL Open Font</a> License.</p>
<li><a href="http://jekyllrb.com/">Jekyll</a> that licensed under <a href="http://opensource.org/licenses/MIT">MIT License</a>.</li>
<li>The source theme was created by <a href="https://github.com/orderedlist/minimal">Steve Smith</a> and licensed under <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</li>
<li>The comment block was created by <a href="https://github.com/izuzak/izuzak.github.com">Ivan Žužak</a> and licensed under <a href="http://opensource.org/licenses/MIT">MIT License</a>.</li>
<li>The spoiler block was created by <a href="http://www.cyberforum.ru/post5368179.html">markeley</a> and it looks like it has no any license.</li>
<li>Google Custom Search is licensed under own <a href="https://support.google.com/customsearch/answer/1714300">custom license</a>.</li>
<li>Sharethis have own <a href="http://www.sharethis.com/legal/publisher-terms-of-use">custom license</a> too.</li>
<li><a href="https://www.redhat.com/promo/fonts/">Liberation font</a> is licensed under <a href="http://scripts.sil.org/OFL">The SIL Open Font License</a>.</li>
</ul>
</p>
<p align="justify">Special thanks to <a href="http://monztruo.deviantart.com/">Monztruo</a>, I borrowed <a href="http://monztruo.deviantart.com/art/Zalgo-Pacman-v1-194649946">his icon</a>.</p>

View File

@ -14,7 +14,8 @@ links:
<!-- info block -->
<h2><a name="info" class="anchor" href="#info"><span class="octicon octicon-link"></span></a>Information</h2>
<p align="justify">Simple daemon that automatically creates git repository in the given directory and creates commit at the specified time interval.</p>
<pre>$ 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 ]
@ -24,8 +25,10 @@ Parametrs:
-h --help - show this help and exit
-v --version - show version and exit
See "man 1 git-etc" for more details</pre>
<pre>$ 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 ]
@ -35,7 +38,8 @@ Additional parametrs:
-h --help - show this help and exit
-v --version - show version and exit
See "man 1 ctrlconf" for more details</pre>
See "man 1 ctrlconf" for more details
{% endhighlight %}
<h3><a name="devel" class="anchor" href="#devel"><span class="octicon octicon-link"></span></a>Developers and contributors</h3>
<ul>
@ -57,9 +61,13 @@ See "man 1 ctrlconf" for more details</pre>
<ul>
<li><p align="justify">Download an <a href="https://github.com/arcan1s/git-etc/releases">archive</a> with latest version of source files.</p></li>
<li><p align="justify">Extract it and install the application:</p>
<pre>./install.sh "/path/to/root"</pre>
{% highlight bash %}
./install.sh "/path/to/root"
{% endhighlight %}
<p align="justify">If you want install it to <code>/</code> you must run it as root, e.g.:</p>
<pre>sudo ./install.sh</pre>
{% highlight bash %}
sudo ./install.sh
{% endhighlight %}
<p align="justify">If no path is specified it will be installed to <code>/</code> by default.</p></li>
</ul>
@ -78,23 +86,37 @@ See "man 1 ctrlconf" for more details</pre>
<!-- howto block -->
<h2><a name="howto" class="anchor" href="#howto"><span class="octicon octicon-link"></span></a>How to use</h2>
<p align="justify">If you want to start the daemon into <code>/etc</code> just run</p>
<pre>systemctl start git-etc</pre>
{% highlight bash %}
systemctl start git-etc
{% endhighlight %}
<p align="justify">If you want to enable daemon autoload run</p>
<pre>systemctl enable git-etc</pre>
{% highlight bash %}
systemctl enable git-etc
{% endhighlight %}
<p align="justify">But you may change path to configuration file or change parameters. To do it just copy (recommended) the source configuration file to new path</p>
<pre>cp /etc/git-etc.conf /new/path/to/file/git-etc.conf</pre>
{% highlight bash %}
cp /etc/git-etc.conf /new/path/to/file/git-etc.conf
{% endhighlight %}
<p align="justify">and edit it. Then copy the source service file to <code>/etc</code>:</p>
<pre>cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service</pre>
{% highlight bash %}
cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service
{% endhighlight %}
<p align="justify">Replace following string in the file:</p>
<pre>ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf
{% endhighlight %}
<p align="justify">to</p>
<pre>ExecStart=/usr/bin/git-etc -c /new/path/to/file/git-etc.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/git-etc -c /new/path/to/file/git-etc.conf
{% endhighlight %}
<!-- end of howto block -->
<!-- config block -->
<h2><a name="config" class="anchor" href="#config"><span class="octicon octicon-link"></span></a>Configuration</h2>
<p align="justify">All settings are stored in <code>/etc/git-etc.conf</code>. After edit them you must restart daemon</p>
<pre>systemctl restart git-etc</pre>
{% highlight bash %}
systemctl restart git-etc
{% endhighlight %}
<h3><a name="options" class="anchor" href="#options"><span class="octicon octicon-link"></span></a>Options</h3>
<table>

View File

@ -36,21 +36,29 @@ links:
<ul>
<li><p align="justify">Download an <a href="https://github.com/arcan1s/oblikuestrategies/releases">archive</a> with latest version of source files.</p></li>
<li><p align="justify">Extract it and install the application. For global isntallation type:</p>
<pre>cd /where/is/applet/
{% highlight bash %}
cd /where/is/applet/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install</pre>
sudo make install
{% endhighlight %}
<p align="justify">For local isntallation type:</p>
<pre>cd /where/is/applet/
{% highlight bash %}
cd /where/is/applet/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` -DCMAKE_BUILD_TYPE=Release ../
make
make install</pre></li>
make install
{% endhighlight %}</li>
<li><p align="justify">Restart plasma to load the applet:</p>
<pre>kquitapp plasma-desktop && sleep 2 && plasma-desktop</pre>
{% highlight bash %}
kquitapp plasma-desktop && sleep 2 && plasma-desktop
{% endhighlight %}
<p align="justify">Also you might need to run <code>kbuildsycoca4</code> in order to get the <code>*.desktop</code> file recognized:</p>
<pre>kbuildsycoca4 &> /dev/null</pre></li>
{% highlight bash %}
kbuildsycoca4 &> /dev/null
{% endhighlight %}</li>
</ul>
<h3><a name="dependencies" class="anchor" href="#dependencies"><span class="octicon octicon-link"></span></a>Dependencies</h3>

View File

@ -37,21 +37,29 @@ links:
<ul>
<li><p align="justify">Download an <a href="https://github.com/arcan1s/pytextmonitor/releases">archive</a> with latest version of source files.</p></li>
<li><p align="justify">Extract it and install the DataEngine:</p>
<pre>cd /where/is/applet/
{% highlight bash %}
cd /where/is/applet/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` -DCMAKE_BUILD_TYPE=Release ../
make
make install</pre>
make install
{% endhighlight %}
<p align="justify">For global isntallation type:</p>
<pre>cd /where/is/applet/
{% highlight bash %}
cd /where/is/applet/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install</pre></li>
sudo make install
{% endhighlight %}</li>
<li><p align="justify">Install the Plasmoid:</p>
<pre>plasmapkg -i py-text-monitor-1.5.0.plasmoid</pre>
{% highlight bash %}
plasmapkg -i py-text-monitor-1.5.0.plasmoid
{% endhighlight %}
<p align="justify">For global isntallation type:</p>
<pre>sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid</pre></li>
{% highlight bash %}
sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid
{% endhighlight %}</li>
</ul>
<h3><a name="dependencies" class="anchor" href="#dependencies"><span class="octicon octicon-link"></span></a>Dependencies</h3>

View File

@ -13,7 +13,8 @@ links:
<!-- info block -->
<h2><a name="info" class="anchor" href="#info"><span class="octicon octicon-link"></span></a>Information</h2>
<p align="justify">Daemon for starting jobs to queue of calculations. It was written as proof-of-concept.</p>
<pre>$ 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 ]
@ -21,15 +22,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</pre>
<pre>$ 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</pre>
-h --help - show this help and exit
{% endhighlight %}
<h3><a name="devel" class="anchor" href="#devel"><span class="octicon octicon-link"></span></a>Developers and contributors</h3>
<ul>
@ -51,9 +55,13 @@ Parameters:
<ul>
<li><p align="justify">Download an <a href="https://github.com/arcan1s/queued/releases">archive</a> with latest version of source files.</p></li>
<li><p align="justify">Extract it and install the application:</p>
<pre>./install.sh "/path/to/root/"</pre>
{% highlight bash %}
./install.sh "/path/to/root/"
{% endhighlight %}
<p align="justify">If you want install it to <code>/</code> you must run it as root, e.g.:</p>
<pre>sudo ./install.sh</pre>
{% highlight bash %}
sudo ./install.sh
{% endhighlight %}
<p align="justify">If no path is specified it will be installed to <code>/</code> by default.</p></li>
</ul>
@ -68,17 +76,29 @@ Parameters:
<!-- howto block -->
<h2><a name="howto" class="anchor" href="#howto"><span class="octicon octicon-link"></span></a>How to use</h2>
<p align="justify">If you want to start the daemon just run</p>
<pre>systemctl start queued</pre>
{% highlight bash %}
systemctl start queued
{% endhighlight %}
<p align="justify">If you want to enable daemon autoload run</p>
<pre>systemctl enable queued</pre>
{% highlight bash %}
systemctl enable queued
{% endhighlight %}
<p align="justify">But you may change path to configuration file or change parameters. To do it just copy (recommended) the source configuration file to new path</p>
<pre>cp /etc/queued.conf /path/to/new/queued.conf</pre>
{% highlight bash %}
cp /etc/queued.conf /path/to/new/queued.conf
{% endhighlight %}
<p align="justify">and edit it. Then copy the source service file to <code>/etc</code>:</p>
<pre>cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service</pre>
{% highlight bash %}
cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service
{% endhighlight %}
<p align="justify">Replace following string in the file:</p>
<pre>ExecStart=/usr/bin/queued</pre>
{% highlight bash %}
ExecStart=/usr/bin/queued
{% endhighlight %}
<p align="justify">to</p>
<pre>ExecStart=/usr/bin/queued -c /path/to/new/queued.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/queued -c /path/to/new/queued.conf
{% endhighlight %}
<h3><a name="adding" class="anchor" href="#adding"><span class="octicon octicon-link"></span></a>Adding a job</h3>
<ol>
@ -91,7 +111,9 @@ Parameters:
<h2><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Configuration</h2>
<p align="justify">All settings are stored in <code>/etc/queued.conf</code>. After edit them you must restart daemon</p>
<pre>systemctl restart queued</pre>
{% highlight bash %}
systemctl restart queued
{% endhighlight %}
<!-- end of howto block -->
<!-- config block -->

60
resources/css/syntax.css Normal file
View File

@ -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 */

View File

@ -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 <code>.zshrc</code> and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (<a href="http://archlinux.org.ru/forum/topic/12752/">original</a>).
commentIssueId: 5
---
<h3><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p align="justify">First install recommended minima:</p>
<pre>pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting</pre>
<p align="justify"><a href="https://www.archlinux.org/packages/pkgfile/">pkgfile</a> is a very useful utility. Alo this command will install shell, additional completion and syntax highlighting.</p>
<h3><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
<p align="justify">All options are avaible <a href="http://zsh.sourceforge.net/Doc/Release/Options.html">here</a>.</p>
<p align="justify">Set history file and number of commands in cache of the current session and in the history file:</p>
<pre># history
HISTFILE=~/.zsh_history
HISTSIZE=500000
SAVEHIST=500000</pre>
<p align="justify">I can not remember all <code>Ctrl+</code> combinations so I bind keys to its default usages:</p>
<pre># 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</pre>
<p align="justify">But in this case <code>Up</code>/<code>Down</code> arrows are used to navigate through the history based on <b>already entered part</b> of a command. And <code>PgUp</code>/<code>PgDown</code> <b>will ignore</b> already entered part of a command.</p>
<p align="justify">Command autocomplete:</p>
<pre># autocomplete
autoload -U compinit
compinit
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' max-errors 2</pre>
<p align="justify">Full command autocomplete will be enabled. <code>insert-tab false</code> will enable autocomplete for <b>non-entered</b> commands. <code>max-errors</code> sets maximum number of errors that could be corrected.</p>
<p align="justify">Prompt:</p>
<pre># promptinit
autoload -U promptinit
promptinit</pre>
<p align="justify">Enable colors:</p>
<pre># colors
autoload -U colors
colors</pre>
<p align="justify">Here are some other options.</p>
<p align="justify">Change directory without <code>cd</code>:</p>
<pre># autocd
setopt autocd</pre>
<p align="justify">Correcting of typos (and question template):</p>
<pre># correct
setopt CORRECT_ALL
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "</pre>
<p align="justify">Disable f#$%ing beep:</p>
<pre># disable beeps
unsetopt beep</pre>
<p align="justify">Enable calculator:</p>
<pre># calc
autoload zcalc</pre>
<p align="justify">Append history (<b>do not recreate</b> the history file):</p>
<pre># append history
setopt APPEND_HISTORY</pre>
<p align="justify">Do not save dups to history file:</p>
<pre># ignore dups in history
setopt HIST_IGNORE_ALL_DUPS</pre>
<p align="justify">...and additional spaces:</p>
<pre># ignore dups in history
setopt HIST_IGNORE_SPACE</pre>
<p align="justify">...and blank lines too:</p>
<pre># reduce blanks in history
setopt HIST_REDUCE_BLANKS</pre>
<p align="justify">Enable <code>pkgfile</code>:</p>
<pre># pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh</pre>
<h3><a name="highlighting" class="anchor" href="#highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
<div class="codeblock"># 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'</div>
<p align="justify">In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (<code>rm -rf *</code> in the example). Also <code>root</code> and <code>cursor</code> highlighting may be turned on. Colors syntax is understandable, <code>fg</code> is font color, <code>bg</code> is background color.</p>
<h3><a name="prompt" class="anchor" href="#prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
<p align="justify">The general idea is the use single <code>.zshrc</code> for root and normal user:</p>
<div class="codeblock"># 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</div>
<p align="justify"><code>fg</code> is font color, <code>bg</code> is background color. <code>\_bold</code> and <code>\_no_bold</code> regulate the tint. Commands should be in <code>%{ ... %}</code> so they do not appear. Avaible colors are:</p>
<pre>black
red
green
yellow
blue
magenta
cyan
white</pre>
<p align="justify">Avaible variables are:</p>
<div class="codeblock">%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</div>
<p align="justify">RPROMPT (<code>acpi</code> package is necessary):</p>
<div class="codeblock">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%}"</div>
<p align="justify">My RPROMPT shows current time, battery change and last returned code. <code>precmd()</code> is necessary for automatic updating. The construct <code>$(if.true.false)</code> is conditional statement in <code>zsh</code>.</p>
<h3><a name="aliases" class="anchor" href="#aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
<p align="justify"><b>Copy only those aliases that you need.</b> If any alias uses application that is not installed it will leads to fail of loading of configuration file.</p>
<p align="justify">Small useful (or maybe not) function:</p>
<pre>show_which() {
OUTPUT=$(which $1 | cut -d " " -f7-)
echo "Running '$OUTPUT'" 1>&2
}</pre>
<p align="justify">Here is the first group of aliases:</p>
<div class="codeblock">## 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'</div>
<p align="justify">Here are ls aliases (see <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ls">man ls</a>):</p>
<pre>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'</pre>
<p align="justify">Here are aliases to quick file view from console (just type a file name!):</p>
<pre># 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</pre>
<p align="justify">Here are "sudo" aliases:</p>
<div class="codeblock"># 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</div>
<p align="justify">Here are global aliases. If they are enable the command <code>cat foo g bar</code> will be equivalent the command <code>cat foo | grep bar</code>:</p>
<pre># global alias
alias -g g="| grep"
alias -g l="| less"
alias -g t="| tail"
alias -g h="| head"
alias -g dn="&> /dev/null &"</pre>
<h3><a name="functions" class="anchor" href="#functions"><span class="octicon octicon-link"></span></a>Functions</h2>
<p align="justify">Here is a special function for <code>xrandr</code>:</p>
<div class="codeblock"># 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
}</div>
<p align="justify">Unfortunately I can not remember <code>tar</code> flags thus I use special functions:</p>
<div class="codeblock"># 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
}</div>
<p align="justify">Here is a special function for <code>su</code>:</p>
<div class="codeblock">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
}</div>
<p align="justify">Functions with automatic rehash after installing/removing packages are:</p>
<div class="codeblock">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
}</div>
<p align="justify">But autocomplete for <code>yaourt -Ss</code> <a href="https://github.com/zsh-users/zsh-completions/pull/205">will require</a> root privileges.</p>
<h3><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Variables</h2>
<p align="justify">It is recommended to set own variables in <code>~/.zshenv</code>. But I have everything stored in the single file.</p>
<p align="justify">Here are path, mask of new files, editor and pager:</p>
<pre># path
export PATH="$PATH:$HOME/.local/bin"
# umask
umask 022
# editor
export EDITOR="vim"
export PAGER="vimpager"</pre>
<p align="justify">Here is hashes. If they are enable the command <code>~global</code> will be equivalent the command <code>/mnt/global</code>:</p>
<pre># 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</pre>
<h3><a name="screenshot" class="anchor" href="#screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
<p align="justify"><a href="/resources/screenshots/zshrc_demo.png"><img src="/resources/preview/zshrc_demo_prev.jpg"></a></p>
<h3><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>File</h2>
<p align="justify"><a href="https://raw.github.com/arcan1s/dotfiles/master/zshrc">Here is</a> my <code>.zshrc</code>.</p>

View File

@ -11,20 +11,25 @@ commentIssueId: 5
---
<h3><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Подготовка</h2>
<p align="justify">Сначала установите необходимый минимум:</p>
<pre>pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting</pre>
{% highlight bash %}
pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
{% endhighlight %}
<p align="justify"><a href="https://www.archlinux.org/packages/pkgfile/">pkgfile</a> очень полезная утилита. Данная команда также установит шелл, дополнения к нему и подсветку синтаксиса.</p>
<h3><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Настройка шелла</h2>
<p align="justify">Все доступные опции приведены <a href="http://zsh.sourceforge.net/Doc/Release/Options.html">здесь</a>.</p>
<p align="justify">Указываем файл с историей, число команд хранящихся в кэше текущего сеанса и число команд, хранящихся в файле:</p>
<pre># history
{% highlight bash %}
# history
HISTFILE=~/.zsh_history
HISTSIZE=500000
SAVEHIST=500000</pre>
SAVEHIST=500000
{% endhighlight %}
<p align="justify">Я не могу запомнить все комбинации <code>Ctrl+</code>, поэтому я назначаю клавиши на их стандартное использование:</p>
<pre># 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</pre>
bindkey '\e[6~' down-line-or-history # page-down
{% endhighlight %}
<p align="justify">Но здесь важно, что стрелки <code>вверх</code>/<code>вниз</code> служат для навигации по истории с учетом <b>уже введенной части</b> команды. А <code>PgUp</code>/<code>PgDown</code> <b>проигнорирую</b> уже введенную часть команды.</p>
<p align="justify">Автодополнение команд:</p>
<pre># autocomplete
{% highlight bash %}
# autocomplete
autoload -U compinit
compinit
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' max-errors 2</pre>
zstyle ':completion:*' max-errors 2
{% endhighlight %}
<p align="justify">Подключается полное автодополнение команд. <code>insert-tab false</code> включит автодополнение для <b>невведенной</b> команды (не знаю, зачем). <code>max-errors</code> устанавливает максимальное число опечаток, которые могут быть исправлены.</p>
<p align="justify">Приглашение:</p>
<pre># promptinit
{% highlight bash %}
# promptinit
autoload -U promptinit
promptinit</pre>
promptinit
{% endhighlight %}
<p align="justify">Включим цвета:</p>
<pre># colors
{% highlight bash %}
# colors
autoload -U colors
colors</pre>
colors
{% endhighlight %}
<p align="justify">Различные опции.</p>
<p align="justify">Смена директории без ввода <code>cd</code>:</p>
<pre># autocd
setopt autocd</pre>
{% highlight bash %}
# autocd
setopt autocd
{% endhighlight %}
<p align="justify">Корректировка опечаток (и шаблон вопроса):</p>
<pre># correct
{% highlight bash %}
# correct
setopt CORRECT_ALL
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "</pre>
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
{% endhighlight %}
<p align="justify">Отключаем е#$%ую пищалку:</p>
<pre># disable beeps
unsetopt beep</pre>
{% highlight bash %}
# disable beeps
unsetopt beep
{% endhighlight %}
<p align="justify">Включаем калькулятор:</p>
<pre># calc
autoload zcalc</pre>
{% highlight bash %}
# calc
autoload zcalc
{% endhighlight %}
<p align="justify">Дополнение истории (<b>а не перезапись</b> файла):</p>
<pre># append history
setopt APPEND_HISTORY</pre>
{% highlight bash %}
# append history
setopt APPEND_HISTORY
{% endhighlight %}
<p align="justify">Не сохранять дубликаты в историю:</p>
<pre># ignore dups in history
setopt HIST_IGNORE_ALL_DUPS</pre>
{% highlight bash %}
# ignore dups in history
setopt HIST_IGNORE_ALL_DUPS
{% endhighlight %}
<p align="justify">...и дополнительные пробелы:</p>
<pre># ignore spaces in history
setopt HIST_IGNORE_SPACE</pre>
{% highlight bash %}
# ignore spaces in history
setopt HIST_IGNORE_SPACE
{% endhighlight %}
<p align="justify">...и пустые линии тоже:</p>
<pre># reduce blanks in history
setopt HIST_REDUCE_BLANKS</pre>
{% highlight bash %}
# reduce blanks in history
setopt HIST_REDUCE_BLANKS
{% endhighlight %}
<p align="justify">Включаем <code>pkgfile</code>:</p>
<pre># pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh</pre>
{% highlight bash %}
# pkgfile
source /usr/share/doc/pkgfile/command-not-found.zsh
{% endhighlight %}
<h3><a name="highlighting" class="anchor" href="#highlighting"><span class="octicon octicon-link"></span></a>Подсветка синтаксиса</h2>
<pre># 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'</pre>
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
{% endhighlight %}
<p align="justify">В первой строке включаем подсветку. Затем включаем основную подсветку, а также подсветку скобок и шаблонов. Шаблоны указываются ниже (<code>rm -rf *</code> в примере). Также может быть включена подсветка команд от <code>root</code> и курсора <code>cursor</code>. Синтаксис настроек понятен, <code>fg</code> цвет шрифта, <code>bg</code> цвет фона.</p>
<h3><a name="prompt" class="anchor" href="#prompt"><span class="octicon octicon-link"></span></a>$PROMPT и $RPROMPT</h2>
<p align="justify">Я хочу использовать один файл <code>.zshrc</code> для рута и обычного пользователя:</p>
<pre># 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</pre>
fi
{% endhighlight %}
<p align="justify"><code>fg</code> цвет шрифта, <code>bg</code> цвет фона. <code>_bold</code> и <code>_no_bold</code> регулируют оттенок. Команды должны быть обрамлены в <code>%{ ... %}</code>, чтобы не показывались. Доступные цвета:</p>
<pre>black
{% highlight bash %}
black
red
green
yellow
blue
magenta
cyan
white</pre>
white
{% endhighlight %}
<p align="justify">Доступные переменные:</p>
<pre>%n - имя пользователя
{% highlight bash %}
%n - имя пользователя
%m - хостнейм (выставляется только в начале сессии)
%M - хостнейм
%l - текущая tty
@ -173,10 +210,12 @@ white</pre>
%D - дата (YY-MM-DD)
%d - текущая директория
%~ - то же, домашняя директория будет заменена на ~
%1/ - то же, но только последняя директория</pre>
%1/ - то же, но только последняя директория
{% endhighlight %}
<p align="justify">RPROMPT (необходим пакет <code>acpi</code>):</p>
<pre>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</pre>
$(batcharge)\
"%{$fg_bold[white]%}[%{$reset_color%}"\
$returncode\
"%{$fg_bold[white]%}]%{$reset_color%}"</pre>
"%{$fg_bold[white]%}]%{$reset_color%}"
{% endhighlight %}
<p align="justify">Мой RPROMPT показывает текущее время, заряд батареи и код возврата последнего приложения. <code>precmd()</code> необходимо для автоматического обновления. Конструкция <code>$(if.true.false)</code> является условным оператором в <code>zsh</code>.</p>
<h3><a name="aliases" class="anchor" href="#aliases"><span class="octicon octicon-link"></span></a>Аллиасы</h2>
<p align="justify"><b>Копируйте только те аллиасы, которые Вам необходимы.</b> Если какой-либо аллиас использует приложение, которое не установлено, это приведет к сбою загрузки конфигурационного файла.</p>
<p align="justify">Полезная (или не очень) функция:</p>
<pre>show_which() {
{% highlight bash %}
show_which() {
OUTPUT=$(which $1 | cut -d " " -f7-)
echo "Running '$OUTPUT'" 1>&2
}</pre>
}
{% endhighlight %}
<p align="justify">Первая группа аллиасов:</p>
<pre>## 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'</pre>
alias rm='show_which rm && rm -I'
{% endhighlight %}
<p align="justify">ls аллиасы (смотри <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ls">man ls</a>):</p>
<pre>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'</pre>
alias lm='show_which lm && la | more'
{% endhighlight %}
<p align="justify">Аллиасы для быстрого просмотра файлов из консоли (просто набери имя файла!):</p>
<pre># 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</pre>
alias -s {html,htm}=opera
{% endhighlight %}
<p align="justify">"sudo" аллиасы:</p>
<pre># 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</pre>
fi
{% endhighlight %}
<p align="justify">Некоторые глобальные аллиасы. Если они включены, команда <code>cat foo g bar</code> будет эквивалентна <code>cat foo | grep bar</code>:</p>
<pre># 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 &"</pre>
alias -g dn="&> /dev/null &"
{% endhighlight %}
<h3><a name="functions" class="anchor" href="#functions"><span class="octicon octicon-link"></span></a>Функции</h2>
<p align="justify">Специальная функция для <code>xrandr</code>:</p>
<pre># 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
}</pre>
}
{% endhighlight %}
<p align="justify">К сожалению, я не могу запомнить флаги <code>tar</code>, поэтому я использую специальные функции:</p>
<pre># 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
}</pre>
}
{% endhighlight %}
<p align="justify">Специальная функция для <code>su</code>:</p>
<pre>su () {
{% highlight bash %}
su () {
checksu=0
for flags in $*; do
if [[ $flags == "-" ]]; then
@ -365,10 +422,12 @@ pack () {
else
/usr/bin/su $*
fi
}</pre>
}
{% endhighlight %}
<p align="justify">Функция для автоматических обновлений путей после установки пакето:</p>
<pre>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
}</pre>
}
{% endhighlight %}
<p align="justify">Но автодополнение для <code>yaourt -Ss</code> <a href="https://github.com/zsh-users/zsh-completions/pull/205">будет требовать</a> привилегий рута.</p>
<h3><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Переменные</h2>
<p align="justify">Рекомендуется хранить свои переменные в <code>~/.zshenv</code>. Но я все храню в одном файле.</p>
<p align="justify">Пути, маска создаваемых файлов, редактор и пейджер:</p>
<pre># path
{% highlight bash %}
# path
export PATH="$PATH:$HOME/.local/bin"
# umask
umask 022
# editor
export EDITOR="vim"
export PAGER="vimpager"</pre>
export PAGER="vimpager"
{% endhighlight %}
<p align="justify">Хэши. Если они включены, команда <code>~global</code> будет эквивалентна команде <code>/mnt/global</code>:</p>
<pre># 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</pre>
hash -d u2=/mnt/usbdev2
{% endhighlight %}
<h3><a name="screenshot" class="anchor" href="#screenshot"><span class="octicon octicon-link"></span></a>Скриншот</h2>
<p align="justify"><a href="/resources/screenshots/zshrc_demo.png"><img src="/resources/preview/zshrc_demo_prev.jpg"></a></p>

View File

@ -36,7 +36,9 @@ The Trusted User (TU) is a member of the community charged with keeping the AUR
<p align="right">&copy; <a href="https://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines">ArchWiki</a></p>
<p align="justify">Вся контактная информация может быть найдена слева. Не стесняйтесь связываться со мной по любому вопросу (если что - пошлю). Ах да, чуть не забыл. Если Вы будете писать мне через ICQ или Jabber, Вы должны корректно ответить на вопрос антиспам бота. Вопрос:</p>
<pre><code>int i = 1;
{% highlight c %}
int i = 1;
i = ++i + ++i;
return i;</code></pre>
return i;
{% endhighlight %}
<p align="justify">Правильный ответ <code>5</code> (или <code>6</code>, как больше нравится).</p>

View File

@ -15,25 +15,20 @@ title: Авторы
<p align="justify">Код и контент данного сайта лицензирован под <a href="http://people.freebsd.org/~phk">Beerware</a>:</p>
<blockquote><p align="justify">"THE BEER-WARE LICENSE" (Revision 42):<br>
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</p></blockquote>
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.</p></blockquote>
<p align="justify">(Ну, в общем, там про пиво говорится. Запомните, Вы должны мне пиво.)</p>
<p align="justify">Исходная тема была создана <a href="https://github.com/orderedlist/minimal">Steve Smith</a> и лицензирована под <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution-ShareAlike 3.0 Unported</a> License.</p>
<p align="justify">Блок комментариев был создан <a href="https://github.com/izuzak/izuzak.github.com">Ivan Žužak</a> и лицензирован под <a href="http://opensource.org/licenses/MIT">MIT</a> License.</p>
<p align="justify">Код для спойлеров был предложен <a href="http://www.cyberforum.ru/post5368179.html">markeley</a>, и, судя по всему, он не имеет никакой лицензии.</p>
<p align="justify">Данный сайт использует:
<p align="justify">This site uses:
<ul>
<li><a href="http://jekyllrb.com/">Jekyll</a>, который лицензирован под <a href="http://opensource.org/licenses/MIT">MIT</a> License</li>
</ul></p>
<p align="justify">Google Custom Search имеет собственную <a href="https://support.google.com/customsearch/answer/1714300">лицензию</a>.</p>
<p align="justify">Sharethis тоже имеет собственную <a href="http://www.sharethis.com/legal/publisher-terms-of-use">лицензию</a>.</p>
<p align="justify"><a href="https://www.redhat.com/promo/fonts/">Liberation font</a> лицензирован под <a href="http://scripts.sil.org/OFL">The SIL Open Font</a> License.</p>
<li><a href="http://jekyllrb.com/">Jekyll</a>, который лицензирован под лицензией <a href="http://opensource.org/licenses/MIT">MIT</a>.</li>
<li>Исходная тема была создана <a href="https://github.com/orderedlist/minimal">Steve Smith</a> и лицензирована под <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</li>
<li>Блок комментариев был создан <a href="https://github.com/izuzak/izuzak.github.com">Ivan Žužak</a> и лицензирован под лицензией <a href="http://opensource.org/licenses/MIT">MIT</a>.</li>
<li>Код для спойлеров был предложен <a href="http://www.cyberforum.ru/post5368179.html">markeley</a>, и, судя по всему, он не имеет никакой лицензии.</li>
<li>Google Custom Search имеет собственную <a href="https://support.google.com/customsearch/answer/1714300">кастомную лицензию</a>.</li>
<li>Sharethis тоже имеет собственную <a href="http://www.sharethis.com/legal/publisher-terms-of-use">кастомную лицензию</a>.</li>
<li><a href="https://www.redhat.com/promo/fonts/">Liberation font</a> лицензирован под <a href="http://scripts.sil.org/OFL">The SIL Open Font License</a>.</li>
</ul>
</p>
<p align="justify">Отдельное спасибо <a href="http://monztruo.deviantart.com/">Monztruo</a>, я позаимствовал у него <a href="http://monztruo.deviantart.com/art/Zalgo-Pacman-v1-194649946">иконку</a>.</p>

View File

@ -15,7 +15,8 @@ links:
<!-- info block -->
<h2><a name="info" class="anchor" href="#info"><span class="octicon octicon-link"></span></a>Информация</h2>
<p align="justify">Простой демон, который создает git репозиторий в указанной директории и создает коммит в указанный промежуток времени.</p>
<pre>$ 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</pre>
<pre>$ 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</pre>
See "man 1 ctrlconf" for more details
{% endhighlight %}
<h3><a name="devel" class="anchor" href="#devel"><span class="octicon octicon-link"></span></a>Разработчики</h3>
<ul>
@ -58,9 +62,13 @@ See "man 1 ctrlconf" for more details</pre>
<ul>
<li><p align="justify">Скачайте <a href="https://github.com/arcan1s/git-etc/releases">архив</a> с актуальной версией исходных файлов.</p></li>
<li><p align="justify">Извлеките из него файлы и установите приложение:</p>
<pre>./install.sh "/путь/к/корню/"</pre>
{% highlight bash %}
./install.sh "/путь/к/корню/"
{% endhighlight %}
<p align="justify">Если Вы хотите установить в <code>/</code>, Вы должны запустить это, как root:</p>
<pre>sudo ./install.sh</pre>
{% highlight bash %}
sudo ./install.sh
{% endhighlight %}
<p align="justify">Если путь не указан, пакет будет установлен в <code>/</code>.</p></li>
</ul>
@ -79,23 +87,37 @@ See "man 1 ctrlconf" for more details</pre>
<!-- howto block -->
<h2><a name="howto" class="anchor" href="#howto"><span class="octicon octicon-link"></span></a>Использование</h2>
<p align="justify">Если Вы хотите запустить демон в <code>/etc</code>, просто запустите</p>
<pre>systemctl start git-etc</pre>
{% highlight bash %}
systemctl start git-etc
{% endhighlight %}
<p align="justify">Если Вы хотите включить автозагрузку демона, запутите</p>
<pre>systemctl enable git-etc</pre>
{% highlight bash %}
systemctl enable git-etc
{% endhighlight %}
<p align="justify">Но Вы можете изменить путь к конфигурационному файлу или изменить параметры. Для этого, скопируйте (рекомендуется) исходный конфигурационный файл</p>
<pre>cp /etc/git-etc.conf /новый/путь/к/git-etc.conf</pre>
{% highlight bash %}
cp /etc/git-etc.conf /новый/путь/к/git-etc.conf
{% endhighlight %}
<p align="justify">и отредактируйте его. Затем скопируйте исходный service-файл в <code>/etc</code>:</p>
<pre>cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service</pre>
{% highlight bash %}
cp /usr/lib/systemd/system/git-etc.service /etc/systemd/system/git-etc-my-profile.service
{% endhighlight %}
<p align="justify">Замените следующую строку в этом файле:</p>
<pre>ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/git-etc -c /etc/git-etc.conf
{% endhighlight %}
<p align="justify">на</p>
<pre>ExecStart=/usr/bin/git-etc -c /новый/путь/к/git-etc.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/git-etc -c /новый/путь/к/git-etc.conf
{% endhighlight %}
<!-- end of howto block -->
<!-- config block -->
<h2><a name="config" class="anchor" href="#config"><span class="octicon octicon-link"></span></a>Настройка</h2>
<p align="justify">Все настройки хранятся в <code>/etc/git-etc.conf</code>. После редактирования, Вы должны перезапустить демон</p>
<pre>systemctl restart git-etc</pre>
{% highlight bash %}
systemctl restart git-etc
{% endhighlight %}
<h3><a name="options" class="anchor" href="#options"><span class="octicon octicon-link"></span></a>Options</h3>
<table>

View File

@ -37,21 +37,29 @@ links:
<ul>
<li><p align="justify">Скачайте <a href="https://github.com/arcan1s/oblikuestrategies/releases">архив</a> с актуальной версией исходных файлов.</p></li>
<li><p align="justify">Извлеките из него файлы и установите приложение. Для глобальной установки наберите:</p>
<pre>cd /путь/куда/распакован/архив
{% highlight bash %}
cd /путь/куда/распакован/архив
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install</pre>
sudo make install
{% endhighlight %}
<p align="justify">Для локальной:</p>
<pre>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</pre></li>
make install
{% endhighlight %}</li>
<li><p align="justify">Перезапустите plasma, чтобы загрузить апплет:</p>
<pre>kquitapp plasma-desktop && sleep 2 && plasma-desktop</pre>
{% highlight bash %}
kquitapp plasma-desktop && sleep 2 && plasma-desktop
{% endhighlight %}
<p align="justify">Также Вам может потребоваться запустить <code>kbuildsycoca4</code>, чтобы распознать <code>*.desktop</code> файл:</p>
<pre>kbuildsycoca4 &> /dev/null</pre></li>
{% highlight bash %}
kbuildsycoca4 &> /dev/null
{% endhighlight %}</li>
</ul>
<h3><a name="dependencies" class="anchor" href="#dependencies"><span class="octicon octicon-link"></span></a>Зависимости</h3>

View File

@ -38,21 +38,29 @@ links:
<ul>
<li><p align="justify">Скачайте <a href="https://github.com/arcan1s/pytextmonitor/releases">архив</a> с актуальной версией исходных файлов.</p></li>
<li><p align="justify">Извлеките из него файлы и установите DataEngine:</p>
<pre>cd /путь/к/извлеченным/файлам/
{% highlight bash %}
cd /путь/к/извлеченным/файлам/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` -DCMAKE_BUILD_TYPE=Release ../
make
make install</pre>
make install
{% endhighlight %}
<p align="justify">Для глобальной установки наберите:</p>
<pre>cd /путь/к/извлеченным/файлам/
{% highlight bash %}
cd /путь/к/извлеченным/файлам/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ../
make
sudo make install</pre></li>
sudo make install
{% endhighlight %}</li>
<li><p align="justify">Установите плазмоид:</p>
<pre>plasmapkg -i py-text-monitor-1.5.0.plasmoid</pre>
{% highlight bash %}
plasmapkg -i py-text-monitor-1.5.0.plasmoid
{% endhighlight %}
<p align="justify">Для глобальной установки наберите:</p>
<pre>sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid</pre></li>
{% highlight bash %}
sudo plasmapkg -g -i py-text-monitor-1.5.0.plasmoid
{% endhighlight %}</li>
</ul>
<h3><a name="dependencies" class="anchor" href="#dependencies"><span class="octicon octicon-link"></span></a>Зависимости</h3>

View File

@ -14,7 +14,8 @@ links:
<!-- info block -->
<h2><a name="info" class="anchor" href="#info"><span class="octicon octicon-link"></span></a>Информация</h2>
<p align="justify">Демон для запуска задач в очередь вычислений. Был создан, как proof-of-concept.</p>
<pre>$ 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</pre>
<pre>$ 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</pre>
-h --help - show this help and exit
{% endhighlight %}
<h3><a name="devel" class="anchor" href="#devel"><span class="octicon octicon-link"></span></a>Разработчики</h3>
<ul>
@ -52,9 +56,13 @@ Parameters:
<ul>
<li><p align="justify">Скачайте <a href="https://github.com/arcan1s/queued/releases">архив</a> с актуальной версией исходных файлов.</p></li>
<li><p align="justify">Извлеките из него файлы и установите приложение:</p>
<pre>./install.sh "/путь/к/корню/"</pre>
{% highlight bash %}
./install.sh "/путь/к/корню/"
{% endhighlight %}
<p align="justify">Если Вы хотите установить в <code>/</code>, Вы должны запустить это, как root:</p>
<pre>sudo ./install.sh</pre>
{% highlight bash %}
sudo ./install.sh
{% endhighlight %}
<p align="justify">Если путь не указан, пакет будет установлен в <code>/</code>.</p></li>
</ul>
@ -69,17 +77,29 @@ Parameters:
<!-- howto block -->
<h2><a name="howto" class="anchor" href="#howto"><span class="octicon octicon-link"></span></a>Использование</h2>
<p align="justify">Если Вы хотите запустить демон, просто запустите</p>
<pre>systemctl start queued</pre>
{% highlight bash %}
systemctl start queued
{% endhighlight %}
<p align="justify">Если Вы хотите включить автозагрузку демона, запутите</p>
<pre>systemctl enable queued</pre>
{% highlight bash %}
systemctl enable queued
{% endhighlight %}
<p align="justify">Но Вы можете изменить путь к конфигурационному файлу или изменить параметры. Для этого, скопируйте (рекомендуется) исходный конфигурационный файл</p>
<pre>cp /etc/queued.conf /новый/путь/к/queued.conf</pre>
{% highlight bash %}
cp /etc/queued.conf /новый/путь/к/queued.conf
{% endhighlight %}
<p align="justify">и отредактируйте его. Затем скопируйте исходный service-файл в <code>/etc</code>:</p>
<pre>cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service</pre>
{% highlight bash %}
cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service
{% endhighlight %}
<p align="justify">Замените следующую строку в этом файле:</p>
<pre>ExecStart=/usr/bin/queued</pre>
{% highlight bash %}
ExecStart=/usr/bin/queued
{% endhighlight %}
<p align="justify">на</p>
<pre>ExecStart=/usr/bin/queued -c /path/to/new/queued.conf</pre>
{% highlight bash %}
ExecStart=/usr/bin/queued -c /path/to/new/queued.conf
{% endhighlight %}
<h3><a name="adding" class="anchor" href="#adding"><span class="octicon octicon-link"></span></a>Добавление задачи</h3>
<ol>
@ -92,7 +112,9 @@ Parameters:
<h2><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Настройка</h2>
<p align="justify">Все настройки хранятся в <code>/etc/queued.conf</code>. После редактирования, Вы должны перезапустить демон</p>
<pre>systemctl restart queued</pre>
{% highlight bash %}
systemctl restart queued
{% endhighlight %}
<!-- end of howto block -->
<!-- config block -->