-PY_VERSIONS="2,2.7,3,"
-PY_VERSIONS+="$(eval echo 3.{`seq -s, 4 12`} | sed 's/ /,/g')"
+PY_VERSIONS=",2,2.7,3,"
+PY_VERSIONS+="$(eval echo 3.{`seq -s, 4 13`} | sed 's/ /,/g')"
-eval delegate_completion python python{$PY_VERSIONS}
+eval delegate_completion python{$PY_VERSIONS}
_pip_completion_loader() {
if [ "`type -t _pip_completion`" != function ]; then
- eval "`pip3 completion --bash`"
+ for pip in `eval type -fP pip{3,2,}`; do break; done
+ eval "`$pip completion --bash`"
fi
- eval complete -F _pip_completion pip pip{$PY_VERSIONS}
+ eval complete -F _pip_completion pip{$PY_VERSIONS}
unset _pip_completion_loader PY_VERSIONS
return 124
}
-eval complete -F _pip_completion_loader pip pip{$PY_VERSIONS}
+eval complete -F _pip_completion_loader pip{$PY_VERSIONS}
if [ "$HISTFILE" = "$HOME/.bash_history" ]; then
history -r
unset HISTFILE
+else
+ alias uh="unset HISTFILE; unalias uh"
fi
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
+# extended pattern matching, used in $HISTIGNORE
+shopt -s extglob
+HISTIGNORE='&: *:?*( ):??*( ):clear*( ):exit*( ):logout*( ):llp*( )'
+
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
[ "`type -t ls`" = alias ] && unalias ls
[ "`type -t ll`" = alias ] && unalias ll
-back() { cd - "$@"; }
-functions() { typeset -f "$@"; }
-j() { jobs; }
+alias functions='typeset -f'
if [ -r "$HOME"/admin/prog/bash_prompt ]; then
. "$HOME"/admin/prog/bash_prompt
unset _BASH_COMPLETIONS_DIR has_completion delegate_completion
if [ -d "$HOME/lib/config" ]; then
- complete -W "`cd \"$HOME/lib/config\" && echo *`" include
+ complete \
+ -W "`cd \"$HOME/lib/config\" && find . -type f -printf '%P\n'`" \
+ include
fi
complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
if test -x /usr/bin/screen >/dev/null 2>&1; then
- screen_newwin() {
- history -a
- screen "$@"
- }
+ alias screen_newwin='history -a; screen'
fi
-if [ "$SHLVL" -eq 1 -a "`type -t X`" = function ] && which startx >/dev/null 2>&1; then
- # From https://stackoverflow.com/a/18839557
+if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then
+ case "`type -t X`" in
+ alias)
+ alias _non_bash_X="`alias X | sed -e \"s/^alias X='//\" -e \"s/'\$//\"`"
+ alias X='history -a; _non_bash_X; history -r'
+ ;;
+
+ function)
+ # From https://stackoverflow.com/a/18839557
- copy_function() {
- test -n "$(declare -f "$1")" || return
- eval "${_/$1/$2}"
- }
+ copy_function() {
+ test -n "$(declare -f "$1")" || return
+ eval "${_/$1/$2}"
+ }
- rename_function() {
- copy_function "$@" || return
- unset -f "$1"
- }
+ rename_function() {
+ copy_function "$@" || return
+ unset -f "$1"
+ }
- rename_function X _non_bash_X
+ #rename_function X _non_bash_X
- X() { history -a; _non_bash_X; history -r; }
+ #X() { history -a; _non_bash_X; history -r; }
+ ;;
+ esac
fi
DestroyFunc UrgencyFunc
AddToFunc UrgencyFunc
+ I Iconify off
-+ I ThisWindow ("*Downloads|Skype") Break 1
++ I ThisWindow ("*Downloads") Break 1
+ I FlipFocus
+ I Raise
+ I WarpToWindow 5p 5p
+ I GotoDeskAndPage 2 0 1
+ I TERM_KOI8_BIG
+ I Wait TERM
++ I KeePassXC
++ I GotoDeskAndPage 0 0 0
+ I FireFox
DestroyFunc ResumeFunction
+ I TERM_KOI8_SSH_SCREEN(iskra-aviel.phdru.name, iskra)
+ I Wait TERM
+ I GotoDeskAndPage 1 0 1
-+ I TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru.name)
++ I TERM_KOI8_SSH_SCREEN(-D localhost:1080 phdru.name, phdru.name)
+ I Wait TERM
+ I GotoDeskAndPage 1 1 2
AddToFunc Pidgin I GotoDeskAndPage 1 1 0
+ I Exec exec cgmem_nice 300 pidgin
-DestroyFunc Skype
-AddToFunc Skype I GotoDeskAndPage 0 0 1
-+ I Exec BROWSER=firefox exec cgmem_nice 2000 skypeforlinux
-
-DestroyFunc XFilename
+DestroyFunc XSetbgFilename
AddToFunc XSetbgFilename I Exec "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
+DestroyFunc KeePassXC
+AddToFunc KeePassXC I Any ("*KeePassXC") Break
++ I GotoDeskAndPage 1 0 0
++ I Exec QT_SCALE_FACTOR=1.5 exec cgmem_nice 300 "$HOME"/tmp/KeePassXC-2.7.*-x86_64.AppImage
++ I Wait KeePassXC
+
+DestroyFunc SetVolumeAndBrowser
+AddToFunc SetVolumeAndBrowser
++ I Exec exec "$HOME"/current/projects/audio-cdr-video/audio/pa-volume set $0
++ I PipeRead "echo $[1]Firefox"
+
##############################################################################
# MENU Setup
#
pushdef(`TERM_KOI8', `Exec LC_CTYPE=ru_RU.KOI8-R exec TERM -xrm "*Page: 1 0 1"')dnl
pushdef(`TERM_RU_UTF8', `Exec LC_CTYPE=ru_RU.UTF-8 exec TERM -name URxvt -xrm "*Page: 1 0 1"')dnl
+ MENU_TERM_KOI8_SSH_SCREEN(phdru.name, phdru)
-+ MENU_TERM_KOI8_SSH_SCREEN(-D 1080 phdru.name, phdru SOCKS5)
++ MENU_TERM_KOI8_SSH_SCREEN(-D localhost:1080 phdru.name, phdru SOCKS5)
+ MENU_TERM_UTF8_BOTLT_SSH(phdru.name, phdru)
+ MENU_TERM_KOI8_BIG_SSH(phdru.name, PHDRU)
popdef(`TERM_KOI8', `TERM_RU_UTF8')dnl
+ "" Nop
+ "Browsers" Popup Browsers
+ "Utilities" Popup Utilities
++ "Volume" Popup Volume
#+ "" Nop
#+ "Lock Screen" Popup XlockMenu
+ "XScreenSaver" Popup XScreenSaverMenu
+ "Refresh Screen" Refresh
+ "xrefresh" Exec exec xrefresh
+ "" Nop
-+ "Skype" Skype
++ "KeePassXC" KeePassXC
+
+DestroyMenu Volume
+AddToMenu Volume "Choose one:" Title
++ "Silent (10%)" SetVolumeAndBrowser 6554 Resume
++ "Quiet (32%)" SetVolumeAndBrowser 20972 Resume
++ "Low (40%)" SetVolumeAndBrowser 26214 Resume
++ "Normal (52%)" SetVolumeAndBrowser 34078 Resume
++ "Loud (60%)" SetVolumeAndBrowser 39322 Resume
++ "Very loud (80%)" SetVolumeAndBrowser 52429 Suspend
+ "pavucontrol" PaVuControl
DestroyMenu Browsers
+ "Reinitialize Screen Saver" Exec exec xscreensaver-command --restart
AddToMenu XSetBgMenu "XSetBg" Title
-+ "Change wallpaper" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-force
++ "Change wallpaper" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-force
+ "Start" Exec exec cgmem_nice 100 "$HOME"/current/projects/xsetbg/xsetbg-http-start
+ "Stop" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-stop
+ "Restart" Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-restart
+ "" Nop
+ "Xli" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" "$fn"
-+ "Xli (scaled)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++ "Xli (auto-scale)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++ "Xli (50%)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom 50 "$fn"
++ "Xli (200%)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom 200 "$fn"
+ "Open in browser" Exec exec cgmem_nice 4000 webbrowserX -n "$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)"
+ "Filename" Exec exec "$HOME"/current/projects/xsetbg/print-filename.py -e koi8-r
+ "XFilename" Exec "$HOME"/current/projects/xsetbg/print-filename.py | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
+ "XFilename (wrapped)" XSetbgFilename
+ "" Nop
+ "Xli (prev.)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" "$fn"
-+ "Xli (prev., scaled)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++ "Xli (prev., auto-scale)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom auto "$fn"
++ "Xli (prev., 50%)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom 50 "$fn"
++ "Xli (prev., 200%)" Exec fn="$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)" && exec xli -title "$(echo $fn | sed 's/[ .]/_/g')" -zoom 200 "$fn"
+ "Open in browser (prev.)" Exec exec cgmem_nice 4000 webbrowserX -n "$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r 1)"
+ "Filename (prev.)" Exec exec "$HOME"/current/projects/xsetbg/print-filename.py -e koi8-r 1
+ "XFilename (prev.)" Exec "$HOME"/current/projects/xsetbg/print-filename.py 1 | text-wrap.py | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
+ "XFilename (prev., wrapped)" Exec "$HOME"/current/projects/xsetbg/print-filename.py 1 | text-wrap.py -w TEXT_WIDTH -s | gxmessage -buttons Ok -default Ok -fn 'MESSAGE_FONT' -file -
++ "" Nop
++ "Disable" Exec $HOME/current/projects/xsetbg/enable.py --disable "$($HOME/current/projects/xsetbg/print-filename.py -e koi8-r)" && exec "$HOME"/current/projects/xsetbg/xsetbg-http-force
############################################################################
# FvwmBacker
*FvwmButtons: (Title Next, Icon Jrecycle.xpm, Action Exec exec "$HOME"/current/projects/xsetbg/xsetbg-http-force)
#*FvwmButtons: (Title pavucontrol, Icon mini.sound.xpm, Action Exec "Volume Control" exec cgmem_nice 200 pavucontrol)
#*FvwmButtons: (Title Id3Info, Icon bell.xpm, Action Id3Info)
-#*FvwmButtons: (Title Skype, Icon skypeforlinux.png, Action Exec "Skype" FvwmCommand "GotoDeskAndPage 0 0 1" && BROWSER=firefox exec cgmem_nice 2000 skypeforlinux)
*FvwmButtons: (Title AudioPlayer, Icon bell.xpm, Action Exec "deadbeef" LC_CTYPE=ru_RU.KOI8-R FvwmCommand "GotoDeskAndPage 0 1 1" && exec cgmem_nice 400 deadbeef)
#*FvwmButtons: (Title XLock, Icon Jxlock.xpm, Action Exec exec xscreensaver-command -lock)
DestroyMenu Back-Gradient
AddToMenu Back-Gradient
-#+ "&Red decay%mini.bball.xpm%" SetBackground 'Exec exec bggen red1 red4 | xv -root -quit -'
-#+ "&Yellow Orange decay%mini.bball.xpm%" SetBackground 'Exec exec bggen Yellow1 Orange4 | xv -root -quit -'
-#+ "&Green decay%mini.bball.xpm%" SetBackground 'Exec exec bggen green1 DarkGreen | xv -root -quit -'
-#+ "&Blue decay%mini.bball.xpm%" SetBackground 'Exec exec bggen 100 100 255 0 0 100 | xv -root -quit -'
-#+ "&Magenta decayy%mini.bball.xpm%" SetBackground 'Exec exec bggen blue magenta | xv -root -quit -'
-#+ "&Blue to Red%mini.bball.xpm%" SetBackground 'Exec exec bggen blue red | xv -root -quit -'
-#+ "Blue to &Cyan%mini.bball.xpm%" SetBackground 'Exec exec bggen blue4 Cyan1 | xv -root -quit -'
-#+ "&Cyan to Blue%mini.bball.xpm%" SetBackground 'Exec exec bggen Cyan Blue4 | xv -root -quit -'
-#+ "&Black/pink/black%mini.bball.xpm%" SetBackground 'Exec exec bggen black pink black | xv -root -quit -'
-#+ "Black/&red/black%mini.bball.xpm%" SetBackground 'Exec exec bggen black red black | xv -root -quit -'
+#+ "&Red decay%mini.bball.xpm%" SetBackground 'Exec bggen red1 red4 | xv -root -quit -'
+#+ "&Yellow Orange decay%mini.bball.xpm%" SetBackground 'Exec bggen Yellow1 Orange4 | xv -root -quit -'
+#+ "&Green decay%mini.bball.xpm%" SetBackground 'Exec bggen green1 DarkGreen | xv -root -quit -'
+#+ "&Blue decay%mini.bball.xpm%" SetBackground 'Exec bggen 100 100 255 0 0 100 | xv -root -quit -'
+#+ "&Magenta decayy%mini.bball.xpm%" SetBackground 'Exec bggen blue magenta | xv -root -quit -'
+#+ "&Blue to Red%mini.bball.xpm%" SetBackground 'Exec bggen blue red | xv -root -quit -'
+#+ "Blue to &Cyan%mini.bball.xpm%" SetBackground 'Exec bggen blue4 Cyan1 | xv -root -quit -'
+#+ "&Cyan to Blue%mini.bball.xpm%" SetBackground 'Exec bggen Cyan Blue4 | xv -root -quit -'
+#+ "&Black/pink/black%mini.bball.xpm%" SetBackground 'Exec bggen black pink black | xv -root -quit -'
+#+ "Black/&red/black%mini.bball.xpm%" SetBackground 'Exec bggen black red black | xv -root -quit -'
#+ "&Sun Raise 1%mini.bball.xpm%" SetBackground 'Exec exec bggen black orange black pink| xv -root -quit -'
#+ "Sun Raise &2%mini.bball.xpm%" SetBackground 'Exec exec bggen black orange black Blue4| xv -root -quit -'
#+ "Sun Raise &3%mini.bball.xpm%" SetBackground 'Exec exec bggen black red black grey60| xv -root -quit -'
-#+ "&Rainbowy%mini.bball.xpm%" SetBackground 'Exec exec bggen red green blue | xv -root -quit -'
-#+ "&Full Rainbowy%mini.bball.xpm%" SetBackground 'Exec exec bggen black red yellow green blue purple black | xv -root -quit -'
-#+ "&White to Black%mini.bball.xpm%" SetBackground 'Exec exec bggen white black | xv -root -quit -'
-#+ "&Black to White%mini.bball.xpm%" SetBackground 'Exec exec bggen white black | xv -root -quit -'
+#+ "&Rainbowy%mini.bball.xpm%" SetBackground 'Exec bggen red green blue | xv -root -quit -'
+#+ "&Full Rainbowy%mini.bball.xpm%" SetBackground 'Exec bggen black red yellow green blue purple black | xv -root -quit -'
+#+ "&White to Black%mini.bball.xpm%" SetBackground 'Exec bggen white black | xv -root -quit -'
+#+ "&Black to White%mini.bball.xpm%" SetBackground 'Exec bggen white black | xv -root -quit -'
#------------------------------------------------------------------------------
#--------- Banner settings
+ "&Blue%mini.bball.xpm%" Exec exec xsetroot -solid Blue
+ "&Magenta%mini.bball.xpm%" Exec exec xsetroot -solid Magenta
+ "&White%mini.bball.xpm%" Exec exec xsetroot -solid White
-#+ "&Blue decay%mini.bball.xpm%" Exec exec bggen 100 100 255 0 0 100 | xv -root -quit -
-#+ "&Rainbow%mini.bball.xpm%" Exec exec bggen red green blue | xv -root -quit -
-#+ "&Full Rainbow%mini.bball.xpm%" Exec exec bggen black red yellow green blue purple black | xv -root -quit -
-#+ "&Magenta decay%mini.bball.xpm%" Exec exec bggen blue magenta | xv -root -quit -
+#+ "&Blue decay%mini.bball.xpm%" Exec bggen 100 100 255 0 0 100 | xv -root -quit -
+#+ "&Rainbow%mini.bball.xpm%" Exec bggen red green blue | xv -root -quit -
+#+ "&Full Rainbow%mini.bball.xpm%" Exec bggen black red yellow green blue purple black | xv -root -quit -
+#+ "&Magenta decay%mini.bball.xpm%" Exec bggen blue magenta | xv -root -quit -
#--------- Background animation
Tab: complete
M-Tab: menu-complete
+# This is Shift-Tab
+"\e[Z": menu-complete-backward
# Some terminals have ugly default behaviour for C-h.
#"\C-h": backward-delete-char
--- /dev/null
+# mc-specific bashrc
+
+# Source generic rc
+. ~/.bashrc
+
+# mc-specific settings
+unset HISTFILE
+ t lr
b View the file in a browser
- exec webbrowser-encode-url -e utf-8 file://%d/%f
+ exec webbrowser-encode-url file://%d/%f
+ t lr
= f \.(htm(l?)|txt)$
w View the file in a new browser window
- exec webbrowser-encode-url -e utf-8 -n file://%d/%f
+ exec webbrowser-encode-url -n file://%d/%f
+ t lr
t View the file in a new browser tab
- exec webbrowser-encode-url -e utf-8 -t file://%d/%f
+ exec webbrowser-encode-url -t file://%d/%f
+ t lr
p View the file in a new private browser tab
echo -n "Name of the distribution file (without extension) [$Pwd]: "
read zip
if [ "$zip"x = x ]; then zip="$Pwd"; fi
- cd .. && zip -r9 "$zip".zip "$Pwd" &&
+ cd .. && zip -ry9 "$zip".zip "$Pwd" &&
echo ../"$zip".zip created.
+ t d & f ^\.\.$
+ ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t lr
z zip the file/directory
- exec zip -r9 %f.zip %f
+ exec zip -ry9 %f.zip %f
+ ! f \.(z|Z|bz2|gz|lz|lzma)|(tbz2|tgz|tz|zip|ZIP|rar|RAR|xz|7z)$ & t lr
y zip the file/directory recoding filename(s)
+ t t
Z zip selected files/directories
ZIP=%{Enter zip name}
- exec zip -r9 "$ZIP" %s
+ exec zip -ry9 "$ZIP" %s
+ t t
Y zip selected files/directories recoding filenames
umask 077
PATH="$HOME"/bin:"$HOME"/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-MANPATH="$HOME"/man:/usr/local/man:/usr/share/man:/usr/man
+# MANPATH="$HOME"/man:/usr/local/man:/usr/share/man:/usr/man
# LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
-export PATH MANPATH # LD_LIBRARY_PATH
+export PATH # MANPATH # LD_LIBRARY_PATH
LANG=C
#LC_ALL=C
VISUAL="$EDITOR"
export EDITOR FCEDIT VISUAL
- HISTCONTROL=ignoreboth
- HISTIGNORE="`echo '&: *:~\?*:[bf]g:cd:clear:e:exit:logout:l:ls:ll:llp:[m,]c:��:w:X:x' | iconv -f koi8-r`"
+ FIGNORE='.o:~:.pyc:.pyo:.tmp*'
+ export FIGNORE
+
+ HISTCONTROL=erasedups:ignoreboth
+ HISTIGNORE='&: *:?:??:clear:exit:logout:llp'
HISTFILE="$HOME/.sh_history"
HISTFILESIZE=2000
HISTSIZE=1000
- export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE
+ HISTTIMEFORMAT='%Y-%m-%d %T '
+ export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE HISTTIMEFORMAT
# Used by bash/mc for hostname completion
HOSTFILE="$HOME"/lib/config/hosts
unset name email
+ # Enable plumbing commands to be completed
+ GIT_COMPLETION_SHOW_ALL_COMMANDS=1
+ export GIT_COMPLETION_SHOW_ALL_COMMANDS
+
#SCREENDIR="$HOME"/tmp/screen
#export SCREENDIR
#mkdir -p "$SCREENDIR"
#export DISPLAY
if [ -n "$DISPLAY" ]; then
+ #xhost +local:root > /dev/null 2>&1
PATH=$PATH:/usr/games
# mutt, python and vim
#__GL_FSAA_MODE=4
#export __GL_FSAA_MODE
- #xhost +local:root > /dev/null 2>&1
+ # Bigger fonts for Qt
+ QT_QPA_PLATFORMTHEME=qt5ct
+ #QT_SCALE_FACTOR=1.5
+ export QT_QPA_PLATFORMTHEME #QT_SCALE_FACTOR
fi
[ -n "$HAS_LESS" ] && unset HAS_LESS
esac
if test -n "$KSH_VERSION" -o -n "$FCEDIT"; then
- back() { cd - "$@"; }
- j() { jobs; }
+ alias back='cd -'
+ alias j=jobs
fi
# clear screen and history, logout
-chlo() { clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit; }
+alias clhlo='clear; cd; >$HISTFILE; unset HISTFILE; history -c; logout || exit'
+
+# cgmem_nice
+alias c3='cgmem_nice 300'
+alias c5='cgmem_nice 500'
+alias e3='exec cgmem_nice 300'
+alias e5='exec cgmem_nice 500'
if [ -n "$STY" -a "$WINDOW" != 0 ]; then
#unset MAILCHECK everywhere except for the 1st GNU screen window
if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then
- X() { startx >> .Xserver.log 2>&1; cyr; /bin/rm -f .Xauthority; }
+ alias X='startx >> .Xserver.log 2>&1; cyr; /bin/rm -f .Xauthority'
fi
-x() { exit; }
+alias x='logout || exit'
--- /dev/null
+" https://stackoverflow.com/a/62389532/7976758
+
+let g:netrw_browsex_viewer='webbrowser -p'
virtualenv_dir = os.environ.get('VIRTUAL_ENV')
if virtualenv_dir:
if (
- (sys.version_info[0] == 2)
- and os.path.exists(
- os.path.join(virtualenv_dir, 'lib', 'python2.7'))
- ) or (
- not os.path.exists(
- os.path.join(virtualenv_dir, 'lib', 'python2.7'))
+ os.path.exists(
+ os.path.join(
+ virtualenv_dir, 'lib',
+ 'python%d.%d' % (sys.version_info[0], sys.version_info[1])
+ )
+ )
):
for activate_this in [
os.path.join(virtualenv_dir, 'bin', 'activate_this.py'),
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
from urllib.request import urlretrieve
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from http.client import HTTPConnection, HTTPSConnection
from urllib.parse import urlsplit, parse_qsl, urlencode, quote, quote_plus
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys, os
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys, os
print(os.path.abspath(sys.argv[1]))
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from __future__ import print_function
import sys, os
#! /bin/sh
+set -e
if ! echo "$LC_CTYPE" | grep -Fiq utf-8; then
- echo "This script requires UTF-8 locale" 1>&2
- exit 1
+ echo "This script requires UTF-8 locale" 1>&2
+ exit 1
fi
-from_enc=utf-8
-to_enc=koi8-r
-
-while getopts f:t: opt; do
- case $opt in
- f ) from_enc="$OPTARG" ;;
- t ) to_enc="$OPTARG" ;;
- esac
-done
-shift `expr $OPTIND - 1`
+. get_encodings
for dir in "${@:-.}"; do
- cleanup-filenames-recursive.sh "$dir" &&
- recode-filenames-recursive.py "$from_enc" "$to_enc" "$dir" || exit 1
+ cleanup-filenames-recursive.sh "$dir" &&
+ recode-filenames-recursive.py -f "$from_encoding" -t "$to_encoding" \
+ "$dir" || exit 1
done
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
"""cmp.py: compare two files. Replace cmp because standard cmp cannot compare
large files.
"""
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys, os
#! /bin/sh
set -e
-usage() {
- echo "Usage: $0 [[from_enc] to_enc] filename" >&2
- exit 1
-}
-
-if [ $# -eq 1 ]; then
- from_enc="`python3 -c \"from m_lib.defenc import default_encoding; print(default_encoding)"`"
- if [ "$from_enc" != utf-8 ]; then
- to_enc=utf-8
- else
- usage
- fi
- filename="$1"
-elif [ $# -eq 2 ]; then
- from_enc="`python3 -c \"from m_lib.defenc import default_encoding; print(default_encoding)"`"
- to_enc="$1"
- filename="$2"
-elif [ $# -eq 3 ]; then
- from_enc="$1"
- to_enc="$2"
- filename="$3"
-else
- usage
-fi
-
cmd="`basename \"$0\"`"
case "$cmd" in
- cp_*) cmd="cp -p" ;;
+ cp_*) cmd="cp -ap" ;;
mv_*) cmd=mv ;;
*)
- echo "Uncnown command $0, aborting" >&2
+ echo "Unknown command $0, aborting" >&2
exit 2
;;
esac
-filename_recoded=`echo "$filename" | iconv -f "$from_enc" -t "$to_enc"`
-exec $cmd "$filename" "$filename_recoded"
+. get_encodings
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 [-f from_encoding] [-t to_encoding] path [path ...]" >&2
+ exit 1
+fi
+
+for filename in "$@"; do
+ filename_recoded=`echo "$filename" |
+ iconv -f "$from_encoding" -t "$to_encoding"`
+ if [ "$filename_recoded" != "$filename" ]; then
+ $cmd "$filename" "$filename_recoded"
+ fi
+done
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
-try:
- from urllib.parse import unquote
-except ImportError:
- from urllib import unquote
+from urllib.parse import unquote
import sys
while True:
--- /dev/null
+#! /bin/sh
+
+case "$0" in
+ */get_encodings)
+ sourced=false
+ ;;
+ *)
+ sourced=true
+ ;;
+esac
+
+from_encoding=
+to_encoding=
+default_encoding="`python3 -c \"from m_lib.defenc import default_encoding; print(default_encoding)"`"
+
+while getopts f:t: opt; do
+ case $opt in
+ f ) from_encoding="$OPTARG" ;;
+ t ) to_encoding="$OPTARG" ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+error() {
+ echo "$@" >&2
+ echo "Usage: $0 [-f from_encoding] [-t to_encoding] [path [path ...]]" >&2
+ exit 1
+}
+
+if [ -n "$from_encoding" ]; then
+ if [ -n "$to_encoding" ]; then
+ : # Everything is defined, no need to guess
+ elif [ "$from_encoding" = utf-8 ]; then
+ if [ "$default_encoding" = utf-8 ]; then
+ error Cannot guess to_encoding
+ else
+ to_encoding="$default_encoding"
+ fi
+ else
+ to_encoding=utf-8
+ fi
+elif [ -n "$to_encoding" ]; then
+ if [ "$to_encoding" = "$default_encoding" ]; then
+ if [ "$default_encoding" = utf-8 ]; then
+ error Cannot guess from_encoding
+ else
+ from_encoding=utf-8
+ fi
+ else
+ from_encoding="$default_encoding"
+ fi
+else
+ if [ "$default_encoding" = utf-8 ]; then
+ error Cannot guess encodings
+ else
+ from_encoding="$default_encoding"
+ to_encoding=utf-8
+ fi
+fi
+
+if [ "$sourced" = false ]; then
+ echo "$from_encoding $to_encoding"
+fi
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from m_lib.net.www.html import HTMLParser as _HTMLParser
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
charset = None
def xml_decl_handler(version, encoding, standalone):
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
"Recode to default charset"
import sys
-from getopt import getopt
-from m_lib.defenc import default_encoding
-from_charset = "cp1251"
-to_charset = default_encoding
+from recode_filenames import parse_args
+from_encoding, to_encoding, files = parse_args(default='-')
-options, arguments = getopt(sys.argv[1:], 'f:t:')
-for option, value in options:
- if option == '-f':
- from_charset = value
- elif option == '-t':
- to_charset = value
output = getattr(sys.stdout, 'buffer', sys.stdout)
-if arguments:
- for file in arguments:
+if files != ['-']:
+ for file in files:
with open(file, 'rb') as infile:
for line in infile:
output.write(
- line.decode(from_charset, "replace").
- encode(to_charset, "replace"))
+ line.decode(from_encoding, "replace").
+ encode(to_encoding, "replace"))
else:
input = getattr(sys.stdin, 'buffer', sys.stdin)
for line in input:
output.write(
- line.decode(from_charset, "replace").encode(to_charset, "replace"))
+ line.decode(from_encoding, "replace").
+ encode(to_encoding, "replace")
+ )
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
"iconv wrapper"
-from getopt import getopt
-import os, shutil, sys, tempfile
+import os, shutil, tempfile
-options, arguments = getopt(sys.argv[1:], 'f:t:')
-
-from_charset = to_charset = None
-
-for option, value in options:
- if option == '-f':
- from_charset = value
- elif option == '-t':
- to_charset = value
-
-
-if from_charset is None:
- raise ValueError("you must use -f param to name source charset")
-
-if to_charset is None:
- raise ValueError("you must use -t param to name destination charset")
+from recode_filenames import parse_args
+from_encoding, to_encoding, files = parse_args(default='-')
tempfname = "_iconvx" + tempfile.gettempprefix() + "tmp"
-if arguments:
+if files != ['-']:
try:
- for file in arguments:
+ for file in files:
os.system(
"iconv.py -f '%s' -t '%s' '%s' > '%s'" % (
- from_charset, to_charset, file, tempfname))
+ from_encoding, to_encoding, file, tempfname))
shutil.copy2(tempfname, file)
finally:
os.unlink(tempfname)
else: # filter stdin => stdout
- os.system("iconv.py -f '%s' -t '%s'" % (from_charset, to_charset))
+ os.system("iconv.py -f '%s' -t '%s'" % (from_encoding, to_encoding))
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys
from m_lib.defenc import default_encoding
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys
from m_lib.rus import rus2lat
+++ /dev/null
-#! /bin/sh
-
-. "$HOME"/lib/X11/koi8.vars
-exec luit -encoding koi8-r "$@"
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys
from m_lib.rus import lat2rus
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys, subprocess
#! /bin/sh
-options="--ao pulse --quiet"
+options="--ao=pulse --quiet"
if [ -n "$AUDIO_VOLUME" ]; then
options="$options --af=loudnorm --volume=$AUDIO_VOLUME"
+++ /dev/null
-#! /bin/sh
-
-. "$HOME"/lib/X11/utf-8.vars
-exec mutt "$@"
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
-import sys, os
-from recode_filenames import _recode
+import os
-if len(sys.argv) == 3:
- start_dir = '.'
-elif len(sys.argv) == 4:
- start_dir = sys.argv[3]
-else:
- sys.exit("Usage: %s src_enc dst_enc [start_dir]" % sys.argv[0])
+from recode_filenames import parse_args, build_recode
+
+from_encoding, to_encoding, dirnames = parse_args(default='.')
+_recode = build_recode(from_encoding, to_encoding)
def _onerror(exc):
raise exc
-plist = list(os.walk(start_dir, topdown=False, onerror=_onerror))
-
save_dir = os.getcwd()
-for dirname, _subdirs, fnames in plist:
- if dirname == '.':
- continue
- os.chdir(dirname)
- for filename in fnames:
- # if not exists - it was renamed already
- if os.path.exists(filename) and \
- os.path.isfile(filename):
- newname = _recode(filename)
- if newname != filename:
- os.rename(filename, newname)
- os.chdir('..')
- dirname = os.path.basename(dirname)
- newname = _recode(dirname)
- if newname != dirname:
- os.rename(dirname, newname)
- os.chdir(save_dir)
+for start_dir in dirnames:
+ for dirname, _subdirs, fnames in list(
+ os.walk(start_dir, topdown=False, onerror=_onerror)
+ ):
+ if dirname != '.':
+ os.chdir(dirname)
+ for filename in fnames:
+ # if not exists - it was renamed already
+ if os.path.exists(filename) and \
+ os.path.isfile(filename):
+ newname = _recode(filename)
+ if not isinstance(newname, str):
+ newname = newname.decode()
+ if newname != filename:
+ os.rename(filename, newname)
+ if dirname != '.':
+ os.chdir('..')
+ dirname = os.path.basename(dirname)
+ newname = _recode(dirname)
+ if not isinstance(newname, str):
+ newname = newname.decode()
+ if newname != dirname:
+ os.rename(dirname, newname)
+ os.chdir(save_dir)
#! /bin/sh
+set -e
-fromenc="$1"
-toenc="$2"
-shift 2
+tmpfile="`mktemp`"
+trap "exec rm -f $tmpfile" EXIT HUP INT QUIT PIPE TERM
-tmpfile="`mktemp`" &&
+. get_encodings
for file in "$@"; do
- iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" &&
+ iconv -f "$from_encoding" -t "$to_encoding" "$file" >"$tmpfile"
cp "$tmpfile" "$file"
done
-
-exec rm "$tmpfile"
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
# -*- coding: koi8-r -*-
+import argparse
import sys
-src_encoding = sys.argv[1]
-dst_encoding = sys.argv[2]
+from m_lib.defenc import default_encoding
-if src_encoding == "translit":
- if dst_encoding == "koi8-r":
- from m_lib.rus.lat2rus import lat2koi as _recode
- elif dst_encoding == "cp1251":
- from m_lib.rus.lat2rus import lat2win as _recode
+
+def parse_args(default=None):
+ parser = argparse.ArgumentParser(description='Recode filenames')
+ parser.add_argument('-f', '--from-encoding', help='from encoding')
+ parser.add_argument('-t', '--to-encoding', help='to encoding')
+ parser.add_argument('filename', nargs='*' if default else '+',
+ default=[default], help='filenames to recode')
+ args = parser.parse_args()
+
+ from_encoding = args.from_encoding
+ to_encoding = args.to_encoding
+
+ if from_encoding:
+ if to_encoding:
+ pass # Everything is defined, no need to guess
+ elif from_encoding == 'utf-8':
+ if default_encoding == 'utf-8':
+ sys.exit('Cannot guess to_encoding')
+ else:
+ to_encoding = default_encoding
+ else:
+ to_encoding = 'utf-8'
+ elif to_encoding:
+ if to_encoding == default_encoding:
+ if default_encoding == 'utf-8':
+ sys.exit('Cannot guess from_encoding')
+ else:
+ from_encoding = 'utf-8'
+ else:
+ from_encoding = default_encoding
else:
- raise NotImplementedError("destination encoding must be koi8-r or cp1251, not `%s'" % dst_encoding)
+ if default_encoding == 'utf-8':
+ sys.exit('Cannot guess encodings')
+ else:
+ from_encoding = default_encoding
+ to_encoding = 'utf-8'
+
+ return from_encoding, to_encoding, args.filename
+
+
+def build_recode(from_encoding, to_encoding):
+ if from_encoding == "translit":
+ if to_encoding == "koi8-r":
+ from m_lib.rus.lat2rus import lat2koi as _recode
+ elif to_encoding == "cp1251":
+ from m_lib.rus.lat2rus import lat2win as _recode
+ else:
+ raise NotImplementedError(
+ "destination encoding must be koi8-r or cp1251, "
+ "not `%s'" % to_encoding)
+
+ elif to_encoding == "translit":
+ if from_encoding == "koi8-r":
+ from m_lib.rus.rus2lat import koi2lat as _recode
+ elif from_encoding == "cp1251":
+ from m_lib.rus.rus2lat import win2lat as _recode
+ else:
+ raise NotImplementedError(
+ "source encoding must be koi8-r or cp1251, "
+ "not `%s'" % from_encoding)
+
+ from m_lib.rus.rus2lat import koi2lat_d
+ koi2lat_d["�"] = '' # remove apostrophs -
+ koi2lat_d["�"] = '' # they are not very good characters in filenames
+ koi2lat_d["�"] = '' # especially on Windoze
+ koi2lat_d["�"] = '' # :-)
+
+ elif from_encoding == "url":
+ try:
+ from_encoding, to_encoding = to_encoding.split('/')
+ except ValueError:
+ from_encoding = to_encoding
+ from urllib.parse import unquote
+ from m_lib.opstring import recode
+
+ def _recode(s):
+ s = unquote(s)
+ if from_encoding != to_encoding:
+ s = recode(s, from_encoding, to_encoding, "replace")
+ return s
+
+ elif to_encoding == "url":
+ try:
+ from_encoding, to_encoding = from_encoding.split('/')
+ except ValueError:
+ to_encoding = from_encoding
+ from urllib.parse import quote
+ from m_lib.opstring import recode
+
+ def _recode(s):
+ if from_encoding != to_encoding:
+ s = recode(s, from_encoding, to_encoding, "replace")
+ # wget treats them as safe
+ # vvvvvvvvvvvvv
+ return quote(s, safe=";/?:@&=+$,()'")
-elif dst_encoding == "translit":
- if src_encoding == "koi8-r":
- from m_lib.rus.rus2lat import koi2lat as _recode
- elif src_encoding == "cp1251":
- from m_lib.rus.rus2lat import win2lat as _recode
else:
- raise NotImplementedError("source encoding must be koi8-r or cp1251, not `%s'" % src_encoding)
-
- from m_lib.rus.rus2lat import koi2lat_d
- koi2lat_d["�"] = '' # remove apostrophs -
- koi2lat_d["�"] = '' # they are not very good characters in filenames
- koi2lat_d["�"] = '' # especially on Windoze
- koi2lat_d["�"] = '' # :-)
-
-elif src_encoding == "url":
- try:
- src_encoding, dst_encoding = dst_encoding.split('/')
- except ValueError:
- src_encoding = dst_encoding
- from m_lib.opstring import recode
- import urllib
- def _recode(s):
- s = urllib.unquote(s)
- if src_encoding != dst_encoding:
- s = recode(s, src_encoding, dst_encoding, "replace")
- return s
-
-elif dst_encoding == "url":
- try:
- src_encoding, dst_encoding = src_encoding.split('/')
- except ValueError:
- dst_encoding = src_encoding
- from m_lib.opstring import recode
- import urllib
- def _recode(s):
- if src_encoding != dst_encoding:
- s = recode(s, src_encoding, dst_encoding, "replace")
- return urllib.quote(s, safe=";/?:@&=+$,()'") # wget treats them as safe
-
-else:
- from m_lib.opstring import recode
- def _recode(s):
- return recode(s, src_encoding, dst_encoding, "replace")
+ def _recode(s):
+ return s.encode(to_encoding, "surrogateescape").\
+ decode(from_encoding, "surrogateescape")
+
+ return _recode
if __name__ == "__main__":
import os
- for filename in sys.argv[3:]:
+ from_encoding, to_encoding, filenames = parse_args()
+ _recode = build_recode(from_encoding, to_encoding)
+ for filename in filenames:
new_name = _recode(filename)
- if type(filename) is not type(new_name):
+ if not isinstance(new_name, str):
new_name = new_name.decode()
if new_name != filename:
+ sys.stdout.buffer.write(
+ b'%s %s / %s -> %s\n' % (
+ from_encoding.encode(), to_encoding.encode(),
+ filename.encode(default_encoding, 'replace'),
+ new_name.encode(to_encoding, 'replace'))
+ )
os.rename(filename, new_name)
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from __future__ import print_function
import sys
#! /bin/sh
-exec tcptraceroute "$@"
+exec sudo tcptraceroute "$@"
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
# https://stackoverflow.com/a/518232/7976758
import sys
import unicodedata
+from m_lib.defenc import default_encoding
+
def strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s)
if len(sys.argv) == 1:
sys.exit('Usage: %s name\n' % sys.argv[0])
for name in sys.argv[1:]:
- print(latin1_to_ascii(name))
+ sys.stdout.buffer.write(
+ latin1_to_ascii(name).encode(default_encoding, 'surrogateescape')
+ + b'\n'
+ )
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
"""Unzip with encoded filenames
Written by Oleg Broytman. Copyright (C) 2009-2024 PhiloSoft Design.
if not tgt.endswith('/'):
infile = zf.open(zinfo.filename)
- fp = open(tgt, 'wb')
- copyfileobj(infile, fp)
- fp.close()
+ if zinfo.external_attr == 0xA1ED0000:
+ os.symlink(infile.read(), tgt)
+ else: # regular file
+ fp = open(tgt, 'wb')
+ copyfileobj(infile, fp)
+ fp.close()
infile.close()
- dt = time.mktime(zinfo.date_time + (0, 0, -1))
- os.utime(tgt, (dt, dt))
+ if zinfo.external_attr != 0xA1ED0000:
+ # set timestamp for directories and files but not symlinks
+ dt = time.mktime(zinfo.date_time + (0, 0, -1))
+ os.utime(tgt, (dt, dt))
zf.close()
+++ /dev/null
-#! /bin/sh
-exec vim -c "ed ++enc=utf-8" "$@"
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
import sys, os
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from getopt import getopt, GetoptError
from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
url += ':%d' % port
if path:
if protocol == "file":
- url += quote(path)
+ url += quote(path.encode(encoding))
else:
if isinstance(path, bytes):
path = path.decode(default_encoding)
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
from getopt import getopt, GetoptError
from urllib.parse import urlsplit, parse_qsl, quote, quote_plus, urlencode
--- /dev/null
+whence
\ No newline at end of file
-#! /usr/bin/env python3
+#! /home/phd/.local/bin/python3
"""Zip (zip -r9) with encoded filenames
Written by Oleg Broytman. Copyright (C) 2009-2023 PhiloSoft Design.
import sys, os
from getopt import getopt, GetoptError
-from zipfile import ZipFile, ZIP_DEFLATED
+from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED
from m_lib.defenc import default_encoding
def usage():
usage()
def addToZip(zf, path):
- if os.path.isfile(path):
+ if os.path.isfile(path) or os.path.islink(path):
print(path)
if isinstance(path, bytes):
recoded_path = path.decode(default_encoding).encode('cp866')
else:
recoded_path = path
- zf.write(path, recoded_path, ZIP_DEFLATED)
+ if os.path.islink(path):
+ # http://www.mail-archive.com/python-list@python.org/msg34223.html
+ zipInfo = ZipInfo(recoded_path)
+ zipInfo.create_system = 3
+ # say, symlink attr magic...
+ zipInfo.external_attr = 0xA1ED0000
+ zf.writestr(zipInfo, os.readlink(path))
+ else:
+ zf.write(path, recoded_path, ZIP_DEFLATED)
elif os.path.isdir(path):
for nm in os.listdir(path):
addToZip(zf, os.path.join(path, nm))
!
! XTerm
!
-#if WIDTH > 640
+#if WIDTH > 1900
+! 1920x1080
+# define XTERM_GEOMETRY 80x32
+#elif WIDTH > 1024
# define XTERM_GEOMETRY 80x30
#else
! 640x480
Rxvt*color15 : white
#if WIDTH > 1600
-# define XFT_FONT xft:Monospace:size=18
+# define XFT_FONT xft:Liberation Mono:size=18
#elif WIDTH > 1200
-# define XFT_FONT xft:Monospace:size=16
+# define XFT_FONT xft:Liberation Mono:size=16
#elif WIDTH > 800
-# define XFT_FONT xft:Monospace:size=14
+# define XFT_FONT xft:Liberation Mono:size=14
#else
-# define XFT_FONT xft:Monospace:size=12
+# define XFT_FONT xft:Liberation Mono:size=12
#endif
URxvt*termName: rxvt
--- /dev/null
+_conda_variant=miniforge
+if [ $_conda_variant = miniconda ]; then
+ CONDA_ROOT="$HOME"/miniconda3
+ conda_version=24.9.2-0
+elif [ $_conda_variant = miniforge ]; then
+ CONDA_ROOT="$HOME"/miniforge3
+ conda_version=24.9.0-0
+elif [ $_conda_variant = mambaforge ]; then
+ CONDA_ROOT="$HOME"/mambaforge
+ conda_version=24.9.0-0
+fi
+
+if [ ! -d "$CONDA_ROOT" ]; then
+ if [ $_conda_variant = miniconda ]; then
+ wget -N https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh &&
+ sh ./Miniconda3-latest-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+ elif [ $_conda_variant = miniforge ]; then
+ wget -N https://github.com/conda-forge/miniforge/releases/download/"$conda_version"/Miniforge3-"$conda_version"-Linux-x86_64.sh &&
+ sh ./Miniforge3-"$conda_version"-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+ elif [ $_conda_variant = mambaforge ]; then
+ wget -N https://github.com/conda-forge/miniforge/releases/download/"$conda_version"/Mambaforge-"$conda_version"-Linux-x86_64.sh &&
+ sh ./Mambaforge-"$conda_version"-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+ fi
+fi &&
+
+. "$CONDA_ROOT"/etc/profile.d/conda.sh &&
+
+#if [ ! -f "$CONDA_ROOT"/bin/register-python-argcomplete ]; then
+#eval "$($CONDA_ROOT/bin/register-python-argcomplete conda)" &&
+#fi &&
+
+if [ ! -f "$CONDA_ROOT"/etc/profile.d/bash_completion.sh ]; then
+ conda install --name base --yes conda-bash-completion
+fi &&
+. "$CONDA_ROOT"/etc/profile.d/bash_completion.sh &&
+
+unset _conda_variant CONDA_ROOT conda_version
+#export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
+#unset SSH_AGENT_PID
gpgconf --launch gpg-agent &&
include gpg-agent-update-tty
--- /dev/null
+0 localhost localhost.localdomain
+0 phdru.name home.phdru.name git.phdru.name zope.phdru.name
+
+# Found in https://blog.sanctum.geek.nz/bash-hostname-completion/
+$include /etc/hosts
PY_VER=2.7
export PY_VER
-
-if type -p pip >/dev/null 2>&1; then
- eval "`pip completion --bash`"
- rm -rf /tmp/pip_build_"$USER"
- complete -F _pip_completion pip2 pip2.7 pip3 pip3.3 pip3.4 pip3.5 pip3.6
-fi
+PATH=$PATH:~/prog/git-scripts
--- /dev/null
+include git/less
+
+PY_VER=3.7
+export PY_VER
+PATH=$PATH:~/prog/git-scripts
# readline/pyreadline
- pyreadlinew32_startup = os.path.join(
- sys.prefix, 'lib', 'site-packages',
- 'pyreadline', 'configuration', 'startup.py')
+ # From Bruce Edge:
+ # https://mail.python.org/pipermail/python-list/2001-March/062888.html
- if os.path.exists(pyreadlinew32_startup):
- execfile(pyreadlinew32_startup)
-
- else:
- # From Bruce Edge:
- # https://mail.python.org/pipermail/python-list/2001-March/062888.html
-
- try:
- import rlcompleter # noqa: need for completion
- import readline
- initfile = os.environ.get('INPUTRC') \
- or os.path.expanduser('~/.inputrc')
- readline.read_init_file(initfile)
-
- # if 'libedit' in readline.__doc__:
- # readline.parse_and_bind("bind ^I rl_complete")
- # else:
- # readline.parse_and_bind("tab: complete")
-
- histfiles = ['~/.python_history']
- # if 'VIRTUAL_ENV' in os.environ:
- # histfiles.append('$VIRTUAL_ENV/.python_history')
- for histfile in histfiles:
- try:
- histfile = os.path.expandvars(histfile)
- histfile = os.path.expanduser(histfile)
- readline.read_history_file(histfile)
- except IOError:
- pass # No such file
-
- def savehist():
- histsize = os.environ.get('HISTSIZE')
- if histsize:
- try:
- histsize = int(histsize)
- except ValueError:
- pass
- else:
- readline.set_history_length(histsize)
- histfile = histfiles[-1]
+ try:
+ import rlcompleter # noqa: need for completion
+ import readline
+ initfile = os.environ.get('INPUTRC') \
+ or os.path.expanduser('~/.inputrc')
+ readline.read_init_file(initfile)
+
+ # if 'libedit' in readline.__doc__:
+ # readline.parse_and_bind("bind ^I rl_complete")
+ # else:
+ # readline.parse_and_bind("tab: complete")
+
+ histfiles = ['~/.python_history']
+ # if 'VIRTUAL_ENV' in os.environ:
+ # histfiles.append('$VIRTUAL_ENV/.python_history')
+ for histfile in histfiles:
+ try:
histfile = os.path.expandvars(histfile)
histfile = os.path.expanduser(histfile)
+ readline.read_history_file(histfile)
+ except IOError:
+ pass # No such file
+
+ def savehist():
+ histsize = os.environ.get('HISTSIZE')
+ if histsize:
try:
- readline.write_history_file(histfile)
- except IOError:
+ histsize = int(histsize)
+ except ValueError:
pass
-
+ else:
+ readline.set_history_length(histsize)
+ histfile = histfiles[-1]
+ histfile = os.path.expandvars(histfile)
+ histfile = os.path.expanduser(histfile)
+ try:
+ readline.write_history_file(histfile)
+ except IOError:
+ pass
+
+ import atexit
+ atexit.register(savehist)
+
+ def unset_history():
import atexit
- atexit.register(savehist)
+ atexit._exithandlers = []
+ builtins.unset_history = unset_history
- except (ImportError, AttributeError):
- # no readline or atexit, or readline doesn't have
- # {read,write}_history_file - ignore the error
- pass
+ except (ImportError, AttributeError):
+ # no readline or atexit, or readline doesn't have
+ # {read,write}_history_file - ignore the error
+ pass
# terminal