From 96d1af877faee2d4bd7d34724bcb0a8f7bc61de8 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Mon, 17 Feb 2020 17:54:33 +0300 Subject: [PATCH 01/10] www: shellcheck --- www | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/www b/www index 09bf075..23794be 100755 --- a/www +++ b/www @@ -1,38 +1,39 @@ #!/bin/bash #Создан: Чт 23 июн 2016 13:14:17 -#Изменён: Ср 04 апр 2018 19:38:58 +#Изменён: Пн 17 фев 2020 17:54:01 # BROWSER=surf,vimprobable2,vimb,jumanji,chromium -BROWSER=min +BROWSER=firefox-bin SEARCH="https://duckduckgo.com/?q=" #title:url +#?XXX? title:url URLS="$SHELLRC/var/www/urls" -LINES=5 +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 ',')" +TITLES="$(awk '/\[/{print NR-1}' "$URLS" | paste -s -d ',')" -BADURLS="$(awk '/XXX/{print NR-1}' $URLS | paste -s -d ',')" +BADURLS="$(awk '/XXX/{print NR-1}' "$URLS" | paste -s -d ',')" -WEBSITE=$(cat $URLS \ +WEBSITE=$(cat "$URLS" \ | cut -d ':' -f 1 \ | sed 's/XXX //' \ - | rofi -dmenu -hide-scrollbar -i -columns 4 -location 1 -width 100 -lines $LINES -a $TITLES -u $BADURLS -p "web:") + | rofi -dmenu -hide-scrollbar -i -columns 3 -location 1 -width 100 -lines $LINES -a "$TITLES" -u "$BADURLS" -p "web:") -if [ ! -z "$WEBSITE" ]; then - URL="$(grep "${WEBSITE}:" $URLS | cut -d ':' -f 2-)" +if [ -n "$WEBSITE" ]; then + URL="$(grep "${WEBSITE}:" "$URLS" | cut -d ':' -f 2-)" - if [ ! -z "$URL" ]; then + if [ -n "$URL" ]; then $BROWSER "$URL" else case $WEBSITE in - /*) $BROWSER "${WEBSITE/\/}" ;; - *) $BROWSER "$(echo $SEARCH$WEBSITE | tr ' ' '+')";; + /*) "$BROWSER" "${WEBSITE/\/}" ;; + *) "$BROWSER" "$(tr ' ' '+' <<<"${SEARCH}${WEBSITE}")";; esac fi fi From dbda311e051bde1b569f4d860d6f3a3e05d1c2a7 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Mon, 17 Feb 2020 17:58:33 +0300 Subject: [PATCH 02/10] sysc-date: synchronize system time --- README.md | 1 + sync-date | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100755 sync-date diff --git a/README.md b/README.md index fcb9c50..81176e3 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ will create the symbolic link for each script in the \ directory. - [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. ## Development tools diff --git a/sync-date b/sync-date new file mode 100755 index 0000000..7a3525a --- /dev/null +++ b/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: //')" + From 4ad8c4f60d4b08e29552c1d3fcfdc8dcc2a270c6 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Thu, 20 Feb 2020 00:46:03 +0300 Subject: [PATCH 03/10] retag: update mp3 tags --- README.md | 1 + retag | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100755 retag diff --git a/README.md b/README.md index 81176e3..570fc62 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ will create the symbolic link for each script in the \ directory. - [a2mp3](a2mp3) converts wav audio files to mp3 format. - [axaudio](axaudio) gets an information and audio stream from Axia Livewire network. +- [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. diff --git a/retag b/retag new file mode 100755 index 0000000..3aea528 --- /dev/null +++ b/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 + From bf22609d94f9134275ea4fdfac7ed13c4db36402 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Fri, 21 Feb 2020 11:50:59 +0300 Subject: [PATCH 04/10] spread: urxvt -> st --- spread | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spread b/spread index 91f8bae..be68f13 100755 --- a/spread +++ b/spread @@ -1,7 +1,7 @@ #!/bin/bash #Создан: Пт 24 июн 2016 14:34:58 -#Изменён: Пт 24 июн 2016 15:06:26 +#Изменён: Пт 21 фев 2020 11:49:12 if [ ! -z $1 ]; then DATA=$(cat "$@") @@ -12,5 +12,5 @@ fi \rm -rf /tmp/*.speedreading echo "$DATA" > /tmp/$$.speedreading -urxvtc -e bash -c "fsz 37 && tput clear && tput cup 7 && echo && speedread /tmp/$$.speedreading 2>/dev/null && read" +st -e bash -c "fsz 37 && tput clear && tput cup 7 && echo && speedread /tmp/$$.speedreading 2>/dev/null && read" From 63b8315b800336e49753cf0ddddecde18eb8d359 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Sun, 23 Feb 2020 13:28:17 +0300 Subject: [PATCH 05/10] dates: fix ansi colors output --- dates | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dates b/dates index b3d2a5c..cd8054d 100755 --- a/dates +++ b/dates @@ -1,7 +1,7 @@ #!/bin/bash #Создан: Чт 06 Май 2010 02:44:00 -#Изменён: Ср 28 авг 2013 19:58:49 +#Изменён: Вс 23 фев 2020 13:27:43 # Скрипт напоминания о датах # @@ -26,7 +26,7 @@ TODAY=$(\date +%s --date=$(\date '+%m/%d')) FOUND=0 dates() { - echo "$greenБлижайшие даты:$rstc" + echo -e "${green}Ближайшие даты:${rstc}" #Поиск дат в базе данных for i in $(seq 0 $DAYS); do From 399840bcf1e0fe6c332aa9619613fd78fd3e0d3a Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Tue, 25 Feb 2020 18:37:45 +0300 Subject: [PATCH 06/10] use: get USE flag description --- README.md | 1 + use | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100755 use diff --git a/README.md b/README.md index 570fc62..3559e4c 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ will create the symbolic link for each script in the \ directory. - [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. +- [use](use) shows Gentoo USE flag's description. ## Development tools diff --git a/use b/use new file mode 100755 index 0000000..539c5d4 --- /dev/null +++ b/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}' + From f71ba349bcf05c93f1e64f2fc7c30f6522b15e1c Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Thu, 27 Feb 2020 01:03:51 +0300 Subject: [PATCH 07/10] hidecursor: moving cursor to upper right screen angle --- README.md | 1 + hidecursor | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100755 hidecursor diff --git a/README.md b/README.md index 3559e4c..b685240 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ will create the symbolic link for each script in the \ directory. - [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. diff --git a/hidecursor b/hidecursor new file mode 100755 index 0000000..82ae486 --- /dev/null +++ b/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" + From 9362fff7556c73b97bfa21b6f38c980df4567cde Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Thu, 27 Feb 2020 01:04:53 +0300 Subject: [PATCH 08/10] xstab: --nohup.out --- xstab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xstab b/xstab index 2785510..b1a7e1e 100755 --- a/xstab +++ b/xstab @@ -2,5 +2,5 @@ TERMINAL=st -nohup tabbed -r 2 -c -t '#bcbcbc' -T black -u '#999999' -U black "$TERMINAL" -w '' & +nohup tabbed -r 2 -c -t '#bcbcbc' -T black -u '#999999' -U black "$TERMINAL" -w '' /dev/null 2>&1 & From 8ac8ae862bdbfcd1e74624584c7aa769bf240f1c Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Sat, 29 Feb 2020 14:16:20 +0300 Subject: [PATCH 09/10] git-aliases: sorted output --- git-aliases | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-aliases b/git-aliases index 71ccf6d..441aa67 100755 --- a/git-aliases +++ b/git-aliases @@ -1,7 +1,7 @@ #!/bin/bash #Создан: чт 14 ноя 2019 14:03:43 -#Изменён: чт 14 ноя 2019 17:34:38 +#Изменён: Сб 29 фев 2020 02:48:48 # Список псевдонимов git @@ -23,7 +23,7 @@ rstc="\033[00m" GITCONFIG=~/.gitconfig -GIT_ALIASES=$(git config --get-regexp 'alias.*' | sed 's/alias.//' | sed 's/ .*//') +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") From 6c2262fd2f932b0797294bf89e05c41634d1cff2 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Mon, 2 Mar 2020 17:26:11 +0300 Subject: [PATCH 10/10] =?UTF-8?q?writeup:=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=20=D1=88=D1=80=D0=B8=D1=84=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- writeup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/writeup b/writeup index 8227a08..1d52a3a 100755 --- a/writeup +++ b/writeup @@ -3,14 +3,14 @@ write() { # urxvtc -fn 'xft:TrixiePro:pixelsize=20' \ # -e bash -c "vim '+colorscheme $1' '+Goyo 60%' $2" - st -f 'TrixiePro:pixelsize=24' \ + 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 +if [ -z "$WRITE_FILE" ]; then WRITE_FILE="WIKI/$(\date +%Y-%m-%d).wiki" fi