From 2ac09701184196244e3a58b3bc90ca1ad2438c53 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Sat, 22 Aug 2020 11:51:46 +0300 Subject: [PATCH] Move scripts into subdirectory --- Makefile | 8 +- README.md | 134 +++++++++---------- a2mp3 | 9 -- asroot | 18 --- axaudio | 77 ----------- bor | 9 -- calculator | 42 ------ currency | 38 ------ dada | 13 -- dates | 45 ------- defgroups | 49 ------- doctools2man | 15 --- dus | 38 ------ ext | 32 ----- fb2 | 325 ----------------------------------------------- fcheck | 16 --- fix-eselect | 6 - fontsel | 20 --- fsz | 3 - fucheck | 16 --- git-aliases | 42 ------ git-cblame | 17 --- git-forks | 26 ---- git-graphviz | 17 --- git-ignore | 43 ------- git-makeignore | 41 ------ git-recent | 71 ----------- git-top | 12 -- gitea-mirror | 92 -------------- gitlab-ci-graph | 57 --------- gitlab-ci-linter | 36 ------ hidecursor | 11 -- how | 35 ----- hr | 7 - ibor | 10 -- img50 | 9 -- imgRL | 9 -- imgRR | 9 -- imgview | 39 ------ lsi | 73 ----------- lsimage | 20 --- lsimg | 54 -------- mem | 23 ---- mptk | 58 --------- musca_status | 4 - nt | 20 --- passgen | 12 -- photosort | 21 --- pk | 14 -- pomodoro | 27 ---- poweroff-dialog | 25 ---- radio | 28 ---- renamepdfs | 39 ------ retag | 101 --------------- robodoc2html | 18 --- scripts/a2mp3 | 9 ++ scripts/asroot | 18 +++ scripts/axaudio | 77 +++++++++++ scripts/bor | 9 ++ scripts/calculator | 42 ++++++ scripts/currency | 38 ++++++ scripts/dada | 13 ++ scripts/dates | 45 +++++++ scripts/defgroups | 49 +++++++ scripts/doctools2man | 15 +++ scripts/dus | 38 ++++++ scripts/ext | 32 +++++ scripts/fb2 | 325 +++++++++++++++++++++++++++++++++++++++++++++++ scripts/fcheck | 16 +++ scripts/fix-eselect | 6 + scripts/fontsel | 20 +++ scripts/fsz | 3 + scripts/fucheck | 16 +++ scripts/git-aliases | 42 ++++++ scripts/git-cblame | 17 +++ scripts/git-forks | 26 ++++ scripts/git-graphviz | 17 +++ scripts/git-ignore | 43 +++++++ scripts/git-makeignore | 41 ++++++ scripts/git-recent | 71 +++++++++++ scripts/git-top | 12 ++ scripts/gitea-mirror | 92 ++++++++++++++ scripts/gitlab-ci-graph | 57 +++++++++ scripts/gitlab-ci-linter | 36 ++++++ scripts/hidecursor | 11 ++ scripts/how | 35 +++++ scripts/hr | 7 + scripts/ibor | 10 ++ scripts/img50 | 9 ++ scripts/imgRL | 9 ++ scripts/imgRR | 9 ++ scripts/imgview | 39 ++++++ scripts/lsi | 73 +++++++++++ scripts/lsimage | 20 +++ scripts/lsimg | 54 ++++++++ scripts/mem | 23 ++++ scripts/mptk | 58 +++++++++ scripts/musca_status | 4 + scripts/nt | 20 +++ scripts/passgen | 12 ++ scripts/photosort | 21 +++ scripts/pk | 14 ++ scripts/pomodoro | 27 ++++ scripts/poweroff-dialog | 25 ++++ scripts/radio | 28 ++++ scripts/renamepdfs | 39 ++++++ scripts/retag | 101 +++++++++++++++ scripts/robodoc2html | 18 +++ scripts/spread | 16 +++ scripts/sync-date | 6 + scripts/th | 13 ++ scripts/todolist | 14 ++ scripts/tree2md | 18 +++ scripts/use | 10 ++ scripts/utable | 157 +++++++++++++++++++++++ scripts/vandroucli | 91 +++++++++++++ scripts/vault-kv-tree | 71 +++++++++++ scripts/vcat | 13 ++ scripts/viper | 12 ++ scripts/vls | 18 +++ scripts/windows | 13 ++ scripts/writeup | 18 +++ scripts/www | 40 ++++++ scripts/x-open | 11 ++ scripts/xsmartlight | 85 +++++++++++++ scripts/xstab | 6 + spread | 16 --- sync-date | 6 - th | 13 -- todolist | 14 -- tree2md | 18 --- use | 10 -- utable | 157 ----------------------- vandroucli | 91 ------------- vault-kv-tree | 71 ----------- vcat | 13 -- viper | 12 -- vls | 18 --- windows | 13 -- writeup | 18 --- www | 40 ------ x-open | 11 -- xsmartlight | 85 ------------- xstab | 6 - 144 files changed, 2574 insertions(+), 2574 deletions(-) delete mode 100755 a2mp3 delete mode 100755 asroot delete mode 100755 axaudio delete mode 100755 bor delete mode 100755 calculator delete mode 100755 currency delete mode 100755 dada delete mode 100755 dates delete mode 100755 defgroups delete mode 100755 doctools2man delete mode 100755 dus delete mode 100755 ext delete mode 100755 fb2 delete mode 100755 fcheck delete mode 100755 fix-eselect delete mode 100755 fontsel delete mode 100755 fsz delete mode 100755 fucheck delete mode 100755 git-aliases delete mode 100755 git-cblame delete mode 100755 git-forks delete mode 100755 git-graphviz delete mode 100755 git-ignore delete mode 100755 git-makeignore delete mode 100755 git-recent delete mode 100755 git-top delete mode 100755 gitea-mirror delete mode 100755 gitlab-ci-graph delete mode 100755 gitlab-ci-linter delete mode 100755 hidecursor delete mode 100755 how delete mode 100755 hr delete mode 100755 ibor delete mode 100755 img50 delete mode 100755 imgRL delete mode 100755 imgRR delete mode 100755 imgview delete mode 100755 lsi delete mode 100755 lsimage delete mode 100755 lsimg delete mode 100755 mem delete mode 100755 mptk delete mode 100755 musca_status delete mode 100755 nt delete mode 100755 passgen delete mode 100755 photosort delete mode 100755 pk delete mode 100755 pomodoro delete mode 100755 poweroff-dialog delete mode 100755 radio delete mode 100755 renamepdfs delete mode 100755 retag delete mode 100755 robodoc2html create mode 100755 scripts/a2mp3 create mode 100755 scripts/asroot create mode 100755 scripts/axaudio create mode 100755 scripts/bor create mode 100755 scripts/calculator create mode 100755 scripts/currency create mode 100755 scripts/dada create mode 100755 scripts/dates create mode 100755 scripts/defgroups create mode 100755 scripts/doctools2man create mode 100755 scripts/dus create mode 100755 scripts/ext create mode 100755 scripts/fb2 create mode 100755 scripts/fcheck create mode 100755 scripts/fix-eselect create mode 100755 scripts/fontsel create mode 100755 scripts/fsz create mode 100755 scripts/fucheck create mode 100755 scripts/git-aliases create mode 100755 scripts/git-cblame create mode 100755 scripts/git-forks create mode 100755 scripts/git-graphviz create mode 100755 scripts/git-ignore create mode 100755 scripts/git-makeignore create mode 100755 scripts/git-recent create mode 100755 scripts/git-top create mode 100755 scripts/gitea-mirror create mode 100755 scripts/gitlab-ci-graph create mode 100755 scripts/gitlab-ci-linter create mode 100755 scripts/hidecursor create mode 100755 scripts/how create mode 100755 scripts/hr create mode 100755 scripts/ibor create mode 100755 scripts/img50 create mode 100755 scripts/imgRL create mode 100755 scripts/imgRR create mode 100755 scripts/imgview create mode 100755 scripts/lsi create mode 100755 scripts/lsimage create mode 100755 scripts/lsimg create mode 100755 scripts/mem create mode 100755 scripts/mptk create mode 100755 scripts/musca_status create mode 100755 scripts/nt create mode 100755 scripts/passgen create mode 100755 scripts/photosort create mode 100755 scripts/pk create mode 100755 scripts/pomodoro create mode 100755 scripts/poweroff-dialog create mode 100755 scripts/radio create mode 100755 scripts/renamepdfs create mode 100755 scripts/retag create mode 100755 scripts/robodoc2html create mode 100755 scripts/spread create mode 100755 scripts/sync-date create mode 100755 scripts/th create mode 100755 scripts/todolist create mode 100755 scripts/tree2md create mode 100755 scripts/use create mode 100755 scripts/utable create mode 100755 scripts/vandroucli create mode 100755 scripts/vault-kv-tree create mode 100755 scripts/vcat create mode 100755 scripts/viper create mode 100755 scripts/vls create mode 100755 scripts/windows create mode 100755 scripts/writeup create mode 100755 scripts/www create mode 100755 scripts/x-open create mode 100755 scripts/xsmartlight create mode 100755 scripts/xstab delete mode 100755 spread delete mode 100755 sync-date delete mode 100755 th delete mode 100755 todolist delete mode 100755 tree2md delete mode 100755 use delete mode 100755 utable delete mode 100755 vandroucli delete mode 100755 vault-kv-tree delete mode 100755 vcat delete mode 100755 viper delete mode 100755 vls delete mode 100755 windows delete mode 100755 writeup delete mode 100755 www delete mode 100755 x-open delete mode 100755 xsmartlight delete mode 100755 xstab diff --git a/Makefile b/Makefile index daae2c6..5d0f21d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +localpath = scripts path = ~/.shellrc/bin/scripts find := $(shell { command -v gfind || command -v find; } 2>&-) @@ -10,18 +11,17 @@ rmdir: @rmdir $(path) 2>&-; : install: mkdir - @$(find) . \ + @$(find) $(localpath) \ -maxdepth 1 \ -type f \ -executable \ - -exec basename {} \; \ | while read -r line; do \ - ln -s $$(realpath -- $$line) $(path)/$$line 2>&-; \ + ln -sv $$(realpath -- $$line) $(path)/$$(basename $$line) 2>&-; \ done; \ true rmlinks: - @$(find) . \ + @$(find) $(localpath) \ -maxdepth 1 \ -type f \ -executable \ diff --git a/README.md b/README.md index c50a1ba..5c5e761 100644 --- a/README.md +++ b/README.md @@ -19,101 +19,101 @@ will create the symbolic link for each script in the \ directory. ## Shell -- [dus](dus) shows the directories' sizes sorted in descending order (see also [dust](https://github.com/bootandy/dust)). -- [ext](ext) unpacks archives. -- [pk](pk) creates archives of various types. -- [fcheck](fcheck) marks a file as read. -- [fucheck](fucheck) marks a file as unred. -- [fontsel](fontsel) shows the available console fonts. -- [fsz](fsz) adjusts console font size. -- [hr](hr) displays horizontal rule with current time. -- [renamepdfs](renamepdfs) renames PDF files using their metadata. -- [vcat](vcat) displays file content with [syntax highlighting](https://www.gnu.org/software/src-highlite/) (see also [bat](https://github.com/sharkdp/bat)). -- [viper](viper) is a simple alternative to viper from [moreutils](https://joeyh.name/code/moreutils/) package which can be used with custom vim parameters. +- [dus](scripts/dus) shows the directories' sizes sorted in descending order (see also [dust](https://github.com/bootandy/dust)). +- [ext](scripts/ext) unpacks archives. +- [pk](scripts/pk) creates archives of various types. +- [fcheck](scripts/fcheck) marks a file as read. +- [fucheck](scripts/fucheck) marks a file as unred. +- [fontsel](scripts/fontsel) shows the available console fonts. +- [fsz](scripts/fsz) adjusts console font size. +- [hr](scripts/hr) displays horizontal rule with current time. +- [renamepdfs](scripts/renamepdfs) renames PDF files using their metadata. +- [vcat](scripts/vcat) displays file content with [syntax highlighting](https://www.gnu.org/software/src-highlite/) (see also [bat](https://github.com/sharkdp/bat)). +- [viper](scripts/viper) is a simple alternative to viper from [moreutils](https://joeyh.name/code/moreutils/) package which can be used with custom vim parameters. ## Audio -- [a2mp3](a2mp3) converts wav audio files to mp3 format. -- [axaudio](axaudio) gets an information and audio stream from Axia Livewire network. -- [mptk](mptk) allows to control mpd via mpc and store song's rating into id3v2 commentary tag. -- [retag](retag) writes id3 tags based on file path. -- [radio](radio) plays the internet radio stations from a list stored in the file. -- [vls](vls) runs vlc-ncurses with increased speed. +- [a2mp3](scripts/a2mp3) converts wav audio files to mp3 format. +- [axaudio](scripts/axaudio) gets an information and audio stream from Axia Livewire network. +- [mptk](scripts/mptk) allows to control mpd via mpc and store song's rating into id3v2 commentary tag. +- [retag](scripts/retag) writes id3 tags based on file path. +- [radio](scripts/radio) plays the internet radio stations from a list stored in the file. +- [vls](scripts/vls) runs vlc-ncurses with increased speed. ## Texts -- [dada](dada) creates random 'verse' from the text. -- [fb2](fb2) opens fb2 files in w3m browser. -- [nt](nt) displays New Testament texts in two languages line by line. -- [spread](spread) opens file in [speedread](https://github.com/pasky/speedread) program via terminal emulator with custom settings. -- [tree2md](tree2md) creates markdown list and links of directory tree. -- [writeup](writeup) opens distracted-free Vim editor with custom color scheme, fonts and plug-ins. +- [dada](scripts/dada) creates random 'verse' from the text. +- [fb2](scripts/fb2) opens fb2 files in w3m browser. +- [nt](scripts/nt) displays New Testament texts in two languages line by line. +- [spread](scripts/spread) opens file in [speedread](https://github.com/pasky/speedread) program via terminal emulator with custom settings. +- [tree2md](scripts/tree2md) creates markdown list and links of directory tree. +- [writeup](scripts/writeup) opens distracted-free Vim editor with custom color scheme, fonts and plug-ins. ## Images -- [img50](img50) resizes an image by half. -- [imgRL](imgRL) rotates an image to the left. -- [imgRR](imgRR) rotates an image to the right. -- [imgview](imgview), [lsi](lsi), [lsimage](lsimage) and [lsimg](lsimg) display images in a terminal emulator. -- [photosort](photosort) renames the image files by exif data. -- [th](th) makes an image thumbnail. +- [img50](scripts/img50) resizes an image by half. +- [imgRL](scripts/imgRL) rotates an image to the left. +- [imgRR](scripts/imgRR) rotates an image to the right. +- [imgview](scripts/imgview), [lsi](scripts/lsi), [lsimage](scripts/lsimage) and [lsimg](scripts/lsimg) display images in a terminal emulator. +- [photosort](scripts/photosort) renames the image files by exif data. +- [th](scripts/th) makes an image thumbnail. ## Notes -- [dates](dates) + conky or similar software remind of upcoming events (birthdays, etc.). -- [mem](mem) stores the shorts notes in the file. -- [pomodoro](pomodoro) tracks the working time. +- [dates](scripts/dates) + conky or similar software remind of upcoming events (birthdays, etc.). +- [mem](scripts/mem) stores the shorts notes in the file. +- [pomodoro](scripts/pomodoro) tracks the working time. ## WWW -- [bor](bor) displays the latest posts from [bash.im](https://bash.im) website. -- [ibor](ibor) displays the latest posts from [ibash.im](https://ibash.im) website. -- [vandroucli](vandroucli) retrieves the newest posts from the vandrouki websites ([ru](https://vandrouki.ru), [by](https://vandrouki.by), [asia](https://vandrouki.asia)). +- [bor](scripts/bor) displays the latest posts from [bash.im](https://bash.im) website. +- [ibor](scripts/ibor) displays the latest posts from [ibash.im](https://ibash.im) website. +- [vandroucli](scripts/vandroucli) retrieves the newest posts from the vandrouki websites ([ru](https://vandrouki.ru), [by](https://vandrouki.by), [asia](https://vandrouki.asia)). ## System -- [defgroups](defgroups) adds a user to default system groups. -- [passgen](passgen) creates the strong passwords. -- [sync-date](sync-date) sets system time according to Google. -- [xsmartlight](xsmartlight) allows to adjust ASUS smartscreen's brightness. -- [use](use) shows Gentoo USE flag's description. +- [defgroups](scripts/defgroups) adds a user to default system groups. +- [passgen](scripts/passgen) creates the strong passwords. +- [sync-date](scripts/sync-date) sets system time according to Google. +- [xsmartlight](scripts/xsmartlight) allows to adjust ASUS smartscreen's brightness. +- [use](scripts/use) shows Gentoo USE flag's description. ## Development tools -- [doctools2man](doctools2man) converts doctool to man pages. -- [gitea-mirror](gitea-mirror) mirrors Gitea repositories. -- [gitlab-ci-graph](gitlab-ci-graph) draws a graph of the GitLab CI Pipeline file. -- [gitlab-ci-linter](gitlab-ci-linter) checks Gitlab CI Pipeline syntax via GitLab API. -- [how](how) shows dev cheat sheets using [cheat.sh](https://cheat.sh). -- [robodoc2html](robodoc2html) converts a documentation in the robodoc format into html. -- [todolist](todolist) shows all `TODO` notes in current git repository. -- [vault-kv-tree](vault-kv-tree) shows all HashiCorp Vault's paths and keys recursively. -- [utable](utable) shows a Unicode table. +- [doctools2man](scripts/doctools2man) converts doctool to man pages. +- [gitea-mirror](scripts/gitea-mirror) mirrors Gitea repositories. +- [gitlab-ci-graph](scripts/gitlab-ci-graph) draws a graph of the GitLab CI Pipeline file. +- [gitlab-ci-linter](scripts/gitlab-ci-linter) checks Gitlab CI Pipeline syntax via GitLab API. +- [how](scripts/how) shows dev cheat sheets using [cheat.sh](https://cheat.sh). +- [robodoc2html](scripts/robodoc2html) converts a documentation in the robodoc format into html. +- [todolist](scripts/todolist) shows all `TODO` notes in current git repository. +- [vault-kv-tree](scripts/vault-kv-tree) shows all HashiCorp Vault's paths and keys recursively. +- [utable](scripts/utable) shows a Unicode table. ### Git -- [git-aliases](git-aliases) shows a commented list of all git aliases. -- [git-cblame](git-cblame) adds a syntax highlighting to the standard `git blame` command. -- [git-forks](git-forks) shows the latest forks of github repository. -- [git-graphviz](git-graphviz) creates dot-graph of a git repository. -- [git-ignore](git-ignore) gets specified gitignore settings from [https://gitignore.io/](https://gitignore.io/) website. -- [git-makeignore](git-makeignore) stores files with '+GITIGNORE' marks into .gitignore file. -- [git-recent](git-recent) lists all local branches, sorted by last commit. (c) https://github.com/paulirish/git-recent -- [git-top](git-top) shows the most edited files in current git repository. +- [git-aliases](scripts/git-aliases) shows a commented list of all git aliases. +- [git-cblame](scripts/git-cblame) adds a syntax highlighting to the standard `git blame` command. +- [git-forks](scripts/git-forks) shows the latest forks of github repository. +- [git-graphviz](scripts/git-graphviz) creates dot-graph of a git repository. +- [git-ignore](scripts/git-ignore) gets specified gitignore settings from [https://gitignore.io/](https://gitignore.io/) website. +- [git-makeignore](scripts/git-makeignore) stores files with '+GITIGNORE' marks into .gitignore file. +- [git-recent](scripts/git-recent) lists all local branches, sorted by last commit. (c) https://github.com/paulirish/git-recent +- [git-top](scripts/git-top) shows the most edited files in current git repository. ## WM -- [calculator](calculator) computes mathematical expressions with variables and intermediate values. -- [fix-eselect](fix-eselect) adjusts 'type' command in gentoo's eselect scripts. -- [hidecursor](hidecursor) moves cursor to upper right screen angle. -- [musca_status](musca_status) shows a list of all musca's workspaces. -- [poweroff-dialog](poweroff-dialog) and [asroot](asroot) provide a menu with 'shutdown', 'reboot' and 'suspend' commands. -- [windows](windows) shows a list of the all opened windows. -- [www](www) opens rofi menu with the most used www-links. -- [x-open](x-open) opens files via xdg-open (on Linux systems) or via open command (on MacOS). -- [xstab](xstab) runs [st](https://st.suckless.org/) terminal with the [tabbed](https://tools.suckless.org/tabbed/). +- [calculator](scripts/calculator) computes mathematical expressions with variables and intermediate values. +- [fix-eselect](scripts/fix-eselect) adjusts 'type' command in gentoo's eselect scripts. +- [hidecursor](scripts/hidecursor) moves cursor to upper right screen angle. +- [musca_status](scripts/musca_status) shows a list of all musca's workspaces. +- [poweroff-dialog](scripts/poweroff-dialog) and [asroot](scripts/asroot) provide a menu with 'shutdown', 'reboot' and 'suspend' commands. +- [windows](scripts/windows) shows a list of the all opened windows. +- [www](scripts/www) opens rofi menu with the most used www-links. +- [x-open](scripts/x-open) opens files via xdg-open (on Linux systems) or via open command (on MacOS). +- [xstab](scripts/xstab) runs [st](https://st.suckless.org/) terminal with the [tabbed](https://tools.suckless.org/tabbed/). ## Other -- [currency](currency) shows the currency rate. +- [currency](scripts/currency) shows the currency rate. diff --git a/a2mp3 b/a2mp3 deleted file mode 100755 index 4de6e0a..0000000 --- a/a2mp3 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:37:48 -#Изменён: Пт 26 фев 2016 21:38:22 - -#- Конвертирование аудио в mp3 - -lame -b ${2:-320} --noreplaygain -q 0 -m s -k -p "$1"; - diff --git a/asroot b/asroot deleted file mode 100755 index 0596f4c..0000000 --- a/asroot +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env tclsh - -# Выполнение команды с правами администратора -# Используется с dmenu -# asroot - -package require Expect - -proc execCommand {command password} { - spawn bash - exp_send "su -c \"$command\"\n" - expect -nocase "password: " - exp_send "$password\n" - expect eof -} - -execCommand [lindex $argv 0] [lindex $argv 1] - diff --git a/axaudio b/axaudio deleted file mode 100755 index 4c21438..0000000 --- a/axaudio +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2019, Maxim Lihachev, -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation, version 3. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program. If not, see . -# - -# -# Получение информации и аудиопотока в сети Axia Livewire -# -# Пример обработки полученных данных при помощи ffmpeg: -# -# | ffmpeg -ac 2 -ar 48000 -f s24be -i pipe:0 -# - -# Сценарий принимает адрес Axia Livewire в формате IP/Channel, -# при этом IP-адрес может отсутствовать -if [ $# -ne 2 ]; then - echo "USAGE: $0 [--info|--dump] " - exit 1 -fi - -# Перевод чисел в 16-ричную систему счисления -hex() { - printf '%02X' "$@" -} - -# Программа -PROGRAMME="$2" - -# IP-адрес Axia Livewire. -IP="$(echo $PROGRAMME | grep -o '.*\/' | tr '/' ' ')" - -# По умолчанию используется базовый адрес 239.192.0.0 -ADDRESS="${IP:-239.192.0.0}" - -# Канал -CHANNEL="${PROGRAMME/*\/}" - -# Команда получения сигнала в сети Axia Livewire -CMD="rtpdump -F payload" - -BROADCAST="0x$(hex $[0x$(hex ${ADDRESS//./ })+$CHANNEL])/5004" -HEXADDR="$(hex $[0x$(hex ${ADDRESS//./ })+$CHANNEL])" - -IPADDR=$(printf "%d." $( - echo $HEXADDR | sed 's/../0x& /g' | tr ' ' '\n' -) | sed 's/\.$/\n/') - -################# - -if [ "$1" == "--info" ]; then - # Информация об источнике - echo "Axia Livewire :: IP: $IPADDR, SOURCE: $CHANNEL, BROADCAST: $BROADCAST" -else - # Прекращение работы, если нет последующего конвеера, - # т.к. выводить дамп аудиопотока в stdout не имеет смысла. - if [ -t 1 ]; then - echo "A pipe (f.e. to ffmpeg) isn't exists. Terminated." - exit 1 - else - # Дамп - $CMD $BROADCAST - fi -fi - diff --git a/bor b/bor deleted file mode 100755 index cd25169..0000000 --- a/bor +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#- Чтение цитат с bash.org.ru -curl -s https://bash.im/rss/ | \ -sed 's/<\/description>//g; s/
/\n/g; s/\</>> /g; - s/\>/:/g; s/\"/"/g; s/\s*<.*$\|\s*xmlns:.*$//g;' | \ -grep . | less - diff --git a/calculator b/calculator deleted file mode 100755 index 65b3546..0000000 --- a/calculator +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -#TODO: EUR -> RUB - -vars=( $(echo {a..z}) ) -count=-1 -prompt=' ' -mesg="" -# menu=dmenu -menu="rofi -dmenu" - -while eqn=$(echo | rofi -dmenu -lines 0 -theme Monokai -mesg "$mesg" -p "$prompt  "); do - [[ $eqn ]] || exit - - echo $eqn | grep '#' - - if [ "$?" == 0 ]; then - comment="#$(echo $eqn | cut -d '#' -f 2-)" - else - comment="" - fi - - # if ans=$(calc -pd “$(eval echo $(echo $eqn | sed ‘s/([a-z])/$\1/g’))”); then - exp=$(eval echo $(echo \"$eqn\" | sed 's/#.*"/"/; s/\([a-z]\)/$\1/g')) - - echo = $exp - - if ans=$(echo "$exp" | bc -l); then - echo -n $ans | xclip - count=$(( $count + 1 )) - - [[ $count -gt 25 ]] && count=0 - - eval ${vars[$count]}=$ans - - # prompt="$prompt  $(eval echo ${vars[$count]}=$ans)" - # mesg=$(echo "$mesg\n  ${vars[$count]}  $exp  $ans \t $comment") - # printf "%50s\n" "This field is 50 characters wide..." - mesg=$(printf "$mesg\n  %s  %-10s  %-10s %s" ${vars[$count]} $exp $ans $comment) - fi -done - diff --git a/currency b/currency deleted file mode 100755 index 3d33846..0000000 --- a/currency +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# -# Simple currency converter -# - -SHORT_OUTPUT=false - -exchange() { - local api_url="https://api.exchangeratesapi.io/latest?base=${1^^}&symbols=${2^^}" - - curl -s -q -L "$api_url" \ - | jq -r --arg short "$SHORT_OUTPUT" ' - def round: - .*100.0 + 0.5 | floor / 100.0; - - if ($short == "true") then - .rates | to_entries | .[] | (.value | round | tostring) - else - "1 " + .base + " ≈ " - + (.rates | to_entries | .[] | (.value | round | tostring) + " " + .key) - end - ' -} - -if [ $# -le 1 ]; then - echo "USAGE: $(basename "$0") ?-s? FROM TO1,TO2,...,TOn" - echo " e.g: $(basename "$0") ?-s? USD EUR,RUB" - echo "Set -s to show only value." -else - if [ "$1" == "-s" ]; then - SHORT_OUTPUT=true - shift - fi - - exchange "$@" -fi - diff --git a/dada b/dada deleted file mode 100755 index 1e731b5..0000000 --- a/dada +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -#Создан: Ср 18 май 2016 14:53:34 -#Изменён: чт 17 окт 2019 13:01:07 - -#Дадаизатор текстов - -tr ' ' '\n' <"$1" \ - | grep -o -E '[а-яА-Яa-zA-Z]+' \ - | shuf \ - | head -n "${2:-500}" \ - | fmt -w "${3:-80}" - diff --git a/dates b/dates deleted file mode 100755 index cd8054d..0000000 --- a/dates +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -#Создан: Чт 06 Май 2010 02:44:00 -#Изменён: Вс 23 фев 2020 13:27:43 - -# Скрипт напоминания о датах -# -# Формат файла DATAFILE: -# -# = Январь = -# -# * *01/01* - Событие 1 -# -# = Февраль = -# -# * *02/02* - Событие 2 -# * *03/02* - Событие 3 - -#Файл с данными -DATAFILE="$SHELLRC/vimwiki/wiki/ЖЖ/Даты и события/dates.wiki" -#За сколько дней оповещать -DAYS=3 -#Сегодняшнее число -TODAY=$(\date +%s --date=$(\date '+%m/%d')) -#Количество найденных событий -FOUND=0 - -dates() { - echo -e "${green}Ближайшие даты:${rstc}" - - #Поиск дат в базе данных - for i in $(seq 0 $DAYS); do - DATE=$(\date -d "UTC 1970-01-01 $(($TODAY + 86400*$i)) secs" '+%d/%m') - grep -v '#.*' "$DATAFILE" | grep $DATE && ((FOUND++)) - done; - - #Код возврата. 1 - не найдено дат. - [ $FOUND -eq 0 ] && echo "-" && exit 1 || exit 0 -} - -case "$1" in - -all) cat "$DATAFILE";; - *) dates;; -esac - diff --git a/defgroups b/defgroups deleted file mode 100755 index c1368ab..0000000 --- a/defgroups +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env guile -!# - -;;;Создан: Сб 10 июл 2010 19:29:10 -;;;Изменён: Вс 21 июл 2010 01:40:25 - -;;; -;;; Скрипт составления команды UNIX Shell для добавления пользователя в группы. -;;; Группы добавляются к уже имеющимся. -;;; -;;; (c) 2010, Maxim Lihachev, -;;; - -;;Стандартные группы для пользователей -(define default-groups (list "plugdev" "audio" "video" "cdrom" "scanner" "users")) - -;;Получение первого элемента вектора -(define (vector-car vector) (vector-ref vector 0)) - -;;Получение списка существующих групп -(define (get-all-groups) - (do ( (group (getgr) (getgr)) - (groups '() (append groups (list group)))) - ((not (vector? group)) groups))) - -;;Получение списка групп, в которые входит данный пользователь -(define (get-old-groups user groups) - (map vector-car (filter (lambda (g) (member user (group:mem g))) groups))) - -;;Получение списка групп, в которые должен входить пользователь -(define (get-new-groups groups) - (filter (lambda (x) (not (member x groups))) default-groups)) - -;;Создание команды оболочки для добавления пользователя в группы -(define (make-command user groups) - (format #f "usermod -G ~A ~A\n" (string-join groups ",") user)) - -;;;----------------------------------------------------------------------------- -;;Формирование команд оболочки -(let* ( (all-groups (get-all-groups)) - (users (if (< 1 (length (command-line))) - (cdr (command-line)) - (list (cuserid)))) - (get-command (lambda (user) - (let* ( (oldg (get-old-groups user all-groups)) - (newg (get-new-groups oldg))) - (display (make-command user (append oldg newg))))))) - (for-each get-command users)) - diff --git a/doctools2man b/doctools2man deleted file mode 100755 index c0ecc18..0000000 --- a/doctools2man +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tclsh - -#Создан: Сбт 09 Июл 2011 00:22:26 -#Изменён: Сбт 09 Июл 2011 01:32:08 - -package require doctools -package require fileutil - -# USAGE -lassign $argv format file out - -::doctools::new mydtp -format $format - -fileutil::writeFile -encoding koi8-r $out [mydtp format [fileutil::cat $file]] - diff --git a/dus b/dus deleted file mode 100755 index 2ef0b6c..0000000 --- a/dus +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:32:55 -#Изменён: Вс 02 авг 2020 14:33:02 - -#- Вывод размера файлов в отсортированном виде - -rstc="\033[00m" - -\du -sh -c -- "$@" | sort -rh | awk ' - BEGIN { - blue="\033[1;36m" - green="\033[1;32m" - red="\033[1;31m" - yellow="\033[1;33m" - } - - /^[0-9,]+G/ { printf("%s%10s",red,$1); } - - /^[0-9,]+M/ { - mb=$1 - sub("M","",mb) - - if (int(mb) > 500) { - printf("%s%10s",yellow,$1) - } else { - printf("%s%10s",green,$1) - } - } - - /^[0-9,]+K/ { printf("%s%10s",blue,$1); } - /^0/ { printf("%s%10s",blue,$1); } - - sub($1,"") -' - -echo -e -n "$rstc" - diff --git a/ext b/ext deleted file mode 100755 index 1d8ba70..0000000 --- a/ext +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -#- Распаковка архивов -ext() { - [ -f "$1" ]; { - case "$1" in - *.tar.bz2) tar xjf "$1";; - *.tar.gz) tar xzf "$1";; - *.tar.Z) tar xzf "$1";; - *.txz) tar xJf "$1";; - *.xz) tar xJf "$1";; - *.bz2) bunzip2 "$1";; - *.rar) unrar x "$1";; - *.gz) gunzip "$1";; - *.jar) unzip "$1";; - *.tar) tar xf "$1";; - *.tbz2) tar xjf "$1";; - *.tgz) tar xzf "$1";; - *.zip) unzip "$1";; - *.Z) uncompress "$1";; - *.7z) 7z x "$1";; - *.7za) 7z x "$1";; - *.iso) 7z x "$1";; - *.deb) ar x "$1";; - *) echo -e \ - ""$green"<${1:-"-"}>: Неизвестный формат архива";; - esac - } -} - -ext "$*" - diff --git a/fb2 b/fb2 deleted file mode 100755 index 5d45da3..0000000 --- a/fb2 +++ /dev/null @@ -1,325 +0,0 @@ -#!/bin/bash - -#Чтение fb2 в консоли - -case ${1:0-3} in - zip) TEXT=$(zcat "$1");; - fb2) TEXT=$(cat "$1");; - *) echo "Неизвестный формат файла"; exit 1;; -esac - -FB2=`cat < - - - - - - - - - - <xsl:value-of select="fb:description/fb:title-info/fb:book-title"/> - - - - - -
- -
-
-
- -
    - -
-
- - - -
-
- -

- -

-
- - -
- - -
- - - - - - - -
-
- - -
  • - - - , # - - - -
      - - - -
    -
    - - - - - - - - - -
  • - - -
    -
    -
  • - - -
    - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    -
    - - -
    -
    - - - - - - - -
    - -
    -
    - - -
    - - - -    
    -
    - - - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Annotation

    - -
    - - -
    - - - - - - -
    -
    - - -
    - -
    -
    - - -
    - - - - - - -
    -
    - - -
    -
    -
    - - - - -     -
    -
    - -     -
    -
    -
    -
    - - -
    - - - - - - -
    -
    - - - - -
    -
    - - - - - - - -
    -
    - - -
    - - - - - - - - - - -
    -
    - - -FB2RULES` - -# echo $TEXT | xsltproc <(echo $FB2) - | lynx -stdin -display_charset=UTF-8 -echo $TEXT | xsltproc <(echo $FB2) - | w3m -T text/html - diff --git a/fcheck b/fcheck deleted file mode 100755 index 7b15743..0000000 --- a/fcheck +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:39:40 -#Изменён: Пт 26 фев 2016 21:39:40 - -#- file -> [X] file - -for i in "$@"; { - if [[ ! "$i" =~ \[X\]\ .* ]]; then - echo -n $i - echo -ne '\000' - echo -n $(echo $(basename "$i") | sed 's/^\[ \] \|^/[X] /') - echo -ne '\000' - fi -} | xargs -0 -n2 mv -v - diff --git a/fix-eselect b/fix-eselect deleted file mode 100755 index 953aa6e..0000000 --- a/fix-eselect +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -#Gentoo: fix eselect / type alias - -sed -i 's/type -t/command type -t/' /usr/share/eselect/libs/tests.bash - diff --git a/fontsel b/fontsel deleted file mode 100755 index a65be29..0000000 --- a/fontsel +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -#Создан: Вт 02 авг 2016 20:58:05 -#Изменён: Ср 11 апр 2018 15:04:53 - -#Выбор шрифта в эмуляторе терминала - -COUNT=$(fc-list | cut -d ':' -f 2 | sort -u | wc -l) -i=0 - -while read FONT; do - ((i++)) - echo "## ${i}/${COUNT}: $FONT " - fsz 16 "$FONT" - echo ' :dir:/, :exe:, :reg:, :link:' - read -p "Применить? [y/n] " y &- - diff --git a/fsz b/fsz deleted file mode 100755 index 222c02f..0000000 --- a/fsz +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -printf '\33]50;%s' "xft:${2:-DejaVU Sans Mono}:pixelsize=${1:-16}" diff --git a/fucheck b/fucheck deleted file mode 100755 index 23ea83e..0000000 --- a/fucheck +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:39:58 -#Изменён: Пт 26 фев 2016 21:39:58 - -#- file -> [ ] file - -for i in "$@"; { - if [[ ! "$i" =~ \[.\]\ .* ]]; then - echo -n $i - echo -ne '\000' - echo -n "[ ] $i" - echo -ne '\000' - fi -} | xargs -0 -n2 mv -v - diff --git a/git-aliases b/git-aliases deleted file mode 100755 index 441aa67..0000000 --- a/git-aliases +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -#Создан: чт 14 ноя 2019 14:03:43 -#Изменён: Сб 29 фев 2020 02:48:48 - -# Список псевдонимов git - -# -# Формат: -# -# # Комментарий -# name = function -# -# Игнорирование в выводе: -# -# # noindex Комментарий -# или -# name = function #noindex -# - -green="\033[1;32m" -rstc="\033[00m" - -GITCONFIG=~/.gitconfig - -GIT_ALIASES=$(git config --get-regexp 'alias.*' | sed 's/alias.//' | sed 's/ .*//' | sort) - -while read -r alias; do - line=$(\grep -n -E "^\s*${alias}\s+" "$GITCONFIG") - - number=${line/:*} - full_alias=${line/*:} - - name=$(sed "s/^[[:space:]]*//; s/=.*$//g; ${number}q;d" $GITCONFIG) - - commentary=$(sed "s/[[:space:]]*# //; $((--number))q;d" $GITCONFIG) - - if [[ ! "$full_alias" =~ "noindex" ]] && [[ ! "$commentary" =~ "noindex" ]]; then - printf " • ${green}%-15s${rstc}- %s\n" "$name" "$commentary" - fi -done <<<"$GIT_ALIASES" - diff --git a/git-cblame b/git-cblame deleted file mode 100755 index b837a20..0000000 --- a/git-cblame +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Blame с подсветкой синтаксиса - -vcat() { - BAT_CONFIG_PATH="$SHELLRC/etc/soft/bat/bat.conf" bat --decorations never "$1" -} - -clr() { - sed -e "s/$1/$(echo -e "\033")[7;32m&$(echo -e "\033")[1;0m/g" -} - -paste -d ' ' \ - <(git blame "$1" | cut -d ')' -f 1 | sed 's/(//' | clr "0\+.*Not Committed Yet.*") \ - <(vcat "$1") \ -| less -R - diff --git a/git-forks b/git-forks deleted file mode 100755 index 9d141a8..0000000 --- a/git-forks +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -#Создан: вт 15 окт 2019 11:15:12 -#Изменён: чт 14 ноя 2019 17:35:25 - -# Список форков репозитория на github.com, -# отсортированный на основе времени последних изменений - -API="https://api.github.com/repos/" - -last_forks() { - curl -sq "${API}${1}/forks?sort=stargazers&per_page=100" \ - | jq -r '.[] | "\(.updated_at) \(.full_name)"' 2>&- \ - | sed "s|^| |; s|T| |; s|Z | https://github.com/|" \ - | sort -r \ - | head -n "$2" -} - -if [ -z "$1" ]; then - repository=$(git url | grep github.com | sed -e 's|^.*github.com/||' | sed 's/.git.*$//') -else - repository="$1" -fi - -last_forks "$repository" "${2:-15}" - diff --git a/git-graphviz b/git-graphviz deleted file mode 100755 index f617d53..0000000 --- a/git-graphviz +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Создание графа коммитов git-репозитория - -# This produces output that can be displayed using dotty, for example: -# $ git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin -# $ git graphviz --first-parent master | dotty /dev/stdin -# Note how defining a function eliminates the need to use sh -c. - -make_graphviz() { - echo 'digraph git {' - git log --pretty='format: %h -> { %p }' "$@" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' - echo '}' -} - -make_graphviz "$@" - diff --git a/git-ignore b/git-ignore deleted file mode 100755 index f4bbad1..0000000 --- a/git-ignore +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Получение шаблона gitignore с сайта gitignore.io - -ROOT=$(git root 2>&-) - -TYPES=() - -while [[ $# -gt 0 ]]; do - key="$1" - - case $key in - -w|--write) - WRITE=1 - shift - ;; - *) - TYPES+=("$1") - shift - ;; - esac -done - -set -- "${TYPES[@]}" - -if [ "${#TYPES[@]}" -gt 0 ]; then - for t in "${TYPES[@]}"; do - if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then - echo "# $t" - curl -sq -L "https://gitignore.io/api/${t}" >> "$(git root)/.gitignore" - else - curl -sq -L "https://gitignore.io/api/${t}" - fi - done - - if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then - echo "Ignoring list saved to ${ROOT}/.gitignore file." - fi -else - echo "USAGE: $(basename "$0") [-w/--write] type1 type2 [...]" - exit 1 -fi - diff --git a/git-makeignore b/git-makeignore deleted file mode 100755 index 471d7ea..0000000 --- a/git-makeignore +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -#Создан: Вс 25 авг 2013 19:40:12 -#Изменён: Сб 22 мар 2014 12:02:37 - -# Добавление файлов с меткой +GITIGNORE в исключения .git - -# Создание копии файлов с меткой +GITIGNORE +SAMPLE -make_sample() { - \grep -E '^.{1,5}\+GITIGNORE \+SAMPLE' "$1" 2>&- > /dev/null && \ - if [ ! -f "${1/.sample/}.sample" ]; then - cp -iv $1 $1.sample - sed -i 's/\+GITIGNORE.\+SAMPLE/+SAMPLE/' $1.sample - fi -} - -# Метка должна располагаться не далее пятой колонки -\grep -E '^.{1,5}\+GITIGNORE' -R --exclude-dir=var 2>&- > /tmp/gitignore.$$ - -if [ -f ".gitignore" ]; then - while read line; do - echo "COPY:" "$line" - make_sample "$line" - sed -i "/${line//\//.}/d" /tmp/gitignore.$$ 2> /dev/null - done < .gitignore -fi - -if [ -f "/tmp/gitignore.$$" ]; then - while read line; do - make_sample "${line/:*/}" - done < /tmp/gitignore.$$ -fi - -echo "\n# [ $(\date +%d.%m.%Y) ]\n" >> .gitignore - -cut -d ':' -f 1 /tmp/gitignore.$$ | sort -u >> .gitignore - -echo >> .gitignore - -\rm /tmp/gitignore.$$ - diff --git a/git-recent b/git-recent deleted file mode 100755 index 00e0b5d..0000000 --- a/git-recent +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -## -## -## git-recent (c) https://github.com/paulirish/git-recent -## -## MIT License -## -## Copyright (c) 2017 Paul Irish -## -## list all local branches, sorted by last commit, formatted reall purdy -## - -# Windows needs more basic format (#8, git-for-windows/git#865) -case $(uname -s) in - CYGWIN*|MINGW*|MSYS*) - branch='%(refname:short)' - spacer=' ' - ;; - *) - branch='%(color:yellow)%(refname:short)%(color:reset)' - spacer='%(color:black) %(color:reset)' - ;; -esac - -COUNT=0 -while getopts "n:" opt; do - case ${opt} in - n ) - if ! [[ $OPTARG =~ ^[0-9]{1,}$ ]]; then - echo "-n should be an integer." - exit 1 - fi - COUNT=${OPTARG} - shift - ;; - esac -done -shift $((OPTIND-1)) - -format="\ -%(HEAD) \ -$branch|\ -%(color:bold red)%(objectname:short)%(color:reset) \ -%(color:bold green)(%(committerdate:relative))%(color:reset) \ -%(color:bold blue)%(authorname)%(color:reset) \ -%(color:yellow)%(upstream:track)%(color:reset) -$spacer|\ -%(contents:subject) -$spacer|" - -lessopts="--tabs=4 --quit-if-one-screen --RAW-CONTROL-CHARS --no-init" - -git for-each-ref \ - --color=always \ - --count=$COUNT \ - --sort=-committerdate \ - "refs/heads/" \ - --format="$format" \ - | column -ts '|' \ - | less "$lessopts" - -# The above command: -# for all known branches, -# (force coloring on this, especially since it's being piped) -# optionally, specify the number of branches you want to display -# sort descending by last commit -# show local branches (change to "" to include both local + remote branches) -# apply the formatting template above -# break into columns -# use the pager only if there's not enough space diff --git a/git-top b/git-top deleted file mode 100755 index 1af6569..0000000 --- a/git-top +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Наиболее часто изменяемые файлы git-репозитория - -git log --all -M -C --name-only --format='format:' "$@" \ - | grep . \ - | sort \ - | uniq -c \ - | sort -rn \ - | head -n 20 \ - | sed -e 's/^ //' - diff --git a/gitea-mirror b/gitea-mirror deleted file mode 100755 index 53a49c9..0000000 --- a/gitea-mirror +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -# Gitea repositories mirrorer - -rstc="\033[00m" -yellow="\033[1;33m" -blue="\033[1;36m" -red="\033[1;31m" - -show_help() { - echo -e "$(basename "$0") can be used to mirror all git repositories hosted on Gitea.\n" - echo -e "USAGE: $(basename "$0") -u USER -g GIT_URL ?-d DIR?\n" - - echo -e "Command line arguments:" - echo -e " -h --help show this help" - echo -e " -f --force drop all existing local changes" - echo -e " -u --user user name" - echo -e " -g --git git url" - echo -e " -p --private comma separated private repositories" - echo -e " -d --dir directory for storing files (current working directory by default)" - - echo - exit "${1:-0}" -} - -die() { - echo -e "${red}ERROR:${rstc} $*\n" - - show_help 1 -} - -git_update() { - pushd "$1" >/dev/null - - [ -n "$FORCE" ] && git checkout . 2>&- - - git fetch - git pull --all - - popd >/dev/null -} - -#------------------------------------------------------------------------------- - -UNKNOWN_ARGS=() - -[ $# -eq 0 ] && show_help - -while [[ $# -gt 0 ]]; do - key="$1" - - case $key in - -h|--help) show_help;; - -d|--dir) DIRECTORY="$2"; shift; shift;; - -u|--user) USERNAME="$2"; shift; shift;; - -g|--git) GIT_URL="$2"; shift; shift;; - -p|--private) PRIVATE="$2"; shift; shift;; - -f|--force) FORCE="true"; shift;; - *) UNKNOWN_ARGS+=("$1"); shift;; - esac -done - -[ ${#UNKNOWN_ARGS} -gt 0 ] && die "Unknown parameters: ${UNKNOWN_ARGS[*]}" -[ -z "${GIT_URL+x}" ] && die "Unknown gitea URL. Use the --git cli parameter to specify it." -[ -z "${USERNAME+x}" ] && die "Unknown gitea user. Use the --user cli parameter to specify it." - -#------------------------------------------------------------------------------- - -[ -n "$DIRECTORY" ] && mkdir -p "$DIRECTORY" && cd "$DIRECTORY" - -mapfile -t REPOSITORIES < <(curl -sq -L "$GIT_URL/api/v1/users/$USERNAME/repos" | jq -r '.[].clone_url') - -if [ -n "$PRIVATE" ]; then - for repository in $(tr ',' ' ' <<<"$PRIVATE"); do - REPOSITORIES+=("https://${GIT_URL}/${USERNAME}/${repository}.git") - done -fi - -r=0 - -for repository in ${REPOSITORIES[*]}; do - repo_name=$(sed 's/\.git.*$//' <<<"${repository##*/}") - - printf "\n${yellow}#### [%02d/%02d] ${blue}%s${rstc}\n" $((++r)) "${#REPOSITORIES[@]}" "$repo_name" - - if [ ! -d "$repo_name" ]; then - git clone --progress "$repository" - fi - - git_update "$repo_name" -done - diff --git a/gitlab-ci-graph b/gitlab-ci-graph deleted file mode 100755 index e6d9f8c..0000000 --- a/gitlab-ci-graph +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# -# Show graph of GitLab CI Pipeline -# - -# Requirements: -# - jq -# - python-yq (pip install yq) -# - graph-easy - -GITLAB_CI=${1:-.gitlab-ci.yml} - -if [ ! -f "$GITLAB_CI" ]; then - echo "USAGE: $(basename "$0") gitlab-ci.yml." - echo " Or run this script inside CI directory." - exit -fi - -mapfile -t stages < <(yq -c -r '.stages[]' <.gitlab-ci.yml | expand | sed -e 's/^\s*-\s\+//') 2>&- - -echo - -{ - -printf "[BEGIN] { label: '*'; } ==> "; -printf "[%s] ==> " "${stages[@]^^}"; -printf "[END] {label: '*'; }\n" - -for stage in "${stages[@]}"; do - mapfile -t jobs < <(yq -r '. as $input - | keys[] - | [., $input[.]] - | select(.[1].stage?=='\""$stage"\"') - | .[0]' <"$GITLAB_CI" 2>&-) - - for job in "${jobs[@]}"; do - echo "[${stage^^}] --> [${job}]" - - when=$(yq -c -r '.['\""$job"\"'] - | select(.when?) - | [.when] - | flatten' <"$GITLAB_CI" \ - | sed -E 's/\["|"]//g; s/","/ AND /g') - - yq -c -r '.['\""$job"\"'] - | select(.needs?) - | [.needs] - | flatten' <"$GITLAB_CI" \ - | sed "s/\"//g; s/,/],[/g; s/$/ -- $when --> { text-wrap: 10; } \[$job\]/" - done -done - -} | graph-easy - -echo - diff --git a/gitlab-ci-linter b/gitlab-ci-linter deleted file mode 100755 index 3fdf128..0000000 --- a/gitlab-ci-linter +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -#Создан: Чт 11 июн 2020 16:05:25 -#Изменён: пт 12 июн 2020 19:28:15 - -# -# GitLab Pipeline Linter -# -# Requirements: -# - curl -# - jq -# - -# GitLab Pipeline Linter API endpoint. Official gitlab.com by default -[ -z "$GITLAB_URL" ] && GITLAB_URL="https://gitlab.com/api/v4/ci/lint" - -PIPELINE=${1:-.gitlab-ci.yml} - -if [ ! -f "$PIPELINE" ]; then - echo "USAGE: $(basename "$0") gitlab-ci.yml." - echo " Or run this script inside CI directory." - exit -fi - -CONTENT=$(printf '{ "content": %s }' "$(jq -aRs . <"$PIPELINE")") - -RESPONSE=$(curl -sq --header "Content-Type: application/json" "$GITLAB_URL" --data "$CONTENT") - -STATUS=$(jq -r .status <<<"$RESPONSE") - -if [ "$STATUS" != "valid" ]; then - echo -n "ERROR: Pipeline $PIPELINE is invalid: " - jq -r '.errors[]' <<<"$RESPONSE" - exit 1 -fi - diff --git a/hidecursor b/hidecursor deleted file mode 100755 index 82ae486..0000000 --- a/hidecursor +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -#Создан: Чт 27 фев 2020 00:49:54 -#Изменён: Чт 27 фев 2020 00:52:22 - -# Скрипт помещает курсор в правый верхний угол экрана - -CURSOR_POSITION=$(xdpyinfo | awk '/dimensions:/ { gsub("x.*", " 0", $2); print $2 }') - -eval xdotool mousemove "$CURSOR_POSITION" - diff --git a/how b/how deleted file mode 100755 index ab84d33..0000000 --- a/how +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -#Создан: вт 03 дек 2019 11:14:23 -#Изменён: вт 03 дек 2019 21:18:38 - -BINDIR=${SHELLRC}/bin/ - -SCRIPT=cheat.sh - -check_cheat() { - command -V "$SCRIPT" >/dev/null 2>&1 -} - -install_cheat() { - curl -sq https://cht.sh/:cht.sh > "${BINDIR}/${SCRIPT}" - - chmod +x "${BINDIR}/${SCRIPT}" - - echo "[INFO] cheat.sh has been installed to ${BINDIR}/${SCRIPT}." -} - -tip() { - if [[ $1 == @* ]]; then - CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/@/}" - elif [[ $1 == %* ]]; then - echo stealth Q | CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/\%/}" - else - CHTSH_QUERY_OPTIONS="style=borland" cheat.sh "$@" | less -R - fi -} - -check_cheat || install_cheat - -tip "$@" - diff --git a/hr b/hr deleted file mode 100755 index 3dfe8f7..0000000 --- a/hr +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Создан: Сб 05 апр 2014 11:02:41 -# Изменён: Сб 05 апр 2014 11:11:54 - -printf "$green%$(echo `tput cols` - 12 | bc)s─[$yellow`\date '+%H:%M:%S'`$green]─$rstc" | sed 's/ /─/g' - diff --git a/ibor b/ibor deleted file mode 100755 index 2b86fbd..0000000 --- a/ibor +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -#- Чтение цитат с ibash.org.ru -curl -s http://ibash.org.ru/rss.xml | \ -iconv -c -f cp1251 -t utf8 | \ -sed 's/<\/description>//g; s/
    /\n/g; s/\</>> /g; - s/\>/:/g; s/\"/"/g; s/\s*<.*$\|\s*xmlns:.*$//g;' | \ -grep . | less - diff --git a/img50 b/img50 deleted file mode 100755 index c037ac2..0000000 --- a/img50 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:39:15 -#Изменён: Пт 26 фев 2016 21:39:15 - -#- Уменьшение размера изображения на 50% - -echo "$1"; convert -resize 50% "$1" "$1" - diff --git a/imgRL b/imgRL deleted file mode 100755 index ab6514f..0000000 --- a/imgRL +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:39:01 -#Изменён: Пт 26 фев 2016 21:39:01 - -#- Поворот изображения влево на 90 градусов - -echo "$1"; convert -rotate -90 "$1" "$1" - diff --git a/imgRR b/imgRR deleted file mode 100755 index 35e1fab..0000000 --- a/imgRR +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:38:42 -#Изменён: Пт 26 фев 2016 21:38:42 - -#- Поворот изображения вправо на 90 градусов - -echo "$1"; convert -rotate 90 "$1" "$1" - diff --git a/imgview b/imgview deleted file mode 100755 index e91702b..0000000 --- a/imgview +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# Based on script by z3bra -- 2014-01-21 - -W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" -FONTH=12 # Size of one terminal row -FONTW=11 # Size of one terminal column - -X=$1 -Y=$2 -COLUMNS=$3 -LINES=$4 -FILENAME=$5 - -read width height <<< `echo "5;$FILENAME" | $W3MIMGDISPLAY` -if [ -z "$width" -o -z "$height" ]; then - echo 'Error: Failed to obtain image size.' - exit 1 -fi - -x=$((FONTW * X)) -y=$((FONTH * Y)) - -max_width=$((FONTW * COLUMNS)) -max_height=$((FONTH * LINES)) - -if [ "$width" -gt "$max_width" ]; then - height=$((height * max_width / width)) - width=$max_width -fi -if [ "$height" -gt "$max_height" ]; then - width=$((width * max_height / height)) - height=$max_height -fi - -w3m_command="0;1;$x;$y;$width;$height;;;;;$FILENAME\n4;\n3;" - -echo -e "$w3m_command" | $W3MIMGDISPLAY - diff --git a/lsi b/lsi deleted file mode 100755 index f9d5562..0000000 --- a/lsi +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -#Создан: Пт 29 янв 2016 11:11:27 -#Изменён: Пт 29 янв 2016 12:54:41 - -# Идея z3bra -- 2014-01-21: http://blog.z3bra.org/2014/01/images-in-terminal.html -# Доработка envrm - -W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" -FONTH=12 # Size of one terminal row -FONTW=8 # Size of one terminal column -COLUMNS=`tput cols` -LINES=`tput lines` - -#Все позиции захардкорены -posx[1]=10; posx[2]=205; posx[3]=400; posx[4]=600; posx[5]=800; posx[6]=1000 -posy[1]=45; posy[2]=200; posy[3]=350; posy[4]=500; posy[5]=800; posy[6]=1000 -text[1]=18; text[2]=36; text[3]=54; text[4]=72; text[5]=90; text[6]=111 - -row[1]=0; row[2]=100; row[3]=200; row[4]=300; row[5]=300 - -x=1 -y=1 -img=1 -images=24 - -clear -echo -e "\n \033[1;32m$(pwd):\033[00m" - -for FILENAME in ${*:-*}; { - #Обработка только изображений - file "$FILENAME" | grep 'JPEG|PNG|GIF' 2>&1 >/dev/null - - if [ $? -eq 0 ]; then - read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` - - max_width=$(($FONTW * $COLUMNS)) - max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt - - if test $width -gt $max_width; then - height=$(($height * $max_width / $width)) - width=$max_width - fi - - if test $height -gt $max_height; then - width=$(($width * $max_height / $height)) - height=$max_height - fi - - width=$((width / 4)) - height=$((height / 4)) - - w3m_command="0;1;${posx[x]};${posy[y]};$width;$height;;;;;$FILENAME\n4;\n3;" - - tput cup $((($height+${row[y]})/$FONTH)) ${text[$((x-1))]} - echo " $FILENAME" - echo -n -e $w3m_command|$W3MIMGDISPLAY - - if [ $x -eq 6 ]; then - x=1 - y=$((y + 1)) - else - x=$((x + 1)) - fi - - if [ $img -eq $images ]; then - exit - else - img=$((img + 1)) - fi - fi -} - diff --git a/lsimage b/lsimage deleted file mode 100755 index 32f56ce..0000000 --- a/lsimage +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -#Создан: Пт 29 янв 2016 11:11:27 -#Изменён: Чт 12 апр 2018 11:08:24 - -COLUMNS=`tput cols` -LINES=`tput lines` - -FILENAME="$1" - -clear -printf "\e]20;;100x100+1000+1000\a" - -#Обработка только изображений -file "$FILENAME" | grep 'jpg|JPEG|png|PNG|GIF' 2>&1 >/dev/null - -if [ $? -eq 0 ]; then - printf "\\e]20;${FILENAME};$((LINES/2))x$((LINES/2))+$((COLUMNS/3+10))+$((LINES/3)):op=keep-aspect\a" -fi - diff --git a/lsimg b/lsimg deleted file mode 100755 index 71043a0..0000000 --- a/lsimg +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -#Создан: Пт 29 янв 2016 11:11:27 -#Изменён: Пт 30 июн 2017 22:58:09 - -# Идея z3bra -- 2014-01-21: http://blog.z3bra.org/2014/01/images-in-terminal.html -# Доработка envrm - -W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" -FONTH=12 # Size of one terminal row -FONTW=8 # Size of one terminal column -COLUMNS=`tput cols` -LINES=`tput lines` - -#Все позиции захардкорены -posx[1]=750; posx[2]=750 -posy[1]=100; posy[2]=100 - -row[1]=0 - -x=1 -y=1 -img=1 -images=24 - -FILENAME="$1" - -clear - -#Обработка только изображений -file "$FILENAME" | grep 'JPEG|PNG|GIF' 2>&1 >/dev/null - -if [ $? -eq 0 ]; then - read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` - - max_width=$(($FONTW * $COLUMNS)) - max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt - - if test $width -gt $max_width; then - height=$(($height * $max_width / $width)) - width=$max_width - fi - - if test $height -gt $max_height; then - width=$(($width * $max_height / $height)) - height=$max_height - fi - - w3m_command="0;1;${posx[x]};${posy[y]};$width;$height;;;;;$FILENAME\n4;\n3;" - - tput cup $((($height+${row[y]})/$FONTH)) ${text[$((x-1))]} - echo -n -e $w3m_command|$W3MIMGDISPLAY -fi - diff --git a/mem b/mem deleted file mode 100755 index 2fe9e06..0000000 --- a/mem +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -#- Заметки -memfile=$SHELLRC/var/memory/mem -case "$1" in - -h) printf "\tКлючи:\n\ - -e\t-Редактирование записей\n\ - -l n\t-Последние n записей\n\ - -s\t-Поиск по записям\n\ - -remove\t-Удалить запись по номеру\n\ - -clear\t-Удалить все записи\n\ - -h\t-Справка\n";; - - -e) $EDITOR "$memfile";; - -l) tail -"$2" "$memfile" | nl | \grep --color -E '.{1,}==>';; - -s) grep "$2" "$memfile" | nl | \grep --color -E '.{1,}==>';; - -remove) sed "$2d" -i "$memfile";; - -clear) > "$memfile";; - '') cat "$memfile" | nl | \grep --color -E '.{1,}==>';; - *) printf "[ `\date '+%d.%m.%Y %H:%M:%S'` ] ==> $*\n" >> $memfile && printf \ - "${green}Заметка${yellow} $* ${green}успешно добавлена\n${rstc}" -esac - diff --git a/mptk b/mptk deleted file mode 100755 index ae9b2fe..0000000 --- a/mptk +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env tclsh - -# Ghetto MPD controller - -package require Tk - -set music_directory "/mnt/DATA/Музыка/" - -array set buttons { - prev 玲 - toggle ▶ - next 怜 -} - -proc mpc {args} { - exec mpc {*}$args -} - -proc current_file {} { - lindex [split [exec mpc -f {%file%}] "\n"] 0 -} - -proc rate {rating} { - set filename [file join $::music_directory [current_file]] - - exec mid3v2 --delete-frames=COMM $filename - exec mid3v2 --COMM $rating $filename - - mpc update -} - -proc update_status {} { - set ::mpd_status [mpc] - after 500 update_status -} - -update_status - -frame .status -frame .rating -pady 10 -frame .control -pady 10 - -pack .status -fill x -expand true -padx 20 -pady 20 -pack [label .status.current -font {Sans 20} -textvariable ::mpd_status] - -pack .rating -foreach rating {1 2 3 4 5 5+} { - pack [button .rating.$rating -text $rating -font {Sans 60} -width 2 -command "rate $rating"] -side left -} - -pack .control -foreach btn {prev toggle next} { - pack [button .control.$btn -text $buttons($btn) -font {Sans 80} -width 4 -command "mpc $btn"] -side left -} - -bind . exit -bind . exit - diff --git a/musca_status b/musca_status deleted file mode 100755 index 889a37c..0000000 --- a/musca_status +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -/usr/bin/musca -c 'silent show groups' 2>/dev/null | cut -f 2- -d ' ' | sed -e :a -e '$b;N;s/\n/ | /;ba' | sed 's/- //g;s/\*/✻/g' - diff --git a/nt b/nt deleted file mode 100755 index 15471ff..0000000 --- a/nt +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -#Создан: Ср 24 фев 2016 19:47:47 -#Изменён: Ср 24 фев 2016 21:34:57 - -#Чтение библии с помощью SWORD на двух языках - -BOOK=${1:-Jn} -CHAPTER=${2:-} - -B1="$(diatheke -b VulgSistine -k $BOOK $CHAPTER)" -B2="$(diatheke -b RusVZh -k $BOOK $CHAPTER)" - -n=$(echo "$B1" | wc -l) - -for i in $(seq $n); { - echo "$B1" | sed -n ${i}p | sed 's/ */ /g' - echo "$B2" | sed -n ${i}p | sed 's/ */ /g' -} - diff --git a/passgen b/passgen deleted file mode 100755 index 37078a7..0000000 --- a/passgen +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:33:55 -#Изменён: Пт 26 фев 2016 21:33:55 - -#- Генератор паролей - -for i in `seq ${2:-10}`; { - "$1.gz";; - zip) zip -r "$1.zip" "$1";; - 7z) 7za a "$1.7z" "$1";; -esac - diff --git a/pomodoro b/pomodoro deleted file mode 100755 index 715bcad..0000000 --- a/pomodoro +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -#Создан: Ср 17 фев 2016 13:08:24 -#Изменён: Ср 16 мар 2016 11:16:15 - -TIME=${1:-25} -TYPE=${2:-Прочее} -LOGF="$SHELLRC/var/log/pomodoro.log" - -echo "Сосредоточьтесь на $TIME минут." -notify-send -i task-due "$TYPE :: $TIME минут" "Сосредоточьтесь" - -printf "Осталось времени: %02d:00" $TIME - -for m in $(seq $(($TIME-1)) -1 0); do - for s in $(seq 59 -1 0); do - printf "\b\b\b\b\b%02d:%02d" $m $s - sleep 1s - done -done - -echo "\nПрошло $TIME минут. Можно отдохнуть." -notify-send -i trophy-gold -t 0 "Прошло $TIME минут." "Можно отдохнуть." -play -v 0.5 $SHELLRC/var/sounds/done.ogg > /dev/null 2> /dev/null - -echo "$(\date "+%d.%m.%Y :: %H:%M") :: $(printf '%02d' $TIME) м. :: $TYPE" >> "$LOGF" - diff --git a/poweroff-dialog b/poweroff-dialog deleted file mode 100755 index 581a28a..0000000 --- a/poweroff-dialog +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -#Создан: Вт 23 фев 2016 14:25:37 -#Изменён: Вт 23 фев 2016 15:20:53 - -action=$(yad --width 300 --height 500 --title "Остановка системы" \ - --image=gnome-shutdown \ - --button="Выключение:2" \ - --button="Перезагрузка:3" \ - --button="Спящий режим:4" \ - --button="gtk-close:1") -ret=$? - -case $? in - 1) exit 0;; - 2) shutdown -h now;; - 3) shutdown -r now;; - 4) dbus-send --system \ - --print-reply \ - --dest="org.freedesktop.UPower" \ - /org/freedesktop/UPower org.freedesktop.UPower.Suspend;; -esac - -exit 0 - diff --git a/radio b/radio deleted file mode 100755 index 037f984..0000000 --- a/radio +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -#Сценарий прослушивания радиостанций -#Формат списка: name;playlist - -STATIONS=$SHELLRC/etc/soft/radio/stations - -plays() { - echo $1 - PLAYLIST=$(cat $STATIONS | grep "$1" | cut -d ';' -f 2) - - echo $PLAYLIST | grep 'http' - - if [ $? -eq 0 ]; then - killall play 2>/dev/null - STREAM=$(curl -s $PLAYLIST | grep 'http://' | sed 's/^.*http/http/' | head -n 1) - curl $STREAM | play -q -v 0.3 -t mp3 - - fi -} - -CH=$(cat $STATIONS | cut -d ';' -f 1 | dmenu -fn '-*-fixed-*-*-*-*-15-*-*-*-*-*-*-*' -l 10) - -notify-send -i audio-x-generic "Радио: $CH" -case $CH in - STOP) killall play 2>/dev/null;; - *) plays "$CH";; -esac - diff --git a/renamepdfs b/renamepdfs deleted file mode 100755 index 8c6f4ae..0000000 --- a/renamepdfs +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# Интерактивное переименование PDF-файлов, используя информацию из метаданных - -filelist() { - for f in "$@"; do - echo "\"$f\"" - done -} - -DIR=$(pwd) - -FILES=() - -while [[ $# -gt 0 ]]; do - key="$1" - - case $key in - -d|--directory) - DIR="$2" - shift # past argument - shift # past value - ;; - *) - FILES+=("$1") # save it in an array for later - shift # past argument - ;; - esac -done - -set -- "${FILES[@]}" - -if [ "${#FILES[@]}" -gt 0 ]; then - filelist "${FILES[@]}" | viper +'set ft=rename' +"let b:rename_dir=\"$DIR\"" | sed "s/^/mv /" | sh -else - echo "USAGE: $(basename $0) [-d/--directory ] file1.pdf file2.pdf [...]" - exit 1 -fi - diff --git a/retag b/retag deleted file mode 100755 index 3aea528..0000000 --- a/retag +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -#Создан: Ср 19 фев 2020 21:59:29 -#Изменён: Чт 20 фев 2020 00:45:38 - -# Requirements: -# - mid3v2 from media-libs/mutagen - -rstc="\033[00m" -green="\033[1;32m" -yellow="\033[1;33m" -blue="\033[1;34m" - -REGEXP=".*/(.*)/(.*) \[(.*)\]/(.*)/(.*?) - (.*)/(.*?) - (.*)\.([[:alnum:]]{3})$" - -usage() { - echo "$(basename "$0") - simple mp3 tagger." - echo - echo "USAGE: $(basename "$0") [file] [options]" - echo - echo "The filenames should be in the format \"[...]/GENRE/ARTIST [COUNTRY]/TYPE/YEAR - ALBUM/TRACK - TITLE.FORMAT\"" - echo - echo "Command line arguments:" - echo " -h --help - show this help" - echo " -v --verbose - show updating tags" - echo " -d --dry - run without tags saving" -} - -tag_file() { - file="$1" - - [[ $file =~ $REGEXP ]] - - printf "${blue}%s[%02d/%02d] ${yellow}Tagging the file «%s»${rstc}\n" "$INDENT" "$((++CURRENT_TRACK))" "$TRACKS" "$file" - - GENRE="${BASH_REMATCH[1]}" - ARTIST="${BASH_REMATCH[2]}" - YEAR="${BASH_REMATCH[5]}" - ALBUM="${BASH_REMATCH[6]}" - TRACK="${BASH_REMATCH[7]}" - TITLE="${BASH_REMATCH[8]}" - - if [ -n "$VERBOSE" ]; then - printf "%s\t Genre: %s | Artist: %s |" "$INDENT" "$GENRE" "$ARTIST" - printf "Year: %s | Album: %s |" "$YEAR" "$ALBUM" - printf "Track: %s | Title: %s\n" "$TRACK" "$TITLE" - fi - - if [ -z "$DRY_RUN" ]; then - mid3v2 --genre="$GENRE" --artist="$ARTIST" --year="$YEAR" \ - --album="$ALBUM" --track="$TRACK" --song="$TITLE" \ - "$file" - fi -} - -tag_directory() { - TRACKS=$(find "$1" -name '*.mp3' -print | wc -l) - - printf "${green}> %s/${rstc}\n" "$1" - INDENT=" " - - - find "$1" -name '*.mp3' | while read -r file; do tag_file "$file"; done -} - -tag() { - if [[ -d "$1" ]]; then - tag_directory "$1" - elif [[ "$1" =~ \.mp3 ]]; then - tag_file "$1" - fi -} - -if (( $# == 0 )); then - usage - exit 1 -fi - -QUEUE=() - -while [[ $# -gt 0 ]]; do - key="$1" - - case $key in - -h|--help) usage; exit 0; shift;; - -v|--verbose) VERBOSE=1; shift;; - -d|--dry) DRY_RUN=1; VERBOSE=1; shift;; - *) QUEUE+=("$1"); shift;; - esac -done - -set -- "${QUEUE[@]}" - -INDENT= -TRACKS="$#" -CURRENT_TRACK=0 - -for item in "${QUEUE[@]}"; do - tag "$(realpath "$item")" -done - diff --git a/robodoc2html b/robodoc2html deleted file mode 100755 index f87e57e..0000000 --- a/robodoc2html +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:33:26 -#Изменён: Пт 26 фев 2016 21:33:26 - -#- Создание документации robodoc - -mkdir -p ${1:-.}/doc -robodoc --src ${1:-.} --doc ./doc/ --multidoc \ - --html \ - --charset utf-8 \ - --index \ - --nosort \ - --sections \ - --source_line_numbers - # --syntaxcolors - # --nopre \ - diff --git a/scripts/a2mp3 b/scripts/a2mp3 new file mode 100755 index 0000000..4de6e0a --- /dev/null +++ b/scripts/a2mp3 @@ -0,0 +1,9 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:37:48 +#Изменён: Пт 26 фев 2016 21:38:22 + +#- Конвертирование аудио в mp3 + +lame -b ${2:-320} --noreplaygain -q 0 -m s -k -p "$1"; + diff --git a/scripts/asroot b/scripts/asroot new file mode 100755 index 0000000..0596f4c --- /dev/null +++ b/scripts/asroot @@ -0,0 +1,18 @@ +#!/usr/bin/env tclsh + +# Выполнение команды с правами администратора +# Используется с dmenu +# asroot + +package require Expect + +proc execCommand {command password} { + spawn bash + exp_send "su -c \"$command\"\n" + expect -nocase "password: " + exp_send "$password\n" + expect eof +} + +execCommand [lindex $argv 0] [lindex $argv 1] + diff --git a/scripts/axaudio b/scripts/axaudio new file mode 100755 index 0000000..4c21438 --- /dev/null +++ b/scripts/axaudio @@ -0,0 +1,77 @@ +#!/bin/bash + +# +# Copyright (C) 2019, Maxim Lihachev, +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . +# + +# +# Получение информации и аудиопотока в сети Axia Livewire +# +# Пример обработки полученных данных при помощи ffmpeg: +# +# | ffmpeg -ac 2 -ar 48000 -f s24be -i pipe:0 +# + +# Сценарий принимает адрес Axia Livewire в формате IP/Channel, +# при этом IP-адрес может отсутствовать +if [ $# -ne 2 ]; then + echo "USAGE: $0 [--info|--dump] " + exit 1 +fi + +# Перевод чисел в 16-ричную систему счисления +hex() { + printf '%02X' "$@" +} + +# Программа +PROGRAMME="$2" + +# IP-адрес Axia Livewire. +IP="$(echo $PROGRAMME | grep -o '.*\/' | tr '/' ' ')" + +# По умолчанию используется базовый адрес 239.192.0.0 +ADDRESS="${IP:-239.192.0.0}" + +# Канал +CHANNEL="${PROGRAMME/*\/}" + +# Команда получения сигнала в сети Axia Livewire +CMD="rtpdump -F payload" + +BROADCAST="0x$(hex $[0x$(hex ${ADDRESS//./ })+$CHANNEL])/5004" +HEXADDR="$(hex $[0x$(hex ${ADDRESS//./ })+$CHANNEL])" + +IPADDR=$(printf "%d." $( + echo $HEXADDR | sed 's/../0x& /g' | tr ' ' '\n' +) | sed 's/\.$/\n/') + +################# + +if [ "$1" == "--info" ]; then + # Информация об источнике + echo "Axia Livewire :: IP: $IPADDR, SOURCE: $CHANNEL, BROADCAST: $BROADCAST" +else + # Прекращение работы, если нет последующего конвеера, + # т.к. выводить дамп аудиопотока в stdout не имеет смысла. + if [ -t 1 ]; then + echo "A pipe (f.e. to ffmpeg) isn't exists. Terminated." + exit 1 + else + # Дамп + $CMD $BROADCAST + fi +fi + diff --git a/scripts/bor b/scripts/bor new file mode 100755 index 0000000..cd25169 --- /dev/null +++ b/scripts/bor @@ -0,0 +1,9 @@ +#!/bin/bash + +#- Чтение цитат с bash.org.ru +curl -s https://bash.im/rss/ | \ +sed 's/<\/description>//g; s/
    /\n/g; s/\</>> /g; + s/\>/:/g; s/\"/"/g; s/\s*<.*$\|\s*xmlns:.*$//g;' | \ +grep . | less + diff --git a/scripts/calculator b/scripts/calculator new file mode 100755 index 0000000..65b3546 --- /dev/null +++ b/scripts/calculator @@ -0,0 +1,42 @@ +#!/bin/bash + +#TODO: EUR -> RUB + +vars=( $(echo {a..z}) ) +count=-1 +prompt=' ' +mesg="" +# menu=dmenu +menu="rofi -dmenu" + +while eqn=$(echo | rofi -dmenu -lines 0 -theme Monokai -mesg "$mesg" -p "$prompt  "); do + [[ $eqn ]] || exit + + echo $eqn | grep '#' + + if [ "$?" == 0 ]; then + comment="#$(echo $eqn | cut -d '#' -f 2-)" + else + comment="" + fi + + # if ans=$(calc -pd “$(eval echo $(echo $eqn | sed ‘s/([a-z])/$\1/g’))”); then + exp=$(eval echo $(echo \"$eqn\" | sed 's/#.*"/"/; s/\([a-z]\)/$\1/g')) + + echo = $exp + + if ans=$(echo "$exp" | bc -l); then + echo -n $ans | xclip + count=$(( $count + 1 )) + + [[ $count -gt 25 ]] && count=0 + + eval ${vars[$count]}=$ans + + # prompt="$prompt  $(eval echo ${vars[$count]}=$ans)" + # mesg=$(echo "$mesg\n  ${vars[$count]}  $exp  $ans \t $comment") + # printf "%50s\n" "This field is 50 characters wide..." + mesg=$(printf "$mesg\n  %s  %-10s  %-10s %s" ${vars[$count]} $exp $ans $comment) + fi +done + diff --git a/scripts/currency b/scripts/currency new file mode 100755 index 0000000..3d33846 --- /dev/null +++ b/scripts/currency @@ -0,0 +1,38 @@ +#!/bin/bash + +# +# Simple currency converter +# + +SHORT_OUTPUT=false + +exchange() { + local api_url="https://api.exchangeratesapi.io/latest?base=${1^^}&symbols=${2^^}" + + curl -s -q -L "$api_url" \ + | jq -r --arg short "$SHORT_OUTPUT" ' + def round: + .*100.0 + 0.5 | floor / 100.0; + + if ($short == "true") then + .rates | to_entries | .[] | (.value | round | tostring) + else + "1 " + .base + " ≈ " + + (.rates | to_entries | .[] | (.value | round | tostring) + " " + .key) + end + ' +} + +if [ $# -le 1 ]; then + echo "USAGE: $(basename "$0") ?-s? FROM TO1,TO2,...,TOn" + echo " e.g: $(basename "$0") ?-s? USD EUR,RUB" + echo "Set -s to show only value." +else + if [ "$1" == "-s" ]; then + SHORT_OUTPUT=true + shift + fi + + exchange "$@" +fi + diff --git a/scripts/dada b/scripts/dada new file mode 100755 index 0000000..1e731b5 --- /dev/null +++ b/scripts/dada @@ -0,0 +1,13 @@ +#!/bin/bash + +#Создан: Ср 18 май 2016 14:53:34 +#Изменён: чт 17 окт 2019 13:01:07 + +#Дадаизатор текстов + +tr ' ' '\n' <"$1" \ + | grep -o -E '[а-яА-Яa-zA-Z]+' \ + | shuf \ + | head -n "${2:-500}" \ + | fmt -w "${3:-80}" + diff --git a/scripts/dates b/scripts/dates new file mode 100755 index 0000000..cd8054d --- /dev/null +++ b/scripts/dates @@ -0,0 +1,45 @@ +#!/bin/bash + +#Создан: Чт 06 Май 2010 02:44:00 +#Изменён: Вс 23 фев 2020 13:27:43 + +# Скрипт напоминания о датах +# +# Формат файла DATAFILE: +# +# = Январь = +# +# * *01/01* - Событие 1 +# +# = Февраль = +# +# * *02/02* - Событие 2 +# * *03/02* - Событие 3 + +#Файл с данными +DATAFILE="$SHELLRC/vimwiki/wiki/ЖЖ/Даты и события/dates.wiki" +#За сколько дней оповещать +DAYS=3 +#Сегодняшнее число +TODAY=$(\date +%s --date=$(\date '+%m/%d')) +#Количество найденных событий +FOUND=0 + +dates() { + echo -e "${green}Ближайшие даты:${rstc}" + + #Поиск дат в базе данных + for i in $(seq 0 $DAYS); do + DATE=$(\date -d "UTC 1970-01-01 $(($TODAY + 86400*$i)) secs" '+%d/%m') + grep -v '#.*' "$DATAFILE" | grep $DATE && ((FOUND++)) + done; + + #Код возврата. 1 - не найдено дат. + [ $FOUND -eq 0 ] && echo "-" && exit 1 || exit 0 +} + +case "$1" in + -all) cat "$DATAFILE";; + *) dates;; +esac + diff --git a/scripts/defgroups b/scripts/defgroups new file mode 100755 index 0000000..c1368ab --- /dev/null +++ b/scripts/defgroups @@ -0,0 +1,49 @@ +#!/usr/bin/env guile +!# + +;;;Создан: Сб 10 июл 2010 19:29:10 +;;;Изменён: Вс 21 июл 2010 01:40:25 + +;;; +;;; Скрипт составления команды UNIX Shell для добавления пользователя в группы. +;;; Группы добавляются к уже имеющимся. +;;; +;;; (c) 2010, Maxim Lihachev, +;;; + +;;Стандартные группы для пользователей +(define default-groups (list "plugdev" "audio" "video" "cdrom" "scanner" "users")) + +;;Получение первого элемента вектора +(define (vector-car vector) (vector-ref vector 0)) + +;;Получение списка существующих групп +(define (get-all-groups) + (do ( (group (getgr) (getgr)) + (groups '() (append groups (list group)))) + ((not (vector? group)) groups))) + +;;Получение списка групп, в которые входит данный пользователь +(define (get-old-groups user groups) + (map vector-car (filter (lambda (g) (member user (group:mem g))) groups))) + +;;Получение списка групп, в которые должен входить пользователь +(define (get-new-groups groups) + (filter (lambda (x) (not (member x groups))) default-groups)) + +;;Создание команды оболочки для добавления пользователя в группы +(define (make-command user groups) + (format #f "usermod -G ~A ~A\n" (string-join groups ",") user)) + +;;;----------------------------------------------------------------------------- +;;Формирование команд оболочки +(let* ( (all-groups (get-all-groups)) + (users (if (< 1 (length (command-line))) + (cdr (command-line)) + (list (cuserid)))) + (get-command (lambda (user) + (let* ( (oldg (get-old-groups user all-groups)) + (newg (get-new-groups oldg))) + (display (make-command user (append oldg newg))))))) + (for-each get-command users)) + diff --git a/scripts/doctools2man b/scripts/doctools2man new file mode 100755 index 0000000..c0ecc18 --- /dev/null +++ b/scripts/doctools2man @@ -0,0 +1,15 @@ +#!/usr/bin/env tclsh + +#Создан: Сбт 09 Июл 2011 00:22:26 +#Изменён: Сбт 09 Июл 2011 01:32:08 + +package require doctools +package require fileutil + +# USAGE +lassign $argv format file out + +::doctools::new mydtp -format $format + +fileutil::writeFile -encoding koi8-r $out [mydtp format [fileutil::cat $file]] + diff --git a/scripts/dus b/scripts/dus new file mode 100755 index 0000000..2ef0b6c --- /dev/null +++ b/scripts/dus @@ -0,0 +1,38 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:32:55 +#Изменён: Вс 02 авг 2020 14:33:02 + +#- Вывод размера файлов в отсортированном виде + +rstc="\033[00m" + +\du -sh -c -- "$@" | sort -rh | awk ' + BEGIN { + blue="\033[1;36m" + green="\033[1;32m" + red="\033[1;31m" + yellow="\033[1;33m" + } + + /^[0-9,]+G/ { printf("%s%10s",red,$1); } + + /^[0-9,]+M/ { + mb=$1 + sub("M","",mb) + + if (int(mb) > 500) { + printf("%s%10s",yellow,$1) + } else { + printf("%s%10s",green,$1) + } + } + + /^[0-9,]+K/ { printf("%s%10s",blue,$1); } + /^0/ { printf("%s%10s",blue,$1); } + + sub($1,"") +' + +echo -e -n "$rstc" + diff --git a/scripts/ext b/scripts/ext new file mode 100755 index 0000000..1d8ba70 --- /dev/null +++ b/scripts/ext @@ -0,0 +1,32 @@ +#!/bin/bash + +#- Распаковка архивов +ext() { + [ -f "$1" ]; { + case "$1" in + *.tar.bz2) tar xjf "$1";; + *.tar.gz) tar xzf "$1";; + *.tar.Z) tar xzf "$1";; + *.txz) tar xJf "$1";; + *.xz) tar xJf "$1";; + *.bz2) bunzip2 "$1";; + *.rar) unrar x "$1";; + *.gz) gunzip "$1";; + *.jar) unzip "$1";; + *.tar) tar xf "$1";; + *.tbz2) tar xjf "$1";; + *.tgz) tar xzf "$1";; + *.zip) unzip "$1";; + *.Z) uncompress "$1";; + *.7z) 7z x "$1";; + *.7za) 7z x "$1";; + *.iso) 7z x "$1";; + *.deb) ar x "$1";; + *) echo -e \ + ""$green"<${1:-"-"}>: Неизвестный формат архива";; + esac + } +} + +ext "$*" + diff --git a/scripts/fb2 b/scripts/fb2 new file mode 100755 index 0000000..5d45da3 --- /dev/null +++ b/scripts/fb2 @@ -0,0 +1,325 @@ +#!/bin/bash + +#Чтение fb2 в консоли + +case ${1:0-3} in + zip) TEXT=$(zcat "$1");; + fb2) TEXT=$(cat "$1");; + *) echo "Неизвестный формат файла"; exit 1;; +esac + +FB2=`cat < + + + + + + + + + + <xsl:value-of select="fb:description/fb:title-info/fb:book-title"/> + + + + + +
    + +
    +
    +
    + +
      + +
    +
    + + + +
    +
    + +

    + +

    +
    + + +
    + + +
    + + + + + + + +
    +
    + + +
  • + + + , # + + + +
      + + + +
    +
    + + + + + + + + + +
  • + + +
    +
    +
  • + + +
    + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    + + +
    +
    + + + + + + + +
    + +
    +
    + + +
    + + + +    
    +
    + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Annotation

    + +
    + + +
    + + + + + + +
    +
    + + +
    + +
    +
    + + +
    + + + + + + +
    +
    + + +
    +
    +
    + + + + +     +
    +
    + +     +
    +
    +
    +
    + + +
    + + + + + + +
    +
    + + + + +
    +
    + + + + + + + +
    +
    + + +
    + + + + + + + + + + +
    +
    + + +FB2RULES` + +# echo $TEXT | xsltproc <(echo $FB2) - | lynx -stdin -display_charset=UTF-8 +echo $TEXT | xsltproc <(echo $FB2) - | w3m -T text/html + diff --git a/scripts/fcheck b/scripts/fcheck new file mode 100755 index 0000000..7b15743 --- /dev/null +++ b/scripts/fcheck @@ -0,0 +1,16 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:39:40 +#Изменён: Пт 26 фев 2016 21:39:40 + +#- file -> [X] file + +for i in "$@"; { + if [[ ! "$i" =~ \[X\]\ .* ]]; then + echo -n $i + echo -ne '\000' + echo -n $(echo $(basename "$i") | sed 's/^\[ \] \|^/[X] /') + echo -ne '\000' + fi +} | xargs -0 -n2 mv -v + diff --git a/scripts/fix-eselect b/scripts/fix-eselect new file mode 100755 index 0000000..953aa6e --- /dev/null +++ b/scripts/fix-eselect @@ -0,0 +1,6 @@ +#!/bin/bash + +#Gentoo: fix eselect / type alias + +sed -i 's/type -t/command type -t/' /usr/share/eselect/libs/tests.bash + diff --git a/scripts/fontsel b/scripts/fontsel new file mode 100755 index 0000000..a65be29 --- /dev/null +++ b/scripts/fontsel @@ -0,0 +1,20 @@ +#!/bin/bash + +#Создан: Вт 02 авг 2016 20:58:05 +#Изменён: Ср 11 апр 2018 15:04:53 + +#Выбор шрифта в эмуляторе терминала + +COUNT=$(fc-list | cut -d ':' -f 2 | sort -u | wc -l) +i=0 + +while read FONT; do + ((i++)) + echo "## ${i}/${COUNT}: $FONT " + fsz 16 "$FONT" + echo ' :dir:/, :exe:, :reg:, :link:' + read -p "Применить? [y/n] " y &- + diff --git a/scripts/fsz b/scripts/fsz new file mode 100755 index 0000000..222c02f --- /dev/null +++ b/scripts/fsz @@ -0,0 +1,3 @@ +#!/bin/bash + +printf '\33]50;%s' "xft:${2:-DejaVU Sans Mono}:pixelsize=${1:-16}" diff --git a/scripts/fucheck b/scripts/fucheck new file mode 100755 index 0000000..23ea83e --- /dev/null +++ b/scripts/fucheck @@ -0,0 +1,16 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:39:58 +#Изменён: Пт 26 фев 2016 21:39:58 + +#- file -> [ ] file + +for i in "$@"; { + if [[ ! "$i" =~ \[.\]\ .* ]]; then + echo -n $i + echo -ne '\000' + echo -n "[ ] $i" + echo -ne '\000' + fi +} | xargs -0 -n2 mv -v + diff --git a/scripts/git-aliases b/scripts/git-aliases new file mode 100755 index 0000000..441aa67 --- /dev/null +++ b/scripts/git-aliases @@ -0,0 +1,42 @@ +#!/bin/bash + +#Создан: чт 14 ноя 2019 14:03:43 +#Изменён: Сб 29 фев 2020 02:48:48 + +# Список псевдонимов git + +# +# Формат: +# +# # Комментарий +# name = function +# +# Игнорирование в выводе: +# +# # noindex Комментарий +# или +# name = function #noindex +# + +green="\033[1;32m" +rstc="\033[00m" + +GITCONFIG=~/.gitconfig + +GIT_ALIASES=$(git config --get-regexp 'alias.*' | sed 's/alias.//' | sed 's/ .*//' | sort) + +while read -r alias; do + line=$(\grep -n -E "^\s*${alias}\s+" "$GITCONFIG") + + number=${line/:*} + full_alias=${line/*:} + + name=$(sed "s/^[[:space:]]*//; s/=.*$//g; ${number}q;d" $GITCONFIG) + + commentary=$(sed "s/[[:space:]]*# //; $((--number))q;d" $GITCONFIG) + + if [[ ! "$full_alias" =~ "noindex" ]] && [[ ! "$commentary" =~ "noindex" ]]; then + printf " • ${green}%-15s${rstc}- %s\n" "$name" "$commentary" + fi +done <<<"$GIT_ALIASES" + diff --git a/scripts/git-cblame b/scripts/git-cblame new file mode 100755 index 0000000..b837a20 --- /dev/null +++ b/scripts/git-cblame @@ -0,0 +1,17 @@ +#!/bin/bash + +# Blame с подсветкой синтаксиса + +vcat() { + BAT_CONFIG_PATH="$SHELLRC/etc/soft/bat/bat.conf" bat --decorations never "$1" +} + +clr() { + sed -e "s/$1/$(echo -e "\033")[7;32m&$(echo -e "\033")[1;0m/g" +} + +paste -d ' ' \ + <(git blame "$1" | cut -d ')' -f 1 | sed 's/(//' | clr "0\+.*Not Committed Yet.*") \ + <(vcat "$1") \ +| less -R + diff --git a/scripts/git-forks b/scripts/git-forks new file mode 100755 index 0000000..9d141a8 --- /dev/null +++ b/scripts/git-forks @@ -0,0 +1,26 @@ +#!/bin/bash + +#Создан: вт 15 окт 2019 11:15:12 +#Изменён: чт 14 ноя 2019 17:35:25 + +# Список форков репозитория на github.com, +# отсортированный на основе времени последних изменений + +API="https://api.github.com/repos/" + +last_forks() { + curl -sq "${API}${1}/forks?sort=stargazers&per_page=100" \ + | jq -r '.[] | "\(.updated_at) \(.full_name)"' 2>&- \ + | sed "s|^| |; s|T| |; s|Z | https://github.com/|" \ + | sort -r \ + | head -n "$2" +} + +if [ -z "$1" ]; then + repository=$(git url | grep github.com | sed -e 's|^.*github.com/||' | sed 's/.git.*$//') +else + repository="$1" +fi + +last_forks "$repository" "${2:-15}" + diff --git a/scripts/git-graphviz b/scripts/git-graphviz new file mode 100755 index 0000000..f617d53 --- /dev/null +++ b/scripts/git-graphviz @@ -0,0 +1,17 @@ +#!/bin/bash + +# Создание графа коммитов git-репозитория + +# This produces output that can be displayed using dotty, for example: +# $ git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin +# $ git graphviz --first-parent master | dotty /dev/stdin +# Note how defining a function eliminates the need to use sh -c. + +make_graphviz() { + echo 'digraph git {' + git log --pretty='format: %h -> { %p }' "$@" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' + echo '}' +} + +make_graphviz "$@" + diff --git a/scripts/git-ignore b/scripts/git-ignore new file mode 100755 index 0000000..f4bbad1 --- /dev/null +++ b/scripts/git-ignore @@ -0,0 +1,43 @@ +#!/bin/bash + +# Получение шаблона gitignore с сайта gitignore.io + +ROOT=$(git root 2>&-) + +TYPES=() + +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -w|--write) + WRITE=1 + shift + ;; + *) + TYPES+=("$1") + shift + ;; + esac +done + +set -- "${TYPES[@]}" + +if [ "${#TYPES[@]}" -gt 0 ]; then + for t in "${TYPES[@]}"; do + if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then + echo "# $t" + curl -sq -L "https://gitignore.io/api/${t}" >> "$(git root)/.gitignore" + else + curl -sq -L "https://gitignore.io/api/${t}" + fi + done + + if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then + echo "Ignoring list saved to ${ROOT}/.gitignore file." + fi +else + echo "USAGE: $(basename "$0") [-w/--write] type1 type2 [...]" + exit 1 +fi + diff --git a/scripts/git-makeignore b/scripts/git-makeignore new file mode 100755 index 0000000..471d7ea --- /dev/null +++ b/scripts/git-makeignore @@ -0,0 +1,41 @@ +#!/bin/bash + +#Создан: Вс 25 авг 2013 19:40:12 +#Изменён: Сб 22 мар 2014 12:02:37 + +# Добавление файлов с меткой +GITIGNORE в исключения .git + +# Создание копии файлов с меткой +GITIGNORE +SAMPLE +make_sample() { + \grep -E '^.{1,5}\+GITIGNORE \+SAMPLE' "$1" 2>&- > /dev/null && \ + if [ ! -f "${1/.sample/}.sample" ]; then + cp -iv $1 $1.sample + sed -i 's/\+GITIGNORE.\+SAMPLE/+SAMPLE/' $1.sample + fi +} + +# Метка должна располагаться не далее пятой колонки +\grep -E '^.{1,5}\+GITIGNORE' -R --exclude-dir=var 2>&- > /tmp/gitignore.$$ + +if [ -f ".gitignore" ]; then + while read line; do + echo "COPY:" "$line" + make_sample "$line" + sed -i "/${line//\//.}/d" /tmp/gitignore.$$ 2> /dev/null + done < .gitignore +fi + +if [ -f "/tmp/gitignore.$$" ]; then + while read line; do + make_sample "${line/:*/}" + done < /tmp/gitignore.$$ +fi + +echo "\n# [ $(\date +%d.%m.%Y) ]\n" >> .gitignore + +cut -d ':' -f 1 /tmp/gitignore.$$ | sort -u >> .gitignore + +echo >> .gitignore + +\rm /tmp/gitignore.$$ + diff --git a/scripts/git-recent b/scripts/git-recent new file mode 100755 index 0000000..00e0b5d --- /dev/null +++ b/scripts/git-recent @@ -0,0 +1,71 @@ +#!/bin/bash + +## +## +## git-recent (c) https://github.com/paulirish/git-recent +## +## MIT License +## +## Copyright (c) 2017 Paul Irish +## +## list all local branches, sorted by last commit, formatted reall purdy +## + +# Windows needs more basic format (#8, git-for-windows/git#865) +case $(uname -s) in + CYGWIN*|MINGW*|MSYS*) + branch='%(refname:short)' + spacer=' ' + ;; + *) + branch='%(color:yellow)%(refname:short)%(color:reset)' + spacer='%(color:black) %(color:reset)' + ;; +esac + +COUNT=0 +while getopts "n:" opt; do + case ${opt} in + n ) + if ! [[ $OPTARG =~ ^[0-9]{1,}$ ]]; then + echo "-n should be an integer." + exit 1 + fi + COUNT=${OPTARG} + shift + ;; + esac +done +shift $((OPTIND-1)) + +format="\ +%(HEAD) \ +$branch|\ +%(color:bold red)%(objectname:short)%(color:reset) \ +%(color:bold green)(%(committerdate:relative))%(color:reset) \ +%(color:bold blue)%(authorname)%(color:reset) \ +%(color:yellow)%(upstream:track)%(color:reset) +$spacer|\ +%(contents:subject) +$spacer|" + +lessopts="--tabs=4 --quit-if-one-screen --RAW-CONTROL-CHARS --no-init" + +git for-each-ref \ + --color=always \ + --count=$COUNT \ + --sort=-committerdate \ + "refs/heads/" \ + --format="$format" \ + | column -ts '|' \ + | less "$lessopts" + +# The above command: +# for all known branches, +# (force coloring on this, especially since it's being piped) +# optionally, specify the number of branches you want to display +# sort descending by last commit +# show local branches (change to "" to include both local + remote branches) +# apply the formatting template above +# break into columns +# use the pager only if there's not enough space diff --git a/scripts/git-top b/scripts/git-top new file mode 100755 index 0000000..1af6569 --- /dev/null +++ b/scripts/git-top @@ -0,0 +1,12 @@ +#!/bin/bash + +# Наиболее часто изменяемые файлы git-репозитория + +git log --all -M -C --name-only --format='format:' "$@" \ + | grep . \ + | sort \ + | uniq -c \ + | sort -rn \ + | head -n 20 \ + | sed -e 's/^ //' + diff --git a/scripts/gitea-mirror b/scripts/gitea-mirror new file mode 100755 index 0000000..53a49c9 --- /dev/null +++ b/scripts/gitea-mirror @@ -0,0 +1,92 @@ +#!/bin/bash + +# Gitea repositories mirrorer + +rstc="\033[00m" +yellow="\033[1;33m" +blue="\033[1;36m" +red="\033[1;31m" + +show_help() { + echo -e "$(basename "$0") can be used to mirror all git repositories hosted on Gitea.\n" + echo -e "USAGE: $(basename "$0") -u USER -g GIT_URL ?-d DIR?\n" + + echo -e "Command line arguments:" + echo -e " -h --help show this help" + echo -e " -f --force drop all existing local changes" + echo -e " -u --user user name" + echo -e " -g --git git url" + echo -e " -p --private comma separated private repositories" + echo -e " -d --dir directory for storing files (current working directory by default)" + + echo + exit "${1:-0}" +} + +die() { + echo -e "${red}ERROR:${rstc} $*\n" + + show_help 1 +} + +git_update() { + pushd "$1" >/dev/null + + [ -n "$FORCE" ] && git checkout . 2>&- + + git fetch + git pull --all + + popd >/dev/null +} + +#------------------------------------------------------------------------------- + +UNKNOWN_ARGS=() + +[ $# -eq 0 ] && show_help + +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -h|--help) show_help;; + -d|--dir) DIRECTORY="$2"; shift; shift;; + -u|--user) USERNAME="$2"; shift; shift;; + -g|--git) GIT_URL="$2"; shift; shift;; + -p|--private) PRIVATE="$2"; shift; shift;; + -f|--force) FORCE="true"; shift;; + *) UNKNOWN_ARGS+=("$1"); shift;; + esac +done + +[ ${#UNKNOWN_ARGS} -gt 0 ] && die "Unknown parameters: ${UNKNOWN_ARGS[*]}" +[ -z "${GIT_URL+x}" ] && die "Unknown gitea URL. Use the --git cli parameter to specify it." +[ -z "${USERNAME+x}" ] && die "Unknown gitea user. Use the --user cli parameter to specify it." + +#------------------------------------------------------------------------------- + +[ -n "$DIRECTORY" ] && mkdir -p "$DIRECTORY" && cd "$DIRECTORY" + +mapfile -t REPOSITORIES < <(curl -sq -L "$GIT_URL/api/v1/users/$USERNAME/repos" | jq -r '.[].clone_url') + +if [ -n "$PRIVATE" ]; then + for repository in $(tr ',' ' ' <<<"$PRIVATE"); do + REPOSITORIES+=("https://${GIT_URL}/${USERNAME}/${repository}.git") + done +fi + +r=0 + +for repository in ${REPOSITORIES[*]}; do + repo_name=$(sed 's/\.git.*$//' <<<"${repository##*/}") + + printf "\n${yellow}#### [%02d/%02d] ${blue}%s${rstc}\n" $((++r)) "${#REPOSITORIES[@]}" "$repo_name" + + if [ ! -d "$repo_name" ]; then + git clone --progress "$repository" + fi + + git_update "$repo_name" +done + diff --git a/scripts/gitlab-ci-graph b/scripts/gitlab-ci-graph new file mode 100755 index 0000000..e6d9f8c --- /dev/null +++ b/scripts/gitlab-ci-graph @@ -0,0 +1,57 @@ +#!/bin/bash + +# +# Show graph of GitLab CI Pipeline +# + +# Requirements: +# - jq +# - python-yq (pip install yq) +# - graph-easy + +GITLAB_CI=${1:-.gitlab-ci.yml} + +if [ ! -f "$GITLAB_CI" ]; then + echo "USAGE: $(basename "$0") gitlab-ci.yml." + echo " Or run this script inside CI directory." + exit +fi + +mapfile -t stages < <(yq -c -r '.stages[]' <.gitlab-ci.yml | expand | sed -e 's/^\s*-\s\+//') 2>&- + +echo + +{ + +printf "[BEGIN] { label: '*'; } ==> "; +printf "[%s] ==> " "${stages[@]^^}"; +printf "[END] {label: '*'; }\n" + +for stage in "${stages[@]}"; do + mapfile -t jobs < <(yq -r '. as $input + | keys[] + | [., $input[.]] + | select(.[1].stage?=='\""$stage"\"') + | .[0]' <"$GITLAB_CI" 2>&-) + + for job in "${jobs[@]}"; do + echo "[${stage^^}] --> [${job}]" + + when=$(yq -c -r '.['\""$job"\"'] + | select(.when?) + | [.when] + | flatten' <"$GITLAB_CI" \ + | sed -E 's/\["|"]//g; s/","/ AND /g') + + yq -c -r '.['\""$job"\"'] + | select(.needs?) + | [.needs] + | flatten' <"$GITLAB_CI" \ + | sed "s/\"//g; s/,/],[/g; s/$/ -- $when --> { text-wrap: 10; } \[$job\]/" + done +done + +} | graph-easy + +echo + diff --git a/scripts/gitlab-ci-linter b/scripts/gitlab-ci-linter new file mode 100755 index 0000000..3fdf128 --- /dev/null +++ b/scripts/gitlab-ci-linter @@ -0,0 +1,36 @@ +#!/bin/bash + +#Создан: Чт 11 июн 2020 16:05:25 +#Изменён: пт 12 июн 2020 19:28:15 + +# +# GitLab Pipeline Linter +# +# Requirements: +# - curl +# - jq +# + +# GitLab Pipeline Linter API endpoint. Official gitlab.com by default +[ -z "$GITLAB_URL" ] && GITLAB_URL="https://gitlab.com/api/v4/ci/lint" + +PIPELINE=${1:-.gitlab-ci.yml} + +if [ ! -f "$PIPELINE" ]; then + echo "USAGE: $(basename "$0") gitlab-ci.yml." + echo " Or run this script inside CI directory." + exit +fi + +CONTENT=$(printf '{ "content": %s }' "$(jq -aRs . <"$PIPELINE")") + +RESPONSE=$(curl -sq --header "Content-Type: application/json" "$GITLAB_URL" --data "$CONTENT") + +STATUS=$(jq -r .status <<<"$RESPONSE") + +if [ "$STATUS" != "valid" ]; then + echo -n "ERROR: Pipeline $PIPELINE is invalid: " + jq -r '.errors[]' <<<"$RESPONSE" + exit 1 +fi + diff --git a/scripts/hidecursor b/scripts/hidecursor new file mode 100755 index 0000000..82ae486 --- /dev/null +++ b/scripts/hidecursor @@ -0,0 +1,11 @@ +#!/bin/bash + +#Создан: Чт 27 фев 2020 00:49:54 +#Изменён: Чт 27 фев 2020 00:52:22 + +# Скрипт помещает курсор в правый верхний угол экрана + +CURSOR_POSITION=$(xdpyinfo | awk '/dimensions:/ { gsub("x.*", " 0", $2); print $2 }') + +eval xdotool mousemove "$CURSOR_POSITION" + diff --git a/scripts/how b/scripts/how new file mode 100755 index 0000000..ab84d33 --- /dev/null +++ b/scripts/how @@ -0,0 +1,35 @@ +#!/bin/bash + +#Создан: вт 03 дек 2019 11:14:23 +#Изменён: вт 03 дек 2019 21:18:38 + +BINDIR=${SHELLRC}/bin/ + +SCRIPT=cheat.sh + +check_cheat() { + command -V "$SCRIPT" >/dev/null 2>&1 +} + +install_cheat() { + curl -sq https://cht.sh/:cht.sh > "${BINDIR}/${SCRIPT}" + + chmod +x "${BINDIR}/${SCRIPT}" + + echo "[INFO] cheat.sh has been installed to ${BINDIR}/${SCRIPT}." +} + +tip() { + if [[ $1 == @* ]]; then + CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/@/}" + elif [[ $1 == %* ]]; then + echo stealth Q | CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/\%/}" + else + CHTSH_QUERY_OPTIONS="style=borland" cheat.sh "$@" | less -R + fi +} + +check_cheat || install_cheat + +tip "$@" + diff --git a/scripts/hr b/scripts/hr new file mode 100755 index 0000000..3dfe8f7 --- /dev/null +++ b/scripts/hr @@ -0,0 +1,7 @@ +#!/bin/bash + +# Создан: Сб 05 апр 2014 11:02:41 +# Изменён: Сб 05 апр 2014 11:11:54 + +printf "$green%$(echo `tput cols` - 12 | bc)s─[$yellow`\date '+%H:%M:%S'`$green]─$rstc" | sed 's/ /─/g' + diff --git a/scripts/ibor b/scripts/ibor new file mode 100755 index 0000000..2b86fbd --- /dev/null +++ b/scripts/ibor @@ -0,0 +1,10 @@ +#!/bin/bash + +#- Чтение цитат с ibash.org.ru +curl -s http://ibash.org.ru/rss.xml | \ +iconv -c -f cp1251 -t utf8 | \ +sed 's/<\/description>//g; s/
    /\n/g; s/\</>> /g; + s/\>/:/g; s/\"/"/g; s/\s*<.*$\|\s*xmlns:.*$//g;' | \ +grep . | less + diff --git a/scripts/img50 b/scripts/img50 new file mode 100755 index 0000000..c037ac2 --- /dev/null +++ b/scripts/img50 @@ -0,0 +1,9 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:39:15 +#Изменён: Пт 26 фев 2016 21:39:15 + +#- Уменьшение размера изображения на 50% + +echo "$1"; convert -resize 50% "$1" "$1" + diff --git a/scripts/imgRL b/scripts/imgRL new file mode 100755 index 0000000..ab6514f --- /dev/null +++ b/scripts/imgRL @@ -0,0 +1,9 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:39:01 +#Изменён: Пт 26 фев 2016 21:39:01 + +#- Поворот изображения влево на 90 градусов + +echo "$1"; convert -rotate -90 "$1" "$1" + diff --git a/scripts/imgRR b/scripts/imgRR new file mode 100755 index 0000000..35e1fab --- /dev/null +++ b/scripts/imgRR @@ -0,0 +1,9 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:38:42 +#Изменён: Пт 26 фев 2016 21:38:42 + +#- Поворот изображения вправо на 90 градусов + +echo "$1"; convert -rotate 90 "$1" "$1" + diff --git a/scripts/imgview b/scripts/imgview new file mode 100755 index 0000000..e91702b --- /dev/null +++ b/scripts/imgview @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Based on script by z3bra -- 2014-01-21 + +W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" +FONTH=12 # Size of one terminal row +FONTW=11 # Size of one terminal column + +X=$1 +Y=$2 +COLUMNS=$3 +LINES=$4 +FILENAME=$5 + +read width height <<< `echo "5;$FILENAME" | $W3MIMGDISPLAY` +if [ -z "$width" -o -z "$height" ]; then + echo 'Error: Failed to obtain image size.' + exit 1 +fi + +x=$((FONTW * X)) +y=$((FONTH * Y)) + +max_width=$((FONTW * COLUMNS)) +max_height=$((FONTH * LINES)) + +if [ "$width" -gt "$max_width" ]; then + height=$((height * max_width / width)) + width=$max_width +fi +if [ "$height" -gt "$max_height" ]; then + width=$((width * max_height / height)) + height=$max_height +fi + +w3m_command="0;1;$x;$y;$width;$height;;;;;$FILENAME\n4;\n3;" + +echo -e "$w3m_command" | $W3MIMGDISPLAY + diff --git a/scripts/lsi b/scripts/lsi new file mode 100755 index 0000000..f9d5562 --- /dev/null +++ b/scripts/lsi @@ -0,0 +1,73 @@ +#!/bin/bash + +#Создан: Пт 29 янв 2016 11:11:27 +#Изменён: Пт 29 янв 2016 12:54:41 + +# Идея z3bra -- 2014-01-21: http://blog.z3bra.org/2014/01/images-in-terminal.html +# Доработка envrm + +W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" +FONTH=12 # Size of one terminal row +FONTW=8 # Size of one terminal column +COLUMNS=`tput cols` +LINES=`tput lines` + +#Все позиции захардкорены +posx[1]=10; posx[2]=205; posx[3]=400; posx[4]=600; posx[5]=800; posx[6]=1000 +posy[1]=45; posy[2]=200; posy[3]=350; posy[4]=500; posy[5]=800; posy[6]=1000 +text[1]=18; text[2]=36; text[3]=54; text[4]=72; text[5]=90; text[6]=111 + +row[1]=0; row[2]=100; row[3]=200; row[4]=300; row[5]=300 + +x=1 +y=1 +img=1 +images=24 + +clear +echo -e "\n \033[1;32m$(pwd):\033[00m" + +for FILENAME in ${*:-*}; { + #Обработка только изображений + file "$FILENAME" | grep 'JPEG|PNG|GIF' 2>&1 >/dev/null + + if [ $? -eq 0 ]; then + read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` + + max_width=$(($FONTW * $COLUMNS)) + max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt + + if test $width -gt $max_width; then + height=$(($height * $max_width / $width)) + width=$max_width + fi + + if test $height -gt $max_height; then + width=$(($width * $max_height / $height)) + height=$max_height + fi + + width=$((width / 4)) + height=$((height / 4)) + + w3m_command="0;1;${posx[x]};${posy[y]};$width;$height;;;;;$FILENAME\n4;\n3;" + + tput cup $((($height+${row[y]})/$FONTH)) ${text[$((x-1))]} + echo " $FILENAME" + echo -n -e $w3m_command|$W3MIMGDISPLAY + + if [ $x -eq 6 ]; then + x=1 + y=$((y + 1)) + else + x=$((x + 1)) + fi + + if [ $img -eq $images ]; then + exit + else + img=$((img + 1)) + fi + fi +} + diff --git a/scripts/lsimage b/scripts/lsimage new file mode 100755 index 0000000..32f56ce --- /dev/null +++ b/scripts/lsimage @@ -0,0 +1,20 @@ +#!/bin/bash + +#Создан: Пт 29 янв 2016 11:11:27 +#Изменён: Чт 12 апр 2018 11:08:24 + +COLUMNS=`tput cols` +LINES=`tput lines` + +FILENAME="$1" + +clear +printf "\e]20;;100x100+1000+1000\a" + +#Обработка только изображений +file "$FILENAME" | grep 'jpg|JPEG|png|PNG|GIF' 2>&1 >/dev/null + +if [ $? -eq 0 ]; then + printf "\\e]20;${FILENAME};$((LINES/2))x$((LINES/2))+$((COLUMNS/3+10))+$((LINES/3)):op=keep-aspect\a" +fi + diff --git a/scripts/lsimg b/scripts/lsimg new file mode 100755 index 0000000..71043a0 --- /dev/null +++ b/scripts/lsimg @@ -0,0 +1,54 @@ +#!/bin/bash + +#Создан: Пт 29 янв 2016 11:11:27 +#Изменён: Пт 30 июн 2017 22:58:09 + +# Идея z3bra -- 2014-01-21: http://blog.z3bra.org/2014/01/images-in-terminal.html +# Доработка envrm + +W3MIMGDISPLAY="/usr/libexec/w3m/w3mimgdisplay" +FONTH=12 # Size of one terminal row +FONTW=8 # Size of one terminal column +COLUMNS=`tput cols` +LINES=`tput lines` + +#Все позиции захардкорены +posx[1]=750; posx[2]=750 +posy[1]=100; posy[2]=100 + +row[1]=0 + +x=1 +y=1 +img=1 +images=24 + +FILENAME="$1" + +clear + +#Обработка только изображений +file "$FILENAME" | grep 'JPEG|PNG|GIF' 2>&1 >/dev/null + +if [ $? -eq 0 ]; then + read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` + + max_width=$(($FONTW * $COLUMNS)) + max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt + + if test $width -gt $max_width; then + height=$(($height * $max_width / $width)) + width=$max_width + fi + + if test $height -gt $max_height; then + width=$(($width * $max_height / $height)) + height=$max_height + fi + + w3m_command="0;1;${posx[x]};${posy[y]};$width;$height;;;;;$FILENAME\n4;\n3;" + + tput cup $((($height+${row[y]})/$FONTH)) ${text[$((x-1))]} + echo -n -e $w3m_command|$W3MIMGDISPLAY +fi + diff --git a/scripts/mem b/scripts/mem new file mode 100755 index 0000000..2fe9e06 --- /dev/null +++ b/scripts/mem @@ -0,0 +1,23 @@ +#!/bin/bash + +#- Заметки +memfile=$SHELLRC/var/memory/mem +case "$1" in + -h) printf "\tКлючи:\n\ + -e\t-Редактирование записей\n\ + -l n\t-Последние n записей\n\ + -s\t-Поиск по записям\n\ + -remove\t-Удалить запись по номеру\n\ + -clear\t-Удалить все записи\n\ + -h\t-Справка\n";; + + -e) $EDITOR "$memfile";; + -l) tail -"$2" "$memfile" | nl | \grep --color -E '.{1,}==>';; + -s) grep "$2" "$memfile" | nl | \grep --color -E '.{1,}==>';; + -remove) sed "$2d" -i "$memfile";; + -clear) > "$memfile";; + '') cat "$memfile" | nl | \grep --color -E '.{1,}==>';; + *) printf "[ `\date '+%d.%m.%Y %H:%M:%S'` ] ==> $*\n" >> $memfile && printf \ + "${green}Заметка${yellow} $* ${green}успешно добавлена\n${rstc}" +esac + diff --git a/scripts/mptk b/scripts/mptk new file mode 100755 index 0000000..ae9b2fe --- /dev/null +++ b/scripts/mptk @@ -0,0 +1,58 @@ +#!/usr/bin/env tclsh + +# Ghetto MPD controller + +package require Tk + +set music_directory "/mnt/DATA/Музыка/" + +array set buttons { + prev 玲 + toggle ▶ + next 怜 +} + +proc mpc {args} { + exec mpc {*}$args +} + +proc current_file {} { + lindex [split [exec mpc -f {%file%}] "\n"] 0 +} + +proc rate {rating} { + set filename [file join $::music_directory [current_file]] + + exec mid3v2 --delete-frames=COMM $filename + exec mid3v2 --COMM $rating $filename + + mpc update +} + +proc update_status {} { + set ::mpd_status [mpc] + after 500 update_status +} + +update_status + +frame .status +frame .rating -pady 10 +frame .control -pady 10 + +pack .status -fill x -expand true -padx 20 -pady 20 +pack [label .status.current -font {Sans 20} -textvariable ::mpd_status] + +pack .rating +foreach rating {1 2 3 4 5 5+} { + pack [button .rating.$rating -text $rating -font {Sans 60} -width 2 -command "rate $rating"] -side left +} + +pack .control +foreach btn {prev toggle next} { + pack [button .control.$btn -text $buttons($btn) -font {Sans 80} -width 4 -command "mpc $btn"] -side left +} + +bind . exit +bind . exit + diff --git a/scripts/musca_status b/scripts/musca_status new file mode 100755 index 0000000..889a37c --- /dev/null +++ b/scripts/musca_status @@ -0,0 +1,4 @@ +#!/bin/bash + +/usr/bin/musca -c 'silent show groups' 2>/dev/null | cut -f 2- -d ' ' | sed -e :a -e '$b;N;s/\n/ | /;ba' | sed 's/- //g;s/\*/✻/g' + diff --git a/scripts/nt b/scripts/nt new file mode 100755 index 0000000..15471ff --- /dev/null +++ b/scripts/nt @@ -0,0 +1,20 @@ +#!/bin/bash + +#Создан: Ср 24 фев 2016 19:47:47 +#Изменён: Ср 24 фев 2016 21:34:57 + +#Чтение библии с помощью SWORD на двух языках + +BOOK=${1:-Jn} +CHAPTER=${2:-} + +B1="$(diatheke -b VulgSistine -k $BOOK $CHAPTER)" +B2="$(diatheke -b RusVZh -k $BOOK $CHAPTER)" + +n=$(echo "$B1" | wc -l) + +for i in $(seq $n); { + echo "$B1" | sed -n ${i}p | sed 's/ */ /g' + echo "$B2" | sed -n ${i}p | sed 's/ */ /g' +} + diff --git a/scripts/passgen b/scripts/passgen new file mode 100755 index 0000000..37078a7 --- /dev/null +++ b/scripts/passgen @@ -0,0 +1,12 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:33:55 +#Изменён: Пт 26 фев 2016 21:33:55 + +#- Генератор паролей + +for i in `seq ${2:-10}`; { + "$1.gz";; + zip) zip -r "$1.zip" "$1";; + 7z) 7za a "$1.7z" "$1";; +esac + diff --git a/scripts/pomodoro b/scripts/pomodoro new file mode 100755 index 0000000..715bcad --- /dev/null +++ b/scripts/pomodoro @@ -0,0 +1,27 @@ +#!/bin/bash + +#Создан: Ср 17 фев 2016 13:08:24 +#Изменён: Ср 16 мар 2016 11:16:15 + +TIME=${1:-25} +TYPE=${2:-Прочее} +LOGF="$SHELLRC/var/log/pomodoro.log" + +echo "Сосредоточьтесь на $TIME минут." +notify-send -i task-due "$TYPE :: $TIME минут" "Сосредоточьтесь" + +printf "Осталось времени: %02d:00" $TIME + +for m in $(seq $(($TIME-1)) -1 0); do + for s in $(seq 59 -1 0); do + printf "\b\b\b\b\b%02d:%02d" $m $s + sleep 1s + done +done + +echo "\nПрошло $TIME минут. Можно отдохнуть." +notify-send -i trophy-gold -t 0 "Прошло $TIME минут." "Можно отдохнуть." +play -v 0.5 $SHELLRC/var/sounds/done.ogg > /dev/null 2> /dev/null + +echo "$(\date "+%d.%m.%Y :: %H:%M") :: $(printf '%02d' $TIME) м. :: $TYPE" >> "$LOGF" + diff --git a/scripts/poweroff-dialog b/scripts/poweroff-dialog new file mode 100755 index 0000000..581a28a --- /dev/null +++ b/scripts/poweroff-dialog @@ -0,0 +1,25 @@ +#!/bin/bash + +#Создан: Вт 23 фев 2016 14:25:37 +#Изменён: Вт 23 фев 2016 15:20:53 + +action=$(yad --width 300 --height 500 --title "Остановка системы" \ + --image=gnome-shutdown \ + --button="Выключение:2" \ + --button="Перезагрузка:3" \ + --button="Спящий режим:4" \ + --button="gtk-close:1") +ret=$? + +case $? in + 1) exit 0;; + 2) shutdown -h now;; + 3) shutdown -r now;; + 4) dbus-send --system \ + --print-reply \ + --dest="org.freedesktop.UPower" \ + /org/freedesktop/UPower org.freedesktop.UPower.Suspend;; +esac + +exit 0 + diff --git a/scripts/radio b/scripts/radio new file mode 100755 index 0000000..037f984 --- /dev/null +++ b/scripts/radio @@ -0,0 +1,28 @@ +#!/bin/sh + +#Сценарий прослушивания радиостанций +#Формат списка: name;playlist + +STATIONS=$SHELLRC/etc/soft/radio/stations + +plays() { + echo $1 + PLAYLIST=$(cat $STATIONS | grep "$1" | cut -d ';' -f 2) + + echo $PLAYLIST | grep 'http' + + if [ $? -eq 0 ]; then + killall play 2>/dev/null + STREAM=$(curl -s $PLAYLIST | grep 'http://' | sed 's/^.*http/http/' | head -n 1) + curl $STREAM | play -q -v 0.3 -t mp3 - + fi +} + +CH=$(cat $STATIONS | cut -d ';' -f 1 | dmenu -fn '-*-fixed-*-*-*-*-15-*-*-*-*-*-*-*' -l 10) + +notify-send -i audio-x-generic "Радио: $CH" +case $CH in + STOP) killall play 2>/dev/null;; + *) plays "$CH";; +esac + diff --git a/scripts/renamepdfs b/scripts/renamepdfs new file mode 100755 index 0000000..8c6f4ae --- /dev/null +++ b/scripts/renamepdfs @@ -0,0 +1,39 @@ +#!/bin/bash + +# Интерактивное переименование PDF-файлов, используя информацию из метаданных + +filelist() { + for f in "$@"; do + echo "\"$f\"" + done +} + +DIR=$(pwd) + +FILES=() + +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -d|--directory) + DIR="$2" + shift # past argument + shift # past value + ;; + *) + FILES+=("$1") # save it in an array for later + shift # past argument + ;; + esac +done + +set -- "${FILES[@]}" + +if [ "${#FILES[@]}" -gt 0 ]; then + filelist "${FILES[@]}" | viper +'set ft=rename' +"let b:rename_dir=\"$DIR\"" | sed "s/^/mv /" | sh +else + echo "USAGE: $(basename $0) [-d/--directory ] file1.pdf file2.pdf [...]" + exit 1 +fi + diff --git a/scripts/retag b/scripts/retag new file mode 100755 index 0000000..3aea528 --- /dev/null +++ b/scripts/retag @@ -0,0 +1,101 @@ +#!/bin/bash + +#Создан: Ср 19 фев 2020 21:59:29 +#Изменён: Чт 20 фев 2020 00:45:38 + +# Requirements: +# - mid3v2 from media-libs/mutagen + +rstc="\033[00m" +green="\033[1;32m" +yellow="\033[1;33m" +blue="\033[1;34m" + +REGEXP=".*/(.*)/(.*) \[(.*)\]/(.*)/(.*?) - (.*)/(.*?) - (.*)\.([[:alnum:]]{3})$" + +usage() { + echo "$(basename "$0") - simple mp3 tagger." + echo + echo "USAGE: $(basename "$0") [file] [options]" + echo + echo "The filenames should be in the format \"[...]/GENRE/ARTIST [COUNTRY]/TYPE/YEAR - ALBUM/TRACK - TITLE.FORMAT\"" + echo + echo "Command line arguments:" + echo " -h --help - show this help" + echo " -v --verbose - show updating tags" + echo " -d --dry - run without tags saving" +} + +tag_file() { + file="$1" + + [[ $file =~ $REGEXP ]] + + printf "${blue}%s[%02d/%02d] ${yellow}Tagging the file «%s»${rstc}\n" "$INDENT" "$((++CURRENT_TRACK))" "$TRACKS" "$file" + + GENRE="${BASH_REMATCH[1]}" + ARTIST="${BASH_REMATCH[2]}" + YEAR="${BASH_REMATCH[5]}" + ALBUM="${BASH_REMATCH[6]}" + TRACK="${BASH_REMATCH[7]}" + TITLE="${BASH_REMATCH[8]}" + + if [ -n "$VERBOSE" ]; then + printf "%s\t Genre: %s | Artist: %s |" "$INDENT" "$GENRE" "$ARTIST" + printf "Year: %s | Album: %s |" "$YEAR" "$ALBUM" + printf "Track: %s | Title: %s\n" "$TRACK" "$TITLE" + fi + + if [ -z "$DRY_RUN" ]; then + mid3v2 --genre="$GENRE" --artist="$ARTIST" --year="$YEAR" \ + --album="$ALBUM" --track="$TRACK" --song="$TITLE" \ + "$file" + fi +} + +tag_directory() { + TRACKS=$(find "$1" -name '*.mp3' -print | wc -l) + + printf "${green}> %s/${rstc}\n" "$1" + INDENT=" " + + + find "$1" -name '*.mp3' | while read -r file; do tag_file "$file"; done +} + +tag() { + if [[ -d "$1" ]]; then + tag_directory "$1" + elif [[ "$1" =~ \.mp3 ]]; then + tag_file "$1" + fi +} + +if (( $# == 0 )); then + usage + exit 1 +fi + +QUEUE=() + +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -h|--help) usage; exit 0; shift;; + -v|--verbose) VERBOSE=1; shift;; + -d|--dry) DRY_RUN=1; VERBOSE=1; shift;; + *) QUEUE+=("$1"); shift;; + esac +done + +set -- "${QUEUE[@]}" + +INDENT= +TRACKS="$#" +CURRENT_TRACK=0 + +for item in "${QUEUE[@]}"; do + tag "$(realpath "$item")" +done + diff --git a/scripts/robodoc2html b/scripts/robodoc2html new file mode 100755 index 0000000..f87e57e --- /dev/null +++ b/scripts/robodoc2html @@ -0,0 +1,18 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:33:26 +#Изменён: Пт 26 фев 2016 21:33:26 + +#- Создание документации robodoc + +mkdir -p ${1:-.}/doc +robodoc --src ${1:-.} --doc ./doc/ --multidoc \ + --html \ + --charset utf-8 \ + --index \ + --nosort \ + --sections \ + --source_line_numbers + # --syntaxcolors + # --nopre \ + diff --git a/scripts/spread b/scripts/spread new file mode 100755 index 0000000..be68f13 --- /dev/null +++ b/scripts/spread @@ -0,0 +1,16 @@ +#!/bin/bash + +#Создан: Пт 24 июн 2016 14:34:58 +#Изменён: Пт 21 фев 2020 11:49:12 + +if [ ! -z $1 ]; then + DATA=$(cat "$@") +else + DATA=$(cat -) +fi + +\rm -rf /tmp/*.speedreading +echo "$DATA" > /tmp/$$.speedreading + +st -e bash -c "fsz 37 && tput clear && tput cup 7 && echo && speedread /tmp/$$.speedreading 2>/dev/null && read" + diff --git a/scripts/sync-date b/scripts/sync-date new file mode 100755 index 0000000..7a3525a --- /dev/null +++ b/scripts/sync-date @@ -0,0 +1,6 @@ +#!/bin/bash + +# (c) https://unix.stackexchange.com/a/251575 + +date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //')" + diff --git a/scripts/th b/scripts/th new file mode 100755 index 0000000..48e42ee --- /dev/null +++ b/scripts/th @@ -0,0 +1,13 @@ +#!/bin/bash + +#Создан: Вт 27 янв 2015 21:41:37 +#Изменён: Ср 20 янв 2016 11:59:05 + +#Создание миниатюр изображений + +mkdir -p "${1:-.}/th"; +for i in *.jpg; { + convert -define jpeg:size=95x95 "$i" -thumbnail 95x95^ \ + -gravity center -extent 95x95 "th/$i" +} + diff --git a/scripts/todolist b/scripts/todolist new file mode 100755 index 0000000..4956e6e --- /dev/null +++ b/scripts/todolist @@ -0,0 +1,14 @@ +#!/bin/bash + +# Find all TODO: marks in current git repository + +[ -n "$1" ] && cd "$1" + +if git rev-parse --show-toplevel &>/dev/null; then + grep -n -R "^[[:space:]]*[#/\";-]*[[:space:]]*TODO:" . \ + | expand \ + | sed -r 's/([[:digit:]]):/\1:@@ /' \ + | tr -s ' ' \ + | column -t -s '@@' +fi + diff --git a/scripts/tree2md b/scripts/tree2md new file mode 100755 index 0000000..e8d5f43 --- /dev/null +++ b/scripts/tree2md @@ -0,0 +1,18 @@ +#!/bin/bash + +#Создан: пн 21 окт 2019 22:39:13 +#Изменён: ср 11 дек 2019 15:01:28 + +# +# Создание markdown-списка из дерева файлов +# +# NB: Иногда отображает неправильный уровень вложенности директорий +# + +# Идея: https://stackoverflow.com/a/35889620 + +tree=$(\tree -f --noreport -I '*~' --charset ascii -L "${2:-3}" "${1:-.}" | + sed -E 's/\| +/ /g; s/[|`]-+/ */g; s:\* ((.*/)([^/]+)):- [\3](\1):g; s/ //') + +printf "%s\n" "$tree" + diff --git a/scripts/use b/scripts/use new file mode 100755 index 0000000..539c5d4 --- /dev/null +++ b/scripts/use @@ -0,0 +1,10 @@ +#!/bin/bash + +#Создан: Вт 25 фев 2020 18:24:10 +#Изменён: Вт 25 фев 2020 18:30:29 + +# Show Gentoo USE flag description + +curl -sq "https://packages.gentoo.org/useflags/${1?USAGE: $(basename "$0") [use flag]}" \ + | awk '/class="lead"/{getline; gsub(/^[ \t]+/, "", $0); print}' + diff --git a/scripts/utable b/scripts/utable new file mode 100755 index 0000000..0adcd3a --- /dev/null +++ b/scripts/utable @@ -0,0 +1,157 @@ +#!/usr/bin/env tclsh + +#Создан: Вт 06 июл 2010 19:18:44 +#Изменён: Чт 22 июл 2010 19:27:09 + +#---------------------------------------------------------------------------+ +# | +# Скрипт отображает символы Unicode. | +# | +# Использование: utable [класс символов] | +# | +# Copyrignt (c) 2010-2013, Likhachev Maxim, <> | +# | +#---------------------------------------------------------------------------+ + +#Классы символов Unicode +array set category { + Basic_Latin {"Basic_Latin" 0x0000 0x007F} + Latin-1_Supplement {"Latin-1_Supplement" 0x0080 0x00FF} + Latin_Extended-A {"Latin_Extended-A" 0x0100 0x017F} + Latin_Extended-B {"Latin_Extended-B" 0x0180 0x024F} + IPA_Extensions {"IPA_Extensions" 0x0250 0x02AF} + Spacing_Modifier_Letters {"Spacing_Modifier_Letters" 0x02B0 0x02FF} + Combining_Diacritical_Marks {"Combining_Diacritical_Marks" 0x0300 0x036F} + Greek_and_Coptic {"Greek_and_Coptic" 0x0370 0x03FF} + Cyrillic {"Cyrillic" 0x0400 0x04FF} + Cyrillic_Supplementary {"Cyrillic_Supplementary" 0x0500 0x052F} + Armenian {"Armenian" 0x0530 0x058F} + Hebrew {"Hebrew" 0x0590 0x05FF} + Arabic {"Arabic" 0x0600 0x06FF} + Syriac {"Syriac" 0x0700 0x074F} + Thaana {"Thaana" 0x0780 0x07BF} + Devanagari {"Devanagari" 0x0900 0x097F} + Bengali {"Bengali" 0x0980 0x09FF} + Gurmukhi {"Gurmukhi" 0x0A00 0x0A7F} + Gujarati {"Gujarati" 0x0A80 0x0AFF} + Oriya {"Oriya" 0x0B00 0x0B7F} + Tamil {"Tamil" 0x0B80 0x0BFF} + Telugu {"Telugu" 0x0C00 0x0C7F} + Kannada {"Kannada" 0x0C80 0x0CFF} + Malayalam {"Malayalam" 0x0D00 0x0D7F} + Sinhala {"Sinhala" 0x0D80 0x0DFF} + Thai {"Thai" 0x0E00 0x0E7F} + Lao {"Lao" 0x0E80 0x0EFF} + Tibetan {"Tibetan" 0x0F00 0x0FFF} + Myanmar {"Myanmar" 0x1000 0x109F} + Georgian {"Georgian" 0x10A0 0x10FF} + Hangul_Jamo {"Hangul_Jamo" 0x1100 0x11FF} + Ethiopic {"Ethiopic" 0x1200 0x137F} + Cherokee {"Cherokee" 0x13A0 0x13FF} + Unified_Canadian_Aboriginal_Syllabics {"Unified_Canadian_Aboriginal_Syllabics" 0x1400 0x167F} + Ogham {"Ogham" 0x1680 0x169F} + Runic {"Runic" 0x16A0 0x16FF} + Tagalog {"Tagalog" 0x1700 0x171F} + Hanunoo {"Hanunoo" 0x1720 0x173F} + Buhid {"Buhid" 0x1740 0x175F} + Tagbanwa {"Tagbanwa" 0x1760 0x177F} + Khmer {"Khmer" 0x1780 0x17FF} + Mongolian {"Mongolian" 0x1800 0x18AF} + Limbu {"Limbu" 0x1900 0x194F} + Tai_Le {"Tai_Le" 0x1950 0x197F} + Khmer_Symbols {"Khmer_Symbols" 0x19E0 0x19FF} + Phonetic_Extensions {"Phonetic_Extensions" 0x1D00 0x1D7F} + Latin_Extended_Additional {"Latin_Extended_Additional" 0x1E00 0x1EFF} + Greek_Extended {"Greek_Extended" 0x1F00 0x1FFF} + General_Punctuation {"General_Punctuation" 0x2000 0x206F} + Superscripts_and_Subscripts {"Superscripts_and_Subscripts" 0x2070 0x209F} + Currency_Symbols {"Currency_Symbols" 0x20A0 0x20CF} + Combining_Diacritical_Marks_for_Symbols {"Combining_Diacritical_Marks_for_Symbols" 0x20D0 0x20FF} + Letterlike_Symbols {"Letterlike_Symbols" 0x2100 0x214F} + Number_Forms {"Number_Forms" 0x2150 0x218F} + Arrows {"Arrows" 0x2190 0x21FF} + Mathematical_Operators {"Mathematical_Operators" 0x2200 0x22FF} + Miscellaneous_Technical {"Miscellaneous_Technical" 0x2300 0x23FF} + Control_Pictures {"Control_Pictures" 0x2400 0x243F} + Optical_Character_Recognition {"Optical_Character_Recognition" 0x2440 0x245F} + Enclosed_Alphanumerics {"Enclosed_Alphanumerics" 0x2460 0x24FF} + Box_Drawing {"Box_Drawing" 0x2500 0x257F} + Block_Elements {"Block_Elements" 0x2580 0x259F} + Geometric_Shapes {"Geometric_Shapes" 0x25A0 0x25FF} + Miscellaneous_Symbols {"Miscellaneous_Symbols" 0x2600 0x26FF} + Dingbats {"Dingbats" 0x2700 0x27BF} + Miscellaneous_Mathematical_Symbols-A {"Miscellaneous_Mathematical_Symbols-A" 0x27C0 0x27EF} + Supplemental_Arrows-A {"Supplemental_Arrows-A" 0x27F0 0x27FF} + Braille_Patterns {"Braille_Patterns" 0x2800 0x28FF} + Supplemental_Arrows-B {"Supplemental_Arrows-B" 0x2900 0x297F} + Miscellaneous_Mathematical_Symbols-B {"Miscellaneous_Mathematical_Symbols-B" 0x2980 0x29FF} + Supplemental_Mathematical_Operators {"Supplemental_Mathematical_Operators" 0x2A00 0x2AFF} + Miscellaneous_Symbols_and_Arrows {"Miscellaneous_Symbols_and_Arrows" 0x2B00 0x2BFF} + CJK_Radicals_Supplement {"CJK_Radicals_Supplement" 0x2E80 0x2EFF} + Kangxi_Radicals {"Kangxi_Radicals" 0x2F00 0x2FDF} + Ideographic_Description_Characters {"Ideographic_Description_Characters" 0x2FF0 0x2FFF} + CJK_Symbols_and_Punctuation {"CJK_Symbols_and_Punctuation" 0x3000 0x303F} + Hiragana {"Hiragana" 0x3040 0x309F} + Katakana {"Katakana" 0x30A0 0x30FF} + Bopomofo {"Bopomofo" 0x3100 0x312F} + Hangul_Compatibility_Jamo {"Hangul_Compatibility_Jamo" 0x3130 0x318F} + Kanbun {"Kanbun" 0x3190 0x319F} + Bopomofo_Extended {"Bopomofo_Extended" 0x31A0 0x31BF} + Katakana_Phonetic_Extensions {"Katakana_Phonetic_Extensions" 0x31F0 0x31FF} + Enclosed_CJK_Letters_and_Months {"Enclosed_CJK_Letters_and_Months" 0x3200 0x32FF} + CJK_Compatibility {"CJK_Compatibility" 0x3300 0x33FF} + CJK_Unified_Ideographs_Extension_A {"CJK_Unified_Ideographs_Extension_A" 0x3400 0x4DBF} + Yijing_Hexagram_Symbols {"Yijing_Hexagram_Symbols" 0x4DC0 0x4DFF} + CJK_Unified_Ideographs {"CJK_Unified_Ideographs" 0x4E00 0x9FFF} + Yi_Syllables {"Yi_Syllables" 0xA000 0xA48F} + Yi_Radicals {"Yi_Radicals" 0xA490 0xA4CF} + Hangul_Syllables {"Hangul_Syllables" 0xAC00 0xD7AF} + High_Surrogates {"High_Surrogates" 0xD800 0xDB7F} + High_Private_Use_Surrogates {"High_Private_Use_Surrogates" 0xDB80 0xDBFF} + Low_Surrogates {"Low_Surrogates" 0xDC00 0xDFFF} + Private_Use_Area {"Private_Use_Area" 0xE000 0xF8FF} + CJK_Compatibility_Ideographs {"CJK_Compatibility_Ideographs" 0xF900 0xFAFF} + Alphabetic_Presentation_Forms {"Alphabetic_Presentation_Forms" 0xFB00 0xFB4F} + Arabic_Presentation_Forms-A {"Arabic_Presentation_Forms-A" 0xFB50 0xFDFF} + Variation_Selectors {"Variation_Selectors" 0xFE00 0xFE0F} + Combining_Half_Marks {"Combining_Half_Marks" 0xFE20 0xFE2F} + CJK_Compatibility_Forms {"CJK_Compatibility_Forms" 0xFE30 0xFE4F} + Small_Form_Variants {"Small_Form_Variants" 0xFE50 0xFE6F} + Arabic_Presentation_Forms-B {"Arabic_Presentation_Forms-B" 0xFE70 0xFEFF} + Halfwidth_and_Fullwidth_Forms {"Halfwidth_and_Fullwidth_Forms" 0xFF00 0xFFEF} + Specials {"Specials" 0xFFF0 0xFFFF} +} + +#Перевод из шестнадцатеричной системы в десятичную +proc hex2dec {code} { return [format "%d" $code]} + +#Выбор наборов символов по маске +proc getCharsets {rgx} { + if {$rgx eq "-b"} { set rgx {math|arrow|misc} } + + set charsetList {} + foreach charset [lsort [array names ::category]] { + if {[regexp "(?i).*($rgx).*" $charset]} { + lappend charsetList $charset + } + } + return $charsetList +} + +#Вывод таблицы символов +proc showUTFCodes {charset} { + foreach {category start end} $::category($charset) {} + + for {set i [hex2dec $start]} {$i <= [hex2dec $end]} {incr i} { + set char [format "%c" $i] + if {[regexp {[^[:space:]]} $char match]} { + puts [format "%-40s%#5x: %s" $category $i $char] + } + } +} + +#-------------------------------------------- +foreach charset [getCharsets [lindex $argv 0]] { + catch {showUTFCodes $charset} +} + diff --git a/scripts/vandroucli b/scripts/vandroucli new file mode 100755 index 0000000..da63192 --- /dev/null +++ b/scripts/vandroucli @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# Copyright (C) 2019, Maxim Lihachev, +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +# Получение последних записей с сайта vandrouki.ru + +declare -A URLS=( + ["asia"]="https://vandrouki.asia" + ["by"]="https://vandrouki.by" + ["ru"]="https://vandrouki.ru" +) + +get_info() { + echo -e ">> $1 $rstc\n" + + curl -s -q "$1" \ + | sed 's/&- \ + | awk \ + 'BEGIN { + RS=""; + text=""; + + rstc="\033[00m"; + yellow="\033[1;33m"; + blue="\033[1;34m"; + green="\033[1;32m"; + } + + function tokenize(html) { + gsub(/\n+/, "@", html); + gsub(/

    /, "\n", html); + gsub(/(href=")|(" rel=[^>]*>)|(published.>)/, "@", html); + gsub(/(&#[0-9]+;)|(<[^@>]*>*)/, "", html); + gsub(/@\s*@*/, "@", html); + gsub(/\r/, "", html); + + return html; + } + + { + text = text"\n"tokenize($0); + } + + END { + split(text, lines, "\n") + + for (line in lines) { + split(lines[line], article, "@") + + if (article[4] ~ /^\s*$/) { + date = article[5] + } else { + date = article[4] + } + + if (article[3] !~ /^\s*$/) { + print blue " # " date "\t" yellow article[3] "\n\t\t" green article[2] rstc + } + } + + print "\n--------------------------------\n" + }' +} + +domains="${*:-.}" +filter=${domains// /|} + +if [[ "$filter" =~ -h|--h ]]; then + echo "USAGE: $(basename "$0") ?domains? [ru, by, asia]" + exit 0 +fi + +for url in "${URLS[@]}"; do + if [[ "$url" =~ $filter ]]; then + get_info "$url" + fi +done + diff --git a/scripts/vault-kv-tree b/scripts/vault-kv-tree new file mode 100755 index 0000000..ffeaf17 --- /dev/null +++ b/scripts/vault-kv-tree @@ -0,0 +1,71 @@ +#!/bin/bash + +# Copyright (C) 2020, Maxim Lihachev, +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +# +# Show all Vault paths and keys recursively +# +# Requirements: +# - vault-cli +# - jq +# + +export VAULT_ADDR=${VAULT_ADDR:-http://127.0.0.1:8200} + +rstc="\033[00m" +blue="\033[0;36m" +green="\033[1;32m" + +vault_list() { + vault kv list -format=yaml "$1" +} + +vault_keys() { + path=${1//\/\//\/} + keys=$(vault kv get -format=json "$path" 2>&- | jq -r -j '.data.data | keys | join("\n")' 2>&-) + + if [ -n "$keys" ]; then + while read -r key; do + echo -e "${blue}${path}/${green}${key}$rstc" + done <<<"$keys" + fi +} + +vault_tree() { + path=${1//\/\//\/} + list=$(vault_list "$path") + + echo -e "${blue}${path}${rstc}" + + if [ -n "$list" ] && [ "$list" != '{}' ]; then + while read -r dir; do + # printf "%s%s\n" "$INDENT" "$dir" + # echo "LIST ${path}/${dir#- }" + ( vault_tree "${path}/${dir#- }"; ) + done <<<"$list" + # INDENT+=" " + else + : + vault_keys "$path" + fi +} + +if [ $# -eq 0 ]; then + echo "USAGE: $(basename "$0") [path]" + exit 1 +else + vault_tree "$1" +fi + diff --git a/scripts/vcat b/scripts/vcat new file mode 100755 index 0000000..c0fc5d0 --- /dev/null +++ b/scripts/vcat @@ -0,0 +1,13 @@ +#!/bin/bash + +#- Вывод файлов с подсветкой синтаксиса +srchl="source-highlight -f esc --line-number=' ' --style-file=$SHELLRC/etc/soft/source-hl/default.style" + +if [[ "${1##*/}" == .* ]]; then + eval $srchl -i "$1" --src-lang=sh +else + eval $srchl -i "$1" +fi 2> /dev/null || eval $srchl -i "$1" --src-lang=lisp + +echo + diff --git a/scripts/viper b/scripts/viper new file mode 100755 index 0000000..96bbf26 --- /dev/null +++ b/scripts/viper @@ -0,0 +1,12 @@ +#!/bin/bash + +TMPFILE=$(mktemp /tmp/viper.XXXXXXXX) +cat > "$TMPFILE" +$EDITOR "$@" "$TMPFILE" < /dev/tty > /dev/tty + +if [ "$?" -eq 0 ]; then + cat "$TMPFILE" +fi + +\rm -f "$TMPFILE" + diff --git a/scripts/vls b/scripts/vls new file mode 100755 index 0000000..4936feb --- /dev/null +++ b/scripts/vls @@ -0,0 +1,18 @@ +#!/bin/bash + +#Создан: Пт 26 фев 2016 21:04:00 +#Изменён: Чт 05 окт 2017 13:15:44 + +#- vlc-ncurses с увеличенной скоростью воспроизведения + +speed=${1%%[^+0-9]*} + +if [ ! -z "$speed" ]; then + shift + rate=$(echo "1.0 + 0.${speed//+}" | bc -l) +else + rate="1.0" +fi + +vlc --rate $rate -I ncurses --no-color ${@:-*.mp3} + diff --git a/scripts/windows b/scripts/windows new file mode 100755 index 0000000..93c4d89 --- /dev/null +++ b/scripts/windows @@ -0,0 +1,13 @@ +#!/bin/bash + +#Создан: Ср 13 дек 2017 17:10:30 +#Изменён: Ср 13 дек 2017 17:29:17 + +WINDOW=$(wmctrl -l | rofi -dmenu -hide-scrollbar -columns 8 -location 1 -width 100 -i -p "window:") + +WINDOW_ID="$(echo "$WINDOW" | awk '{print $1}')" + +if [ ! -z "$WINDOW_ID" ]; then + wmctrl -i -a "$WINDOW_ID" +fi + diff --git a/scripts/writeup b/scripts/writeup new file mode 100755 index 0000000..1d52a3a --- /dev/null +++ b/scripts/writeup @@ -0,0 +1,18 @@ +#!/bin/bash + +write() { + # urxvtc -fn 'xft:TrixiePro:pixelsize=20' \ + # -e bash -c "vim '+colorscheme $1' '+Goyo 60%' $2" + st -f 'TrixiePro:pixelsize=30' \ + -e bash -c "nvim '+colorscheme $1' '+Goyo 60%' $2" +} + +WRITE_DIR="$HOME/FILES/Docs/WRITE/" +WRITE_FILE=$(cd "$WRITE_DIR" && \ls -d */* | grep -v nohup.out | rofi -dmenu) + +if [ -z "$WRITE_FILE" ]; then + WRITE_FILE="WIKI/$(\date +%Y-%m-%d).wiki" +fi + +write OneHalfDark "$WRITE_DIR/$WRITE_FILE" + diff --git a/scripts/www b/scripts/www new file mode 100755 index 0000000..23794be --- /dev/null +++ b/scripts/www @@ -0,0 +1,40 @@ +#!/bin/bash + +#Создан: Чт 23 июн 2016 13:14:17 +#Изменён: Пн 17 фев 2020 17:54:01 + +# BROWSER=surf,vimprobable2,vimb,jumanji,chromium +BROWSER=firefox-bin + +SEARCH="https://duckduckgo.com/?q=" + +#title:url +#?XXX? title:url +URLS="$SHELLRC/var/www/urls" + +LINES=7 + +# URL="$(rofi -dmenu -hide-scrollbar -columns 8 -location 1 -width 100 -lines 10 -input $URLS)" + +TITLES="$(awk '/\[/{print NR-1}' "$URLS" | paste -s -d ',')" + +BADURLS="$(awk '/XXX/{print NR-1}' "$URLS" | paste -s -d ',')" + +WEBSITE=$(cat "$URLS" \ + | cut -d ':' -f 1 \ + | sed 's/XXX //' \ + | rofi -dmenu -hide-scrollbar -i -columns 3 -location 1 -width 100 -lines $LINES -a "$TITLES" -u "$BADURLS" -p "web:") + +if [ -n "$WEBSITE" ]; then + URL="$(grep "${WEBSITE}:" "$URLS" | cut -d ':' -f 2-)" + + if [ -n "$URL" ]; then + $BROWSER "$URL" + else + case $WEBSITE in + /*) "$BROWSER" "${WEBSITE/\/}" ;; + *) "$BROWSER" "$(tr ' ' '+' <<<"${SEARCH}${WEBSITE}")";; + esac + fi +fi + diff --git a/scripts/x-open b/scripts/x-open new file mode 100755 index 0000000..570e7c4 --- /dev/null +++ b/scripts/x-open @@ -0,0 +1,11 @@ +#!/bin/bash + +#Создан: ср 11 дек 2019 16:48:29 +#Изменён: ср 11 дек 2019 16:51:50 + +# Открытие файлов в GUI-приложениях в OS Linux и MacOS + +OPENER=$(command -v xdg-open || command -v open) + +nohup "$OPENER" "$@" /dev/null 2>&1 & + diff --git a/scripts/xsmartlight b/scripts/xsmartlight new file mode 100755 index 0000000..f1495e9 --- /dev/null +++ b/scripts/xsmartlight @@ -0,0 +1,85 @@ +#!/bin/bash + +# +# Сценарий позволяет регулировать яркость экрана ASUS SmartScreen. +# +# Идея и подробности: +# https://github.com/s-light/ASUS-ZenBook-Pro-Duo-UX581GV/issues/1#issuecomment-632839056 +# +# Для работы требуется модуль ядра acpi_call +# +# Использование: +# +# + +percentage2hex() { + local decimal=$(( $1 * 255 / 100 )) + + printf "%02x" "$decimal" +} + +set_brightness() { + echo "\_SB.ATKD.WMNB 0x0 0x53564544 b32000500${1^^}000000" | tee /proc/acpi/call +} + +main_brightness() { + xbacklight | cut -d '.' -f 1 +} + +current_brightness() { + if [ -f "$BRIGHTNESS_LOG" ]; then + cat "$BRIGHTNESS_LOG" + else + echo "$DEFAULT_BRIGHTNESS" + fi +} + +adjust_brightness() { + if [ "$1" == "inc" ]; then + local adjust_to=$2 + else + local adjust_to=-$2 + fi + + local new_level=$(( "$(current_brightness)" + "$adjust_to" )) + + if [ "$new_level" -le 0 ];then + local new_level=0 + elif [ "$new_level" -gt 100 ]; then + local new_level=100 + fi + + echo "$new_level" +} + +usage() { + echo "USAGE: xsmartlight [options]" + echo " Options:" + echo " -set ?percentage? set the brightness to " + echo " -inc ?percentage? increase the brigthness to % (default is 10%)." + echo " -dec ?percentage? decrease the brigthness to % (default is 10%)." + echo " -help show this help" + echo + echo "Executing the xsmartlight command without any options" + echo "will set the brightness to default value (${DEFAULT_BRIGHTNESS}%)." +} + +INC=10 + +DEFAULT_BRIGHTNESS=70 # ~B0 + +BRIGHTNESS_LOG=/tmp/smartscreen_brightness_level + +case "$1" in + -set) NEW_LEVEL=${2:-$DEFAULT_BRIGHTNESS};; + -inc) NEW_LEVEL=$(adjust_brightness inc "${2:-$INC}");; + -dec) NEW_LEVEL=$(adjust_brightness dec "${2:-$INC}");; + -help) usage; exit;; + *) usage; exit;; +esac + +echo -n "$NEW_LEVEL" | tee "$BRIGHTNESS_LOG" +echo -n " " + +set_brightness "$(percentage2hex "$NEW_LEVEL")" + diff --git a/scripts/xstab b/scripts/xstab new file mode 100755 index 0000000..b1a7e1e --- /dev/null +++ b/scripts/xstab @@ -0,0 +1,6 @@ +#!/bin/sh + +TERMINAL=st + +nohup tabbed -r 2 -c -t '#bcbcbc' -T black -u '#999999' -U black "$TERMINAL" -w '' /dev/null 2>&1 & + diff --git a/spread b/spread deleted file mode 100755 index be68f13..0000000 --- a/spread +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -#Создан: Пт 24 июн 2016 14:34:58 -#Изменён: Пт 21 фев 2020 11:49:12 - -if [ ! -z $1 ]; then - DATA=$(cat "$@") -else - DATA=$(cat -) -fi - -\rm -rf /tmp/*.speedreading -echo "$DATA" > /tmp/$$.speedreading - -st -e bash -c "fsz 37 && tput clear && tput cup 7 && echo && speedread /tmp/$$.speedreading 2>/dev/null && read" - diff --git a/sync-date b/sync-date deleted file mode 100755 index 7a3525a..0000000 --- a/sync-date +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# (c) https://unix.stackexchange.com/a/251575 - -date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //')" - diff --git a/th b/th deleted file mode 100755 index 48e42ee..0000000 --- a/th +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -#Создан: Вт 27 янв 2015 21:41:37 -#Изменён: Ср 20 янв 2016 11:59:05 - -#Создание миниатюр изображений - -mkdir -p "${1:-.}/th"; -for i in *.jpg; { - convert -define jpeg:size=95x95 "$i" -thumbnail 95x95^ \ - -gravity center -extent 95x95 "th/$i" -} - diff --git a/todolist b/todolist deleted file mode 100755 index 4956e6e..0000000 --- a/todolist +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Find all TODO: marks in current git repository - -[ -n "$1" ] && cd "$1" - -if git rev-parse --show-toplevel &>/dev/null; then - grep -n -R "^[[:space:]]*[#/\";-]*[[:space:]]*TODO:" . \ - | expand \ - | sed -r 's/([[:digit:]]):/\1:@@ /' \ - | tr -s ' ' \ - | column -t -s '@@' -fi - diff --git a/tree2md b/tree2md deleted file mode 100755 index e8d5f43..0000000 --- a/tree2md +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -#Создан: пн 21 окт 2019 22:39:13 -#Изменён: ср 11 дек 2019 15:01:28 - -# -# Создание markdown-списка из дерева файлов -# -# NB: Иногда отображает неправильный уровень вложенности директорий -# - -# Идея: https://stackoverflow.com/a/35889620 - -tree=$(\tree -f --noreport -I '*~' --charset ascii -L "${2:-3}" "${1:-.}" | - sed -E 's/\| +/ /g; s/[|`]-+/ */g; s:\* ((.*/)([^/]+)):- [\3](\1):g; s/ //') - -printf "%s\n" "$tree" - diff --git a/use b/use deleted file mode 100755 index 539c5d4..0000000 --- a/use +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -#Создан: Вт 25 фев 2020 18:24:10 -#Изменён: Вт 25 фев 2020 18:30:29 - -# Show Gentoo USE flag description - -curl -sq "https://packages.gentoo.org/useflags/${1?USAGE: $(basename "$0") [use flag]}" \ - | awk '/class="lead"/{getline; gsub(/^[ \t]+/, "", $0); print}' - diff --git a/utable b/utable deleted file mode 100755 index 0adcd3a..0000000 --- a/utable +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env tclsh - -#Создан: Вт 06 июл 2010 19:18:44 -#Изменён: Чт 22 июл 2010 19:27:09 - -#---------------------------------------------------------------------------+ -# | -# Скрипт отображает символы Unicode. | -# | -# Использование: utable [класс символов] | -# | -# Copyrignt (c) 2010-2013, Likhachev Maxim, <> | -# | -#---------------------------------------------------------------------------+ - -#Классы символов Unicode -array set category { - Basic_Latin {"Basic_Latin" 0x0000 0x007F} - Latin-1_Supplement {"Latin-1_Supplement" 0x0080 0x00FF} - Latin_Extended-A {"Latin_Extended-A" 0x0100 0x017F} - Latin_Extended-B {"Latin_Extended-B" 0x0180 0x024F} - IPA_Extensions {"IPA_Extensions" 0x0250 0x02AF} - Spacing_Modifier_Letters {"Spacing_Modifier_Letters" 0x02B0 0x02FF} - Combining_Diacritical_Marks {"Combining_Diacritical_Marks" 0x0300 0x036F} - Greek_and_Coptic {"Greek_and_Coptic" 0x0370 0x03FF} - Cyrillic {"Cyrillic" 0x0400 0x04FF} - Cyrillic_Supplementary {"Cyrillic_Supplementary" 0x0500 0x052F} - Armenian {"Armenian" 0x0530 0x058F} - Hebrew {"Hebrew" 0x0590 0x05FF} - Arabic {"Arabic" 0x0600 0x06FF} - Syriac {"Syriac" 0x0700 0x074F} - Thaana {"Thaana" 0x0780 0x07BF} - Devanagari {"Devanagari" 0x0900 0x097F} - Bengali {"Bengali" 0x0980 0x09FF} - Gurmukhi {"Gurmukhi" 0x0A00 0x0A7F} - Gujarati {"Gujarati" 0x0A80 0x0AFF} - Oriya {"Oriya" 0x0B00 0x0B7F} - Tamil {"Tamil" 0x0B80 0x0BFF} - Telugu {"Telugu" 0x0C00 0x0C7F} - Kannada {"Kannada" 0x0C80 0x0CFF} - Malayalam {"Malayalam" 0x0D00 0x0D7F} - Sinhala {"Sinhala" 0x0D80 0x0DFF} - Thai {"Thai" 0x0E00 0x0E7F} - Lao {"Lao" 0x0E80 0x0EFF} - Tibetan {"Tibetan" 0x0F00 0x0FFF} - Myanmar {"Myanmar" 0x1000 0x109F} - Georgian {"Georgian" 0x10A0 0x10FF} - Hangul_Jamo {"Hangul_Jamo" 0x1100 0x11FF} - Ethiopic {"Ethiopic" 0x1200 0x137F} - Cherokee {"Cherokee" 0x13A0 0x13FF} - Unified_Canadian_Aboriginal_Syllabics {"Unified_Canadian_Aboriginal_Syllabics" 0x1400 0x167F} - Ogham {"Ogham" 0x1680 0x169F} - Runic {"Runic" 0x16A0 0x16FF} - Tagalog {"Tagalog" 0x1700 0x171F} - Hanunoo {"Hanunoo" 0x1720 0x173F} - Buhid {"Buhid" 0x1740 0x175F} - Tagbanwa {"Tagbanwa" 0x1760 0x177F} - Khmer {"Khmer" 0x1780 0x17FF} - Mongolian {"Mongolian" 0x1800 0x18AF} - Limbu {"Limbu" 0x1900 0x194F} - Tai_Le {"Tai_Le" 0x1950 0x197F} - Khmer_Symbols {"Khmer_Symbols" 0x19E0 0x19FF} - Phonetic_Extensions {"Phonetic_Extensions" 0x1D00 0x1D7F} - Latin_Extended_Additional {"Latin_Extended_Additional" 0x1E00 0x1EFF} - Greek_Extended {"Greek_Extended" 0x1F00 0x1FFF} - General_Punctuation {"General_Punctuation" 0x2000 0x206F} - Superscripts_and_Subscripts {"Superscripts_and_Subscripts" 0x2070 0x209F} - Currency_Symbols {"Currency_Symbols" 0x20A0 0x20CF} - Combining_Diacritical_Marks_for_Symbols {"Combining_Diacritical_Marks_for_Symbols" 0x20D0 0x20FF} - Letterlike_Symbols {"Letterlike_Symbols" 0x2100 0x214F} - Number_Forms {"Number_Forms" 0x2150 0x218F} - Arrows {"Arrows" 0x2190 0x21FF} - Mathematical_Operators {"Mathematical_Operators" 0x2200 0x22FF} - Miscellaneous_Technical {"Miscellaneous_Technical" 0x2300 0x23FF} - Control_Pictures {"Control_Pictures" 0x2400 0x243F} - Optical_Character_Recognition {"Optical_Character_Recognition" 0x2440 0x245F} - Enclosed_Alphanumerics {"Enclosed_Alphanumerics" 0x2460 0x24FF} - Box_Drawing {"Box_Drawing" 0x2500 0x257F} - Block_Elements {"Block_Elements" 0x2580 0x259F} - Geometric_Shapes {"Geometric_Shapes" 0x25A0 0x25FF} - Miscellaneous_Symbols {"Miscellaneous_Symbols" 0x2600 0x26FF} - Dingbats {"Dingbats" 0x2700 0x27BF} - Miscellaneous_Mathematical_Symbols-A {"Miscellaneous_Mathematical_Symbols-A" 0x27C0 0x27EF} - Supplemental_Arrows-A {"Supplemental_Arrows-A" 0x27F0 0x27FF} - Braille_Patterns {"Braille_Patterns" 0x2800 0x28FF} - Supplemental_Arrows-B {"Supplemental_Arrows-B" 0x2900 0x297F} - Miscellaneous_Mathematical_Symbols-B {"Miscellaneous_Mathematical_Symbols-B" 0x2980 0x29FF} - Supplemental_Mathematical_Operators {"Supplemental_Mathematical_Operators" 0x2A00 0x2AFF} - Miscellaneous_Symbols_and_Arrows {"Miscellaneous_Symbols_and_Arrows" 0x2B00 0x2BFF} - CJK_Radicals_Supplement {"CJK_Radicals_Supplement" 0x2E80 0x2EFF} - Kangxi_Radicals {"Kangxi_Radicals" 0x2F00 0x2FDF} - Ideographic_Description_Characters {"Ideographic_Description_Characters" 0x2FF0 0x2FFF} - CJK_Symbols_and_Punctuation {"CJK_Symbols_and_Punctuation" 0x3000 0x303F} - Hiragana {"Hiragana" 0x3040 0x309F} - Katakana {"Katakana" 0x30A0 0x30FF} - Bopomofo {"Bopomofo" 0x3100 0x312F} - Hangul_Compatibility_Jamo {"Hangul_Compatibility_Jamo" 0x3130 0x318F} - Kanbun {"Kanbun" 0x3190 0x319F} - Bopomofo_Extended {"Bopomofo_Extended" 0x31A0 0x31BF} - Katakana_Phonetic_Extensions {"Katakana_Phonetic_Extensions" 0x31F0 0x31FF} - Enclosed_CJK_Letters_and_Months {"Enclosed_CJK_Letters_and_Months" 0x3200 0x32FF} - CJK_Compatibility {"CJK_Compatibility" 0x3300 0x33FF} - CJK_Unified_Ideographs_Extension_A {"CJK_Unified_Ideographs_Extension_A" 0x3400 0x4DBF} - Yijing_Hexagram_Symbols {"Yijing_Hexagram_Symbols" 0x4DC0 0x4DFF} - CJK_Unified_Ideographs {"CJK_Unified_Ideographs" 0x4E00 0x9FFF} - Yi_Syllables {"Yi_Syllables" 0xA000 0xA48F} - Yi_Radicals {"Yi_Radicals" 0xA490 0xA4CF} - Hangul_Syllables {"Hangul_Syllables" 0xAC00 0xD7AF} - High_Surrogates {"High_Surrogates" 0xD800 0xDB7F} - High_Private_Use_Surrogates {"High_Private_Use_Surrogates" 0xDB80 0xDBFF} - Low_Surrogates {"Low_Surrogates" 0xDC00 0xDFFF} - Private_Use_Area {"Private_Use_Area" 0xE000 0xF8FF} - CJK_Compatibility_Ideographs {"CJK_Compatibility_Ideographs" 0xF900 0xFAFF} - Alphabetic_Presentation_Forms {"Alphabetic_Presentation_Forms" 0xFB00 0xFB4F} - Arabic_Presentation_Forms-A {"Arabic_Presentation_Forms-A" 0xFB50 0xFDFF} - Variation_Selectors {"Variation_Selectors" 0xFE00 0xFE0F} - Combining_Half_Marks {"Combining_Half_Marks" 0xFE20 0xFE2F} - CJK_Compatibility_Forms {"CJK_Compatibility_Forms" 0xFE30 0xFE4F} - Small_Form_Variants {"Small_Form_Variants" 0xFE50 0xFE6F} - Arabic_Presentation_Forms-B {"Arabic_Presentation_Forms-B" 0xFE70 0xFEFF} - Halfwidth_and_Fullwidth_Forms {"Halfwidth_and_Fullwidth_Forms" 0xFF00 0xFFEF} - Specials {"Specials" 0xFFF0 0xFFFF} -} - -#Перевод из шестнадцатеричной системы в десятичную -proc hex2dec {code} { return [format "%d" $code]} - -#Выбор наборов символов по маске -proc getCharsets {rgx} { - if {$rgx eq "-b"} { set rgx {math|arrow|misc} } - - set charsetList {} - foreach charset [lsort [array names ::category]] { - if {[regexp "(?i).*($rgx).*" $charset]} { - lappend charsetList $charset - } - } - return $charsetList -} - -#Вывод таблицы символов -proc showUTFCodes {charset} { - foreach {category start end} $::category($charset) {} - - for {set i [hex2dec $start]} {$i <= [hex2dec $end]} {incr i} { - set char [format "%c" $i] - if {[regexp {[^[:space:]]} $char match]} { - puts [format "%-40s%#5x: %s" $category $i $char] - } - } -} - -#-------------------------------------------- -foreach charset [getCharsets [lindex $argv 0]] { - catch {showUTFCodes $charset} -} - diff --git a/vandroucli b/vandroucli deleted file mode 100755 index da63192..0000000 --- a/vandroucli +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2019, Maxim Lihachev, -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation, version 3. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program. If not, see . - -# Получение последних записей с сайта vandrouki.ru - -declare -A URLS=( - ["asia"]="https://vandrouki.asia" - ["by"]="https://vandrouki.by" - ["ru"]="https://vandrouki.ru" -) - -get_info() { - echo -e ">> $1 $rstc\n" - - curl -s -q "$1" \ - | sed 's/&- \ - | awk \ - 'BEGIN { - RS=""; - text=""; - - rstc="\033[00m"; - yellow="\033[1;33m"; - blue="\033[1;34m"; - green="\033[1;32m"; - } - - function tokenize(html) { - gsub(/\n+/, "@", html); - gsub(/

    /, "\n", html); - gsub(/(href=")|(" rel=[^>]*>)|(published.>)/, "@", html); - gsub(/(&#[0-9]+;)|(<[^@>]*>*)/, "", html); - gsub(/@\s*@*/, "@", html); - gsub(/\r/, "", html); - - return html; - } - - { - text = text"\n"tokenize($0); - } - - END { - split(text, lines, "\n") - - for (line in lines) { - split(lines[line], article, "@") - - if (article[4] ~ /^\s*$/) { - date = article[5] - } else { - date = article[4] - } - - if (article[3] !~ /^\s*$/) { - print blue " # " date "\t" yellow article[3] "\n\t\t" green article[2] rstc - } - } - - print "\n--------------------------------\n" - }' -} - -domains="${*:-.}" -filter=${domains// /|} - -if [[ "$filter" =~ -h|--h ]]; then - echo "USAGE: $(basename "$0") ?domains? [ru, by, asia]" - exit 0 -fi - -for url in "${URLS[@]}"; do - if [[ "$url" =~ $filter ]]; then - get_info "$url" - fi -done - diff --git a/vault-kv-tree b/vault-kv-tree deleted file mode 100755 index ffeaf17..0000000 --- a/vault-kv-tree +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2020, Maxim Lihachev, -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation, version 3. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program. If not, see . - -# -# Show all Vault paths and keys recursively -# -# Requirements: -# - vault-cli -# - jq -# - -export VAULT_ADDR=${VAULT_ADDR:-http://127.0.0.1:8200} - -rstc="\033[00m" -blue="\033[0;36m" -green="\033[1;32m" - -vault_list() { - vault kv list -format=yaml "$1" -} - -vault_keys() { - path=${1//\/\//\/} - keys=$(vault kv get -format=json "$path" 2>&- | jq -r -j '.data.data | keys | join("\n")' 2>&-) - - if [ -n "$keys" ]; then - while read -r key; do - echo -e "${blue}${path}/${green}${key}$rstc" - done <<<"$keys" - fi -} - -vault_tree() { - path=${1//\/\//\/} - list=$(vault_list "$path") - - echo -e "${blue}${path}${rstc}" - - if [ -n "$list" ] && [ "$list" != '{}' ]; then - while read -r dir; do - # printf "%s%s\n" "$INDENT" "$dir" - # echo "LIST ${path}/${dir#- }" - ( vault_tree "${path}/${dir#- }"; ) - done <<<"$list" - # INDENT+=" " - else - : - vault_keys "$path" - fi -} - -if [ $# -eq 0 ]; then - echo "USAGE: $(basename "$0") [path]" - exit 1 -else - vault_tree "$1" -fi - diff --git a/vcat b/vcat deleted file mode 100755 index c0fc5d0..0000000 --- a/vcat +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -#- Вывод файлов с подсветкой синтаксиса -srchl="source-highlight -f esc --line-number=' ' --style-file=$SHELLRC/etc/soft/source-hl/default.style" - -if [[ "${1##*/}" == .* ]]; then - eval $srchl -i "$1" --src-lang=sh -else - eval $srchl -i "$1" -fi 2> /dev/null || eval $srchl -i "$1" --src-lang=lisp - -echo - diff --git a/viper b/viper deleted file mode 100755 index 96bbf26..0000000 --- a/viper +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -TMPFILE=$(mktemp /tmp/viper.XXXXXXXX) -cat > "$TMPFILE" -$EDITOR "$@" "$TMPFILE" < /dev/tty > /dev/tty - -if [ "$?" -eq 0 ]; then - cat "$TMPFILE" -fi - -\rm -f "$TMPFILE" - diff --git a/vls b/vls deleted file mode 100755 index 4936feb..0000000 --- a/vls +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -#Создан: Пт 26 фев 2016 21:04:00 -#Изменён: Чт 05 окт 2017 13:15:44 - -#- vlc-ncurses с увеличенной скоростью воспроизведения - -speed=${1%%[^+0-9]*} - -if [ ! -z "$speed" ]; then - shift - rate=$(echo "1.0 + 0.${speed//+}" | bc -l) -else - rate="1.0" -fi - -vlc --rate $rate -I ncurses --no-color ${@:-*.mp3} - diff --git a/windows b/windows deleted file mode 100755 index 93c4d89..0000000 --- a/windows +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -#Создан: Ср 13 дек 2017 17:10:30 -#Изменён: Ср 13 дек 2017 17:29:17 - -WINDOW=$(wmctrl -l | rofi -dmenu -hide-scrollbar -columns 8 -location 1 -width 100 -i -p "window:") - -WINDOW_ID="$(echo "$WINDOW" | awk '{print $1}')" - -if [ ! -z "$WINDOW_ID" ]; then - wmctrl -i -a "$WINDOW_ID" -fi - diff --git a/writeup b/writeup deleted file mode 100755 index 1d52a3a..0000000 --- a/writeup +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -write() { - # urxvtc -fn 'xft:TrixiePro:pixelsize=20' \ - # -e bash -c "vim '+colorscheme $1' '+Goyo 60%' $2" - st -f 'TrixiePro:pixelsize=30' \ - -e bash -c "nvim '+colorscheme $1' '+Goyo 60%' $2" -} - -WRITE_DIR="$HOME/FILES/Docs/WRITE/" -WRITE_FILE=$(cd "$WRITE_DIR" && \ls -d */* | grep -v nohup.out | rofi -dmenu) - -if [ -z "$WRITE_FILE" ]; then - WRITE_FILE="WIKI/$(\date +%Y-%m-%d).wiki" -fi - -write OneHalfDark "$WRITE_DIR/$WRITE_FILE" - diff --git a/www b/www deleted file mode 100755 index 23794be..0000000 --- a/www +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -#Создан: Чт 23 июн 2016 13:14:17 -#Изменён: Пн 17 фев 2020 17:54:01 - -# BROWSER=surf,vimprobable2,vimb,jumanji,chromium -BROWSER=firefox-bin - -SEARCH="https://duckduckgo.com/?q=" - -#title:url -#?XXX? title:url -URLS="$SHELLRC/var/www/urls" - -LINES=7 - -# URL="$(rofi -dmenu -hide-scrollbar -columns 8 -location 1 -width 100 -lines 10 -input $URLS)" - -TITLES="$(awk '/\[/{print NR-1}' "$URLS" | paste -s -d ',')" - -BADURLS="$(awk '/XXX/{print NR-1}' "$URLS" | paste -s -d ',')" - -WEBSITE=$(cat "$URLS" \ - | cut -d ':' -f 1 \ - | sed 's/XXX //' \ - | rofi -dmenu -hide-scrollbar -i -columns 3 -location 1 -width 100 -lines $LINES -a "$TITLES" -u "$BADURLS" -p "web:") - -if [ -n "$WEBSITE" ]; then - URL="$(grep "${WEBSITE}:" "$URLS" | cut -d ':' -f 2-)" - - if [ -n "$URL" ]; then - $BROWSER "$URL" - else - case $WEBSITE in - /*) "$BROWSER" "${WEBSITE/\/}" ;; - *) "$BROWSER" "$(tr ' ' '+' <<<"${SEARCH}${WEBSITE}")";; - esac - fi -fi - diff --git a/x-open b/x-open deleted file mode 100755 index 570e7c4..0000000 --- a/x-open +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -#Создан: ср 11 дек 2019 16:48:29 -#Изменён: ср 11 дек 2019 16:51:50 - -# Открытие файлов в GUI-приложениях в OS Linux и MacOS - -OPENER=$(command -v xdg-open || command -v open) - -nohup "$OPENER" "$@" /dev/null 2>&1 & - diff --git a/xsmartlight b/xsmartlight deleted file mode 100755 index f1495e9..0000000 --- a/xsmartlight +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# -# Сценарий позволяет регулировать яркость экрана ASUS SmartScreen. -# -# Идея и подробности: -# https://github.com/s-light/ASUS-ZenBook-Pro-Duo-UX581GV/issues/1#issuecomment-632839056 -# -# Для работы требуется модуль ядра acpi_call -# -# Использование: -# -# - -percentage2hex() { - local decimal=$(( $1 * 255 / 100 )) - - printf "%02x" "$decimal" -} - -set_brightness() { - echo "\_SB.ATKD.WMNB 0x0 0x53564544 b32000500${1^^}000000" | tee /proc/acpi/call -} - -main_brightness() { - xbacklight | cut -d '.' -f 1 -} - -current_brightness() { - if [ -f "$BRIGHTNESS_LOG" ]; then - cat "$BRIGHTNESS_LOG" - else - echo "$DEFAULT_BRIGHTNESS" - fi -} - -adjust_brightness() { - if [ "$1" == "inc" ]; then - local adjust_to=$2 - else - local adjust_to=-$2 - fi - - local new_level=$(( "$(current_brightness)" + "$adjust_to" )) - - if [ "$new_level" -le 0 ];then - local new_level=0 - elif [ "$new_level" -gt 100 ]; then - local new_level=100 - fi - - echo "$new_level" -} - -usage() { - echo "USAGE: xsmartlight [options]" - echo " Options:" - echo " -set ?percentage? set the brightness to " - echo " -inc ?percentage? increase the brigthness to % (default is 10%)." - echo " -dec ?percentage? decrease the brigthness to % (default is 10%)." - echo " -help show this help" - echo - echo "Executing the xsmartlight command without any options" - echo "will set the brightness to default value (${DEFAULT_BRIGHTNESS}%)." -} - -INC=10 - -DEFAULT_BRIGHTNESS=70 # ~B0 - -BRIGHTNESS_LOG=/tmp/smartscreen_brightness_level - -case "$1" in - -set) NEW_LEVEL=${2:-$DEFAULT_BRIGHTNESS};; - -inc) NEW_LEVEL=$(adjust_brightness inc "${2:-$INC}");; - -dec) NEW_LEVEL=$(adjust_brightness dec "${2:-$INC}");; - -help) usage; exit;; - *) usage; exit;; -esac - -echo -n "$NEW_LEVEL" | tee "$BRIGHTNESS_LOG" -echo -n " " - -set_brightness "$(percentage2hex "$NEW_LEVEL")" - diff --git a/xstab b/xstab deleted file mode 100755 index b1a7e1e..0000000 --- a/xstab +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -TERMINAL=st - -nohup tabbed -r 2 -c -t '#bcbcbc' -T black -u '#999999' -U black "$TERMINAL" -w '' /dev/null 2>&1 & -