master
Štefan Bystriansky 3 years ago
commit 46fb719475
Signed by: stevo
GPG Key ID: 5584F1ECF6232C7B
  1. 1
      .gitignore
  2. 25
      al
  3. 25
      al.ed
  4. 6
      cf-HP
  5. 215
      cle-mod
  6. 38
      mod-mosh
  7. 9
      modulist
  8. 92
      tw

1
.gitignore vendored

@ -0,0 +1 @@
rc*

25
al

@ -0,0 +1,25 @@
alias bat='batcat --theme ansi'
alias cdb='cd /media/data/data/video/biblicke/'
alias cdf='cd /media/data/data/video/filmy/'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias gf='omgf --what-now'
alias grep='grep --color=auto'
alias la='ls -A '
alias ll='ls -AhlF '
alias lll='ls -AhlF --color=always | less -r'
alias ls='ls --color=auto'
alias mosh_opi4='mosh -p 27840:27900 opi4'
alias mosh_vps='mosh -p 37200:37500 vpssk'
alias sar='sudo aptitude remove '
alias sas='sudo aptitude safe-upgrade '
alias sau='sudo aptitude update '
alias svi='sudo vim '
alias yya='yt-dlp -i --extract-audio --audio-format mp3 --yes-playlist'
alias yyap='yt-dlp -i --extract-audio --audio-format mp3 --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyf='yt-dlp -i --extract-audio --audio-format flac --yes-playlist'
alias yyfp='yt-dlp -i --extract-audio --audio-format flac --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyr='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best --yes-playlist'
alias yyrp='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyy='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best -r 500K --yes-playlist'
alias yyyp='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best -r 500K --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'

25
al.ed

@ -0,0 +1,25 @@
alias bat='batcat --theme ansi'
alias cdb='cd /media/data/data/video/biblicke/'
alias cdf='cd /media/data/data/video/filmy/'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias gf='omgf --what-now'
alias grep='grep --color=auto'
alias la='ls -A '
alias ll='ls -AhlF '
alias lll='ls -AhlF --color=always | less -r'
alias ls='ls --color=auto'
alias mosh_opi4='mosh -p 27840:27900 opi4'
alias mosh_vps='mosh -p 37200:37500 vpssk'
alias sar='sudo aptitude remove '
alias sas='sudo aptitude safe-upgrade '
alias sau='sudo aptitude update '
alias svi='sudo vim '
alias yya='yt-dlp -i --extract-audio --audio-format mp3 --yes-playlist'
alias yyap='yt-dlp -i --extract-audio --audio-format mp3 --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyf='yt-dlp -i --extract-audio --audio-format flac --yes-playlist'
alias yyfp='yt-dlp -i --extract-audio --audio-format flac --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyr='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best --yes-playlist'
alias yyrp='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'
alias yyy='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best -r 500K --yes-playlist'
alias yyyp='yt-dlp -i -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best -r 500K --yes-playlist --output "%(playlist)s/%(playlist_index)s-%(title)s-%(id)s.%(ext)s"'

@ -0,0 +1,6 @@
# 2021-10-11 (Zodiac)
CLE_CLR=DYyYL
CLE_PB0='^Cg^E ^Cy\t '
CLE_PB1='^CR\u^Cw@^CR\h ^CG\w ^CBd:$(find . -mindepth 1 -maxdepth 1 -type d | wc -l) f:$(find . -mindepth 1 -maxdepth 1 -type f | wc -l) l:$(find . -mindepth 1 -maxdepth 1 -type l | wc -l) '
CLE_PB2='$(_git_prompt)'
CLE_PB3='^CG\n ^$ '

@ -0,0 +1,215 @@
##
## ** cle-mod: CLE module management **
#
#* version: 2021-10-11
#* author: Michael Arbet (marbet@redhat.com)
#* home: https://github.com/micharbet/CLE
#* license: GNU GPL v2
#* Copyright (C) 2016-2021 by Michael Arbet
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
local INDEXFN=modulist
local INDEXFILE=$CLE_D/$INDEXFN
# variable used only in this script
local MOD MODS DMOD MUPD MSTAT
#
# cle-mod helper functions
#
# check module status: installed/upgradable/custom
_clemodstat () (
if [ -f $CLE_D/$1 ]; then
SUMM=`md5sum $CLE_D/$1 | cut -d' ' -f1`
SUMI=`sed -n "/^$1:/s/$1:[^:]*:\([^:]*\):.*/\1/p" $INDEXFILE`
if [ -z "$SUMI" ]; then
# custom module, not found in index
echo C
elif [ $SUMI = $SUMM ]; then
# installed
echo I
else
# installed, upgradable
echo U
fi
else
# no such module here
echo
fi
)
# extract module description
_clemodesc () (
if [ -f $CLE_D/$1 ]; then
# get description from module directly
sed -n "/^##/s/.*$(basename $1):\s*\([^*]*\)\**/\1/p" $CLE_D/$1
else
# get description from index file
sed -n "/^$1:/s/$1:.*:\(.*\)/\1/p" $INDEXFILE
fi
)
# extract module version
_clemodver () (
if [ -f $CLE_D/$1 ]; then
# get version from module directly
sed -n "s/^#\* version:\s*//p" $CLE_D/$1
else
# get version from index file
sed -n "/^$1:/s/$1:\([^:]*\):.*/\1/p" $INDEXFILE
fi
)
# print module deails
_clemodet () (
MDESC=`_clemodesc $1`
MSTAT=`_clemodstat $1`
MVER=`_clemodver $1`
printf "$_CN [%1s] $_CL%-15s $_CN$_CD %10s $_CN %s\n" "$MSTAT" "$1" "$MVER" "$MDESC"
)
# get list of installed and available modules
_clemodlist () {
pushd $CLE_D >/dev/null
INST=`ls cle-* mod-* bin-* 2>/dev/null`
AVAIL=`cut -d: -f1 $INDEXFILE`
echo "$INST $AVAIL" | tr ' ' '\n' | sort | uniq
popd >/dev/null
}
# download list of available modules
_clemodindex () (
curl -ksS $CLE_SRC/modules/$INDEXFN >$INDEXFILE.tmp
MLINE=`head -1 $INDEXFILE.tmp`
# check if the file appears like module index
if [[ $MLINE =~ ..*:.*:.*:.* ]]; then
mv -f $INDEXFILE.tmp $INDEXFILE
else
rm -f $INDEXFILE.tmp
echo Module list could not be downloaded from $CLE_SRC
return 1
fi
)
# install module
_clemodadd () {
DMOD=$CLE_D/dl-$1
curl -ksS $CLE_SRC/modules/$1 >$DMOD
# check module signature
# every regular cle module should have at least it's identification strings
# (comments at the beginning, see this file or mod-example)
if grep -q "^##* *.*$1: ..*" $DMOD ; then
mv -f $DMOD $CLE_D/$1
if [[ $1 =~ 'mod-' ]]; then
# now include the module
_clexe $CLE_D/$1
fi
_clemodet $1
else
# either download error or this is no module
echo $1 download failed!
rm -f $DMOD
return 1
fi
}
#
# cle mod script main
#
case "$1" in
ls) ## `cle mod ls` - list modules
_clebold "Repository: $_CN$CLE_SRC"
_clebold "Local store: $_CN$CLE_D"
_clemodindex
echo
for MOD in `_clemodlist`; do
_clemodet $MOD
done
;;
add) ## `cle mod add [mod]` - install module from repository
#_clemodindex || return $?
# get matching modules
_clemodindex
MODS=`sed -n "/[^:]*$2[^:]*/s/\([^:]*\):.*/\1/p" $INDEXFILE`
[ "$MODS" ] || { echo Nothing like $2 to install; return 1; }
MODN=`wc -w <<<$MODS`
if [ $MODN -gt 1 ]; then
# more matches, choose one
PS3="$_CL choose module # $_CN"
select MOD in $MODS; do
[ -n "$MOD" ] && break
done
else
# exactly one module
MOD=$MODS
fi
[ $MOD ] || return
# show selected module details
echo
_clemodet $MOD
_cleask "Do you want to install this module?" || return
_clemodadd $MOD
;;
rm) ## `cle mod rm [mod]` - delete module
MODS=`cd $CLE_D; ls cle-* mod-* bin-* 2>/dev/null | grep $2`
[ "$MODS" ] || { echo Nothing like $2 to remove; return 1; }
MODN=`wc -w <<<$MODS`
if [ $MODN -gt 1 ]; then
# chose one in case of more matches
PS3="$_CL choose module to remove # $_CN"
select MOD in $MODS; do
[ -n "$MOD" ] && break
done
echo
else
MOD=$MODS
fi
[ $MOD ] || return
_clemodet $MOD
_cleask "Do yo want to remove this?" || return
mkdir -p $CLE_D/off
mv -f $CLE_D/$MOD $CLE_D/off
echo Module $MOD moved into $CLE_D/off
;;
update) ## `cle mod update` - update all modules
_clemodindex || return $?
MODS=`cd $CLE_D;ls cle-* mod-* bin-* 2>/dev/null`
MUPD=''
for MOD in $MODS; do
MSTAT=`_clemodstat $MOD`
[ "$MSTAT" = "U" ] && MUPD="$MUPD $MOD"
done
[ "$MUPD" ] || { echo Everything up to date.; return; }
_clebold Modules to update:$_CN $MUPD
_cleask "Continue?" || return
mkdir -p $CLE_D/off
for MOD in $MUPD; do
cp -f $CLE_D/$MOD $CLE_D/off
_clemodadd $MOD
done
;;
'')
_clebold " ${_CU}CLE module management"
_clebold "Repository: $_CN$CLE_SRC"
_clebold "Local store: $_CN$CLE_D"
echo
cle help "cle mod"
;;
help)
cle help "cle mod"
;;
*)
echo "'cle mod $1' not implemented"
echo "Try 'cle mod help '"
return 1
;;
esac
# remove internal functions
unset _clemodstat _clemodesc _clemodver _clemodet _clemodlist _clemodindex

@ -0,0 +1,38 @@
##
## ** mod-mosh: Live session with `lmosh` command **
#
#* version: 2019-11-16
#* author: Michael Arbet (marbet@redhat.com)
#* home: https://github.com/micharbet/CLE
#* license: GNU GPL v2
#* Copyright (C) 2019 by Michael Arbet
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
## `lmosh [user@]host` - live remote session with mobile shell
lmosh () (
[ "$1" ] || { cle help lmosh; return 1; }
_clepak tar
# Here is the issue: other wrappers use /var/tmp/$USER but mosh simply can't.
# Preparation phase runs as 'server' code before start mosh-server. At this
# point the $USER contains remote username.
# On the other side, there's the command run by mosh itself but this code
# is run locally and the remote username might not be known!
# Temporary home must be defined outside mosh command.
TEMPHOME=/var/tmp/$CLE_USER
command mosh --no-init --server="
# H=/var/tmp/\$USER; mkdir -m 755 -p \$H; cd \$H
mkdir -p $TEMPHOME
cd $TEMPHOME
[ $OSTYPE = darwin ] && D=D || D=d
base64 -\$D <<<$C64 | tar xzf - 2>/dev/null
mosh-server" \
$@ $TEMPHOME/$RC
)

@ -0,0 +1,9 @@
mod-git:2021-10-11:579befe2f3ffc412ccbe696336ec8db7:GIT helpers / shorcuts
mod-mancolor:2018-08-29:4cb76858862d9809fd7d5ecd821ded51:Colorize man pages
mod-mosh:2019-11-16:992b3e33800b0b62934422d3566e2a42:Live session with `lmosh` command
mod-richpaste:2020-11-02:7276eefe6f27aebd64fffc58aa9e4266:Rich history viewer with paste buffer (experimental)
cle-ed:2021-10-11:a6b78ec4bc880aac7a6b1c60fa451ffe:Tweak and config editor
cle-mod:2021-10-11:4cf73b6a0dc5130ff2b5d27807ce0c55:CLE module management
cle-palette:2021-10-11:4d168a44d231e8bdd5f96d2f04ed8e12:Color palettes for OSC4 capable terminals
cle-prompt:2019-03-31:d27abf5272c54db1d6b8196c9b43884d:pre-configured prompt themes
cle-rcmove:2021-10-11:2480e89d3b20b9e461b089881cd216cf:Move resource files to different folder

92
tw

@ -0,0 +1,92 @@
#!/bin/bash
_git_prompt() {
# local _FETCH=$(git fetch 2> /dev/null)
local _FETCH=$(git remote update 2> /dev/null)
local _BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
local _STATUS=$(git status -s 2> /dev/null)
local _UNTRACKED=$(echo "$_STATUS" | grep '^??' | wc -l)
local _STAGED1=$(echo "$_STATUS" | grep '^M ' | wc -l)
local _STAGED2=$(echo "$_STATUS" | grep '^D ' | wc -l)
local _STAGED3=$(echo "$_STATUS" | grep '^R ' | wc -l)
local _STAGED4=$(echo "$_STATUS" | grep '^C ' | wc -l)
local _STAGED5=$(echo "$_STATUS" | grep '^A ' | wc -l)
local _STAGED=$(($_STAGED1 + $_STAGED2 + $_STAGED3 + $_STAGED4 + $_STAGED5))
local _DRC1=$(echo "$_STATUS" | grep '^ D' | wc -l)
local _DRC2=$(echo "$_STATUS" | grep '^ R' | wc -l)
local _DRC3=$(echo "$_STATUS" | grep '^ C' | wc -l)
local _DRC=$(($_DRC1 + $_DRC2 + $_DRC3))
local _MODIFIED=$(echo "$_STATUS" | grep '^ M' | wc -l)
local _CONFLICT=$(echo "$_STATUS" | grep '^UU' | wc -l)
local _IGNORED=$(echo "$_STATUS" | grep '^!!' | wc -l)
local _NEPOZNAM=$(echo "$_STATUS" | grep '^ A|^T |^ T|^TT|^MM|^MT|^MD|^TM|^TD|^AM|^AT|^AD|^RM|^RT|^RD|^CM|^CT|^CD|^MM|^TM|^AM|^RM|^CM|^MT|^T|^AT|^RT|^CT|^MD|^TD|^AD|^RD|^CD|^DD|^AU|^UD|^UA|^DU|^AA' | wc -l)
local _STATS=''
local _STATUS2=$(git status -s 2>&1 )
local _GIT_EXIST=$(echo "$_STATUS2" | grep 'not a git repository' | wc -l)
########
local _STATUS3="$(git status 2> /dev/null)"
local _DIST_STRING=""
local _IS_AHEAD=$(echo -n "$_STATUS3" | grep "ahead")
local _IS_BEHIND=$(echo -n "$_STATUS3" | grep "behind")
local _DIVERGED=$(echo -n "$_STATUS3" | grep "diverged")
########
if [ "$_GIT_EXIST" = "0" ]; then
if [ ! -z "$_IS_AHEAD" ]; then
local _DIST_VAL=$(echo "$_IS_AHEAD" | sed 's/[^0-9]*//g')
_DIST_STRING="\e[1;36m\U2B60$_BRANCH \e[1;33m↑$_DIST_VAL\U21C4\e[0m" # push
elif [ ! -z "$_IS_BEHIND" ]; then
local _DIST_VAL=$(echo "$_IS_BEHIND" | sed 's/[^0-9]*//g')
_DIST_STRING="\e[1;36m\U2B60$_BRANCH \e[1;31m↓$_DIST_VAL\U21C4\e[0m" # pull
elif [ ! -z "$_DIVERGED" ]; then
_DIST_STRING="\e[1;36m\U2B60$_BRANCH \e[4;41m✖\U21C4\e[0m" # remote chaozz
else
_DIST_STRING="\e[1;36m\U2B60$_BRANCH \e[1;32m\U221A\U21C4\e[0m" # remote ok
fi
if [ ! -z "$_DIST_STRING" ]; then
echo -en "\e[0m$_DIST_STRING " # print remote
fi
#######
if [ "$_MODIFIED" != "" ] && [ "$_MODIFIED" != "0" ]; then
_STATS="$_STATS\e[1;33m✚$_MODIFIED\e[0m " # edit
fi
if [ "$_STAGED" != "" ] && [ "$_STAGED" != "0" ]; then
_STATS="$_STATS\e[1;31m●$_STAGED\e[0m " # staged
fi
if [ "$_CONFLICT" != "" ] && [ "$_CONFLICT" != "0" ]; then
_STATS="$_STATS\e[4;41m!$_CONFLICT\e[0m " # conflict
fi
if [ "$_DRC" != "" ] && [ "$_DRC" != "0" ]; then
_STATS="$_STATS\e[1;31m✖⤽$_DRC\e[0m " # rm mv cp
fi
if [ "$_UNTRACKED" != "" ] && [ "$_UNTRACKED" != "0" ]; then
_STATS="$_STATS\e[1;34m…$_UNTRACKED\e[0m " # untraged
fi
if [ "$_IGNORED" != "" ] && [ "$_IGNORED" != "0" ]; then
_STATS="$_STATS\e[1;35m-$_IGNORED\e[0m " # ignored
fi
if [ "$_NEPOZNAM" != "" ] && [ "$_NEPOZNAM" != "0" ]; then
_STATS="$_STATS\e[5;31m\U26A0 $_NEPOZNAM >git status\e[0m " # nepoznam
fi
if [ ! -z "$_STATS" ]; then
echo -en "\e[0m$_STATS \e[0m" # print local status
else
echo -en "\e[1;32m\U221A\U1F5A5\e[0m" # ok local status
fi
fi
}
# Black 30 40
# Red 31 41
# Green 32 42
# Yellow 33 43
# Blue 34 44
# Purple 35 45
# Cyan 36 46
# Light Gray 37 47
# ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
# ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
# ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
# ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
# ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
# ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
# ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
# \U221A 🖥 \U21D3 \U21D1 \UE0A0
Loading…
Cancel
Save