commit cb99d998e1fbed8655ea90e3f9aa8cae697ca955 Author: Maxim Lihachev Date: Wed Aug 28 20:25:37 2013 +0600 Initial commit diff --git a/bor b/bor new file mode 100755 index 0000000..8680d27 --- /dev/null +++ b/bor @@ -0,0 +1,10 @@ +#!/bin/bash + +#- Чтение цитат с bash.org.ru +curl -s http://bash.im/rss/ | \ +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/dates b/dates new file mode 100755 index 0000000..b3d2a5c --- /dev/null +++ b/dates @@ -0,0 +1,45 @@ +#!/bin/bash + +#Создан: Чт 06 Май 2010 02:44:00 +#Изменён: Ср 28 авг 2013 19:58:49 + +# Скрипт напоминания о датах +# +# Формат файла 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 "$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 new file mode 100755 index 0000000..c1368ab --- /dev/null +++ b/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/doctools2man b/doctools2man new file mode 100755 index 0000000..c0ecc18 --- /dev/null +++ b/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/ext b/ext new file mode 100755 index 0000000..2c7c32c --- /dev/null +++ b/ext @@ -0,0 +1,30 @@ +#!/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";; + *) echo -e \ + ""$green"<${1:-"-"}>: Неизвестный формат архива";; + esac + } +} + +ext "$*" + diff --git a/fb2 b/fb2 new file mode 100755 index 0000000..97a6566 --- /dev/null +++ b/fb2 @@ -0,0 +1,326 @@ +#!/bin/bash +# + +case ${1:0-3} in + zip) TEXT=$(zcat "$1");; + fb2) TEXT=$(cat "$1");; + *) echo "Неизвестный формат файла"; exit 1;; +esac + +# zip) zcat "$1" | xsltproc "$(dirname $(which $0))/FB2_2_xhtml.xsl" -;; +# fb2) cat "$1" | xsltproc "$(dirname $(which $0))/FB2_2_xhtml.xsl" -;; + +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 + diff --git a/getignore b/getignore new file mode 100755 index 0000000..c82320c --- /dev/null +++ b/getignore @@ -0,0 +1,25 @@ +#!/bin/bash + +#Создан: Вс 25 авг 2013 19:40:12 +#Изменён: Ср 28 авг 2013 20:24:59 + +# Добавление файлов с меткой +GITIGNORE в исключения .git + +# Метка должна располагаться не далее пятой колонки +\grep -E '^.{1,5}\+GITIGNORE' -R > /tmp/gitignore.tmp + +if [ -f ".gitignore" ]; then + while read line; do + echo lll $line + sed -i "/${line//\//.}/d" /tmp/gitignore.tmp 2> /dev/null + done < .gitignore +fi + +echo "\n# [ $(\date +%d.%m.%Y) ]\n" >> .gitignore + +cut -d ':' -f 1 /tmp/gitignore.tmp | sort -u >> .gitignore + +echo >> .gitignore + +\rm /tmp/gitignore.tmp + diff --git a/ibor b/ibor new file mode 100755 index 0000000..2b86fbd --- /dev/null +++ b/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/mem b/mem new file mode 100755 index 0000000..8ffa42b --- /dev/null +++ b/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) vim $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'` ] ==> $1\n" >> $memfile && printf \ + "$greenЗаметка$yellow $1 $greenуспешно добавлена\n$rstc" +esac + diff --git a/office2pdf b/office2pdf new file mode 100755 index 0000000..8bfeba6 --- /dev/null +++ b/office2pdf @@ -0,0 +1,17 @@ +#!/bin/bash + +#pgrep soffice.bin || \ +soffice \ + -headless \ + -accept="socket,host=127.0.0.1,port=8100;urp;" \ + -nofirststartwizard + +sleep 1 + +for i; { + java -jar $SHELLRC/etc/soft/jodconverter/lib/jodconverter-cli-2.2.2.jar \ + "$i" "${i//\.*/}.pdf" +} + +killall soffice.bin + diff --git a/pk b/pk new file mode 100755 index 0000000..10d3bdc --- /dev/null +++ b/pk @@ -0,0 +1,13 @@ +#!/bin/bash + +#- Запаковка архивов +case ${2:-tbz} in + tbz) tar cjvf $1.tar.bz2 $1;; + tgz) tar czvf $1.tar.gz $1;; + tar) tar cpvf $1.tar $1;; + bz2) bzip $1;; + gz) gzip -c -9 -n $1 > $1.gz;; + zip) zip -r $1.zip $1;; + 7z) 7za a $1.7z $1;; +esac + diff --git a/rip b/rip new file mode 100755 index 0000000..ec6ccad --- /dev/null +++ b/rip @@ -0,0 +1,7 @@ +#!/bin/bash + +#- Рип DVD и видео +mencoder $1 -ovc x264 -vf yadif -oac copy \ +-x264encopts subq=6:partitions=all:8x8dct:me=umh:\ +frameref=5:bframes=4:b_pyramid:weight_b:threads=2:crf=22 -o $2 + diff --git a/rip_pcm b/rip_pcm new file mode 100755 index 0000000..9f959d2 --- /dev/null +++ b/rip_pcm @@ -0,0 +1,7 @@ +#!/bin/bash + +#- Рип DVD и видео с pcm-дорожкой +mencoder $1 -ovc x264 -vf yadif -oac pcm \ +-x264encopts subq=6:partitions=all:8x8dct:me=umh:\ +frameref=5:bframes=4:b_pyramid:weight_b:threads=2:crf=22 -o $2 + diff --git a/setrating b/setrating new file mode 100755 index 0000000..7439344 --- /dev/null +++ b/setrating @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# Изменение комментария в id3-теге с помощью ncmpcpp +# $1 -- текст комментария +# + +# Переход к редактору тегов +xdotool key e +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Down +xdotool key Return +xdotool key Control+u +xdotool type $1 +xdotool key Return +xdotool key y + diff --git a/suDo b/suDo new file mode 100755 index 0000000..c54c884 --- /dev/null +++ b/suDo @@ -0,0 +1,18 @@ +#!/usr/bin/env tclsh + +# Выполнение команды с правами администратора +# Используется с dmenu +# suDo + +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/utable b/utable new file mode 100755 index 0000000..0adcd3a --- /dev/null +++ b/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} +} +