Merge branch 'master' of github.com:glenux/ansible-role-glenux-bash
This commit is contained in:
commit
31e4aa01bd
35 changed files with 506 additions and 89 deletions
|
@ -1,70 +1,110 @@
|
|||
### ALIASES SUDO
|
||||
alias apt-get='sudo apt-get'
|
||||
alias apt-cache='sudo apt-cache'
|
||||
alias dpkg='sudo dpkg'
|
||||
alias photo_dl='sudo gphoto2 --auto-detect -P'
|
||||
alias gnux_dvd='sudo /home/warbrain/bin/gnux_dvd'
|
||||
|
||||
alias svnforget='svn st | egrep '\''^(\!|\?).*\.(cpp|cc|am|h|hh|hxx|tex|png)$'\'''
|
||||
|
||||
## ALIASES
|
||||
alias atodo='todo -G'
|
||||
alias tdg='todo -G'
|
||||
alias be='bundle exec'
|
||||
|
||||
alias ls='ls --color=auto -F'
|
||||
alias makepatch='LC_ALL=C TZ=UTC0 diff -Naur '
|
||||
alias timidity='timidity -Oe'
|
||||
alias synaptic='gksu synaptic'
|
||||
alias sl='ls'
|
||||
#alias cmake='colormake'
|
||||
alias music123='esddsp music123'
|
||||
alias xdu='du > ~/.tmp/du.out && xdu -n -c 7 ~/.tmp/du.out'
|
||||
alias gnux_bgfiles='find -exec du -sh "{}" \; | egrep [0-9]M | sort -n | tail -n 11 | head -n 10'
|
||||
alias fr='file-roller'
|
||||
alias mp3blaster='esddsp mp3blaster'
|
||||
alias ll='ls -lh'
|
||||
alias llla='ls -la | less'
|
||||
alias lsd="ls -F | egrep '\/$'"
|
||||
alias speech='esddsp festival --tts'
|
||||
alias gvimr='gvim --remote-tab'
|
||||
alias grep='grep --color'
|
||||
## SERVERS SSH
|
||||
|
||||
alias host_dptmaths='ssh -X -C ssh.dptmaths.ens-cachan.fr -l rolland'
|
||||
alias host_shamox='ssh -X -c arcfour -C -p 22 shamox.ath.cx -l warbrain'
|
||||
alias host_darby='ssh -X -c arcfour -C darby -l warbrain'
|
||||
alias host_daka='ssh -X -c arcfour -C daka -l warbrain'
|
||||
# pass 'noir'
|
||||
alias tunnel_murlock='ssh -L8882:localhost:8888 bewan@murlock.hd.free.fr -N'
|
||||
#alias diades='ssh -X -c arcfour -C diades.glenux.net -l warbrain'
|
||||
#alias dungeon='ssh -X -c blowfish -C dungeon -l warbrain'
|
||||
#alias djeke='ssh -X -c blowfish -C djeke -l warbrain'
|
||||
#alias sword='ssh -X -c blowfish -C sword.ath.cx -l warbrain'
|
||||
alias ykhoo='ssh -X -c blowfish -C ykhoo.ath.cx -l warbrain'
|
||||
alias daneel='ssh -X -c blowfish -C daneel.glenux.net -l warbrain'
|
||||
alias ef='LD_PRELOAD=libefence.so.0.0 '
|
||||
# ## ALIASES SUDO
|
||||
|
||||
## MOLLY-GUARD
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
alias divx='find /cdrom -name \*.[Aa][Vv][Ii] -o -name \*.[oO][Gg][Mm] -ok mplayer \-fs \-x 512 \-y 300 {} \;'
|
||||
#alias ip='/sbin/ifconfig eth0 | grep adr | sed -e "s/^.*adr://" |sed -e "s/ Bcast.*//" '
|
||||
## BROWSING FILESYSTEM
|
||||
alias ls='$( if hash exa 2>&1 >/dev/null; then echo exa ; else ls ; fi ) -F --group-directories-first '
|
||||
alias sl='ls'
|
||||
alias ll='ls -lh'
|
||||
alias llla='ls -la | less'
|
||||
alias lsd="ls -F | egrep '\/$'"
|
||||
alias xdu='du > ~/.tmp/du.out && xdu -n -c 7 ~/.tmp/du.out'
|
||||
alias iexplore='xdg-open .'
|
||||
|
||||
alias rmplayer="mplayer -ao esd -nocache"
|
||||
alias cat='$( if hash batcat 2>&1 >/dev/null ; then echo batcat ; else echo cat ; fi )'
|
||||
alias bat='$( if hash batcat 2>&1 >/dev/null ; then echo batcat ; else echo cat ; fi )'
|
||||
|
||||
alias filter_video="egrep -i '\.(avi|mov|mpe?g|mkv|wmv|rm)$'"
|
||||
alias filter_audio="egrep -i '\.(wav|flac|mp3|aac|m4a|ogg|wma)$'"
|
||||
|
||||
## FILES FILTERING
|
||||
alias filter_video="egrep -i '\.(avi|mov|mpe?g|mkv|wmv|rm|mp4)$'"
|
||||
alias filter_audio="egrep -i '\.(wav|flac|mp3|aac|m4a|ogg|wma|opus|ape)$'"
|
||||
alias filter_image="egrep -i '\.(jpe?g|png|xcf(.gz)|eps|svg|gif)$'"
|
||||
alias filter_imageart="egrep -i '\.(xcf(.gz)?|psd|ora|svg)$'"
|
||||
alias filter_archive="egrep -i '\.(tar\.)?(gz|bz2|7z|tgz|zip|rar|ace|zoo|arj|lha)$'"
|
||||
alias filter_document="egrep -i '\.(txt|pdf|ps|sxw|odt|doc|rtf)$'"
|
||||
alias filter_document="egrep -i '\.(txt|pdf|ps|sxw|odt|doc|docx|xls|xlsx|rtf)$'"
|
||||
|
||||
alias pwgen="pwgen -B 10 14"
|
||||
alias http_serve="python -m SimpleHTTPServer 5001"
|
||||
|
||||
alias scp="BINARY_SSH=scp $HOME/bin/ssh"
|
||||
alias rsync="BINARY_SSH=rsync $HOME/bin/ssh"
|
||||
## DEVELOPMENT
|
||||
alias be='bundle exec'
|
||||
alias pe='pipenv run'
|
||||
alias dcp='docker-compose'
|
||||
alias preload_efence='LD_PRELOAD=libefence.so.0.0 '
|
||||
alias svnforget='svn st | egrep '\''^(\!|\?).*\.(cpp|cc|am|h|hh|hxx|tex|png)$'\'''
|
||||
|
||||
|
||||
## MULTIMEDIA
|
||||
alias photo_dl='sudo gphoto2 --auto-detect -P'
|
||||
alias rmplayer="mplayer -ao esd -nocache"
|
||||
alias timidity='timidity -Oe'
|
||||
alias music123='esddsp music123'
|
||||
alias speech='esddsp festival --tts'
|
||||
alias paria='aria2c -k 2M -x 10 -s 10'
|
||||
|
||||
|
||||
## HOSTING
|
||||
alias dokku='/usr/bin/ssh dokku@apps.glenux.net'
|
||||
alias ge="ghostwriter"
|
||||
|
||||
|
||||
## PRODUCTIVITY
|
||||
alias atodo='todo -G'
|
||||
alias tdg='todo -G'
|
||||
|
||||
alias makepatch='LC_ALL=C TZ=UTC0 diff -Naur '
|
||||
#alias cmake='colormake'
|
||||
alias gnux_bgfiles='find -exec du -sh "{}" \; | egrep [0-9]M | sort -n | tail -n 11 | head -n 10'
|
||||
alias gvimr='gvim --remote-tab'
|
||||
alias grep='grep --color'
|
||||
|
||||
## SERVERS SSH
|
||||
# pass 'noir'
|
||||
#alias ip='/sbin/ifconfig eth0 | grep adr | sed -e "s/^.*adr://" |sed -e "s/ Bcast.*//" '
|
||||
|
||||
alias pwgen="pwgen -s -n -B 24 30"
|
||||
alias http_serve='$( if hash python3 ; then echo python3 -m http.server 5001 ; else echo python2 -m SimpleHTTPServer 5001 ; fi )'
|
||||
|
||||
# alias scp="BINARY_SSH=scp $HOME/bin/ssh"
|
||||
# alias rsync="BINARY_SSH=rsync $HOME/bin/ssh"
|
||||
alias fuck='$(thefuck $(fc -ln -1))'
|
||||
alias baloostatus='balooctl status 2>/dev/null |grep Indexed |awk -v p=200 "{print int(p * \$2/\$4)/p; }"'
|
||||
|
||||
alias docker_ip="docker inspect -f '{{ .NetworkSettings.IPAddress}}'"
|
||||
|
||||
alias ctrlc='xclip -selection clipboard -i'
|
||||
alias ctrlv='xclip -selection clipboard -o'
|
||||
alias vimfm=vifm
|
||||
alias mkhash='head -c 1000 /dev/urandom |sha256sum |cut -c1-9'
|
||||
alias dotenv='eval "$(sed -e "/^[[:space:]]*$/d" -e "s/^/export /" < .env)"'
|
||||
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
|
||||
|
||||
alias proxy_nextformation_etoile='http_proxy=http://172.16.102.254:3128 https_proxy=http://172.16.102.254:3128 no_proxy=127.0.0.1,localhost'
|
||||
alias proxy_nextformation_firmingillot8='http_proxy=http://172.16.108.254:3128 https_proxy=http://172.16.108.254:3128 no_proxy=127.0.0.1,localhost'
|
||||
alias proxy_nextformation_firmingillot9='http_proxy=http://172.16.109.254:3128 https_proxy=http://172.16.109.254:3128 no_proxy=127.0.0.1,localhost'
|
||||
alias proxy_local8080='http_proxy=socks5://localhost:8080 https_proxy=socks5://localhost:8080'
|
||||
|
||||
alias diff_code='diff --color=always -Nur -x node_modules'
|
||||
alias mkemail='echo "$(date +"%Y").$(cat /dev/urandom | tr -dc "a-z0-9" | head -c 8)@glenux.net"'
|
||||
|
||||
|
||||
alias pouet="echo pouet"
|
||||
alias reddit=tuir
|
||||
alias ebook=epr
|
||||
|
||||
alias tt=timew
|
||||
alias ttd='timew day :week :id'
|
||||
alias tts='timew sum :week :id'
|
||||
alias xc-libreoffice="libreoffice \"-env:UserInstallation=file://$HOME/.config/libreoffice/4/xopetotec\""
|
||||
alias unlock_screen='kill -9 $(pgrep [k]screenlocker)'
|
||||
|
||||
alias unfmt="awk '{printf \"%s \",$0} /^$/{print \"\n\"} END{print \"\"}'"
|
||||
alias cast='go-chromecast --first'
|
||||
alias edit_goyo="EDITOR=goyo RAND_EDITOR=goyo"
|
||||
alias edit_ghostwriter="EDITOR=ghostwriter RAND_EDITOR=ghostwriter"
|
||||
alias khal_report="khal list 2021-06-01 2021-12-01 --format ' {start-time} .. {end-time} {title}'"
|
||||
alias vpn_stop="nmcli connect down \$(nmcli connect show --active |awk '/wireg/ {print \$1; }' )"
|
||||
alias vpn_start_rand="nmcli connect up \$(nmcli connect |awk '/wireg/ {print \$1; }' |shuf -n1)"
|
||||
alias vpn_status="nmcli connection show --active | awk '/wireguard/ { print \$1; }'"
|
||||
|
||||
|
|
|
@ -11,8 +11,13 @@
|
|||
if [ -d "$HOME/.bashrc.d" ]; then
|
||||
for script in $(find "$HOME/.bashrc.d/" -name '*.sh' |sort -n) ; do
|
||||
# echo "Loading `basename \"$script\"`..." # >&2
|
||||
. $script
|
||||
. "$script"
|
||||
done
|
||||
fi
|
||||
|
||||
case "$(hostname)" in
|
||||
dilong) export LIBVA_DRIVER_NAME=i965
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -8,3 +8,6 @@ if [ -d "$HOME/bin" ] ; then
|
|||
export PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
|
9
files/bashrc.d/00-winpty.sh
Normal file
9
files/bashrc.d/00-winpty.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
# HAS_WINPTY="${HAS_WINPTY:-}"
|
||||
# export HAS_WINPTY
|
||||
# # Force shell restart in case winpty is not set
|
||||
# if [ -z "$HAS_WINPTY" ]; then
|
||||
# HAS_WINPTY=1
|
||||
# exec winpty $SHELL
|
||||
# fi
|
||||
|
9
files/bashrc.d/50-dev-asdf.sh
Normal file
9
files/bashrc.d/50-dev-asdf.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
###
|
||||
# Set up Multi-language (asdf) environment
|
||||
#
|
||||
if [ -d "$HOME/.asdf" ] && [ -f "$HOME/.asdf/asdf.sh" ]; then
|
||||
. "$HOME/.asdf/asdf.sh"
|
||||
. "$HOME/.asdf/completions/asdf.bash"
|
||||
fi
|
|
@ -5,7 +5,8 @@
|
|||
#
|
||||
if hash opam > /dev/null 2>&1 ; then
|
||||
eval $(opam config env)
|
||||
|
||||
# OPAM configuration
|
||||
. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
|
||||
fi
|
||||
|
||||
# OPAM configuration
|
||||
#. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
|
||||
|
|
15
files/bashrc.d/55-dev-android.sh
Normal file
15
files/bashrc.d/55-dev-android.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
###
|
||||
# Set up Android environment
|
||||
#
|
||||
ANDROIDDIR="$HOME/src/Android"
|
||||
if [ -d "$ANDROIDDIR" ]; then
|
||||
export PATH=$ANDROIDDIR/Sdk/platform-tools:$ANDROIDDIR/Sdk/tools:$PATH
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/android-sdk-linux" ]; then
|
||||
export PATH="$HOME/android-sdk-linux/build-tools/19.1.0:$PATH"
|
||||
export PATH="$HOME/android-sdk-linux/tools:$PATH"
|
||||
export ANDROID_HOME="$HOME/android-sdk-linux/"
|
||||
fi
|
14
files/bashrc.d/55-dev-bash.sh
Normal file
14
files/bashrc.d/55-dev-bash.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
# Change tab behaviour
|
||||
# - inline completion (menu-complete)
|
||||
# - of simple suggestion (complete) => default
|
||||
|
||||
# bind TAB:menu-complete
|
||||
case "${-:-}" in
|
||||
*i*) # This shell is interactive
|
||||
bind TAB:complete
|
||||
;;
|
||||
*) # This shell is not interactive
|
||||
;;
|
||||
esac
|
||||
|
6
files/bashrc.d/55-dev-debian.sh
Normal file
6
files/bashrc.d/55-dev-debian.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
export DEBEMAIL="glenux@glenux.net"
|
||||
export DEBFULLNAME="Glenn Y. Rolland"
|
||||
export buildArea=$HOME/debian/build-area
|
||||
|
20
files/bashrc.d/55-dev-go.sh
Normal file
20
files/bashrc.d/55-dev-go.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
##
|
||||
# Set up Go environment
|
||||
#
|
||||
|
||||
if hash go > /dev/null 2>&1; then
|
||||
if [ -d "$HOME/bin" ]; then
|
||||
export GOPATH="$HOME/src/Go"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# For QT
|
||||
export CGO_CXXFLAGS_ALLOW=".*"
|
||||
export CGO_LDFLAGS_ALLOW=".*"
|
||||
export CGO_CFLAGS_ALLOW=".*"
|
||||
|
||||
export QT_DIR=/usr/lib/x86_64-linux-gnu/qt5
|
||||
export QT_PKG_CONFIG=true
|
||||
fi
|
||||
fi
|
11
files/bashrc.d/55-dev-opam.sh
Normal file
11
files/bashrc.d/55-dev-opam.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
##
|
||||
# Set up OCaml environment
|
||||
#
|
||||
#if hash opam > /dev/null 2>&1 ; then
|
||||
# eval $(opam config env)
|
||||
#fi
|
||||
|
||||
# OPAM configuration
|
||||
#. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
|
16
files/bashrc.d/55-dev-rbenv.sh
Normal file
16
files/bashrc.d/55-dev-rbenv.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
###
|
||||
# Set up Ruby environment
|
||||
#
|
||||
#export PATH=/var/lib/gems/1.8/bin:$PATH
|
||||
if [ -s "$HOME/.rbenv/bin/rbenv" ]; then
|
||||
export PATH="$HOME/.rbenv/bin:$PATH"
|
||||
eval "$(rbenv init -)"
|
||||
fi
|
||||
|
||||
|
||||
SONARPATH="/usr/local/sonar-scanner-3.3.0.1492-linux"
|
||||
if [ -d "$SONARPATH" ]; then
|
||||
export PATH="$PATH:$SONARPATH/bin"
|
||||
fi
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
# Disable ansible cowsay
|
||||
export ANSIBLE_NOCOWS=1
|
||||
if hash ansible > /dev/null 2>&1 ; then
|
||||
export ANSIBLE_NOCOWS=1
|
||||
fi
|
||||
|
||||
|
|
46
files/bashrc.d/70-util-asdf.sh
Normal file
46
files/bashrc.d/70-util-asdf.sh
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
# Install one or more versions of specified language
|
||||
# e.g. `vmi rust` # => fzf multimode, tab to mark, enter to install
|
||||
# if no plugin is supplied (e.g. `vmi<CR>`), fzf will list them for you
|
||||
# Mnemonic [V]ersion [M]anager [I]nstall
|
||||
asdf_install() {
|
||||
local lang="$1"
|
||||
local versions=""
|
||||
|
||||
if [ -z "$lang" ]; then
|
||||
lang=$(asdf plugin-list | fzf)
|
||||
fi
|
||||
|
||||
if [ -n "$lang" ]; then
|
||||
versions=$(asdf list-all "$lang" | fzf -m)
|
||||
if [ -n "$versions" ]; then
|
||||
for version in $versions; do
|
||||
asdf install "$lang" "$version"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Remove one or more versions of specified language
|
||||
# e.g. `vmi rust` # => fzf multimode, tab to mark, enter to remove
|
||||
# if no plugin is supplied (e.g. `vmi<CR>`), fzf will list them for you
|
||||
# Mnemonic [V]ersion [M]anager [C]lean
|
||||
asdf_clean() {
|
||||
local lang="$1"
|
||||
local versions=""
|
||||
|
||||
if [ -z "$lang" ]; then
|
||||
lang=$(asdf plugin-list | fzf)
|
||||
fi
|
||||
|
||||
if [ -n "$lang" ]; then
|
||||
versions="$(asdf list "$lang" | fzf -m)"
|
||||
if [ -n "$versions" ]; then
|
||||
for version in $versions; do
|
||||
asdf uninstall "$lang" "$version"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
. $HOME/.asdf/asdf.sh
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Help darcs on network mounts
|
||||
if hash darcs >/dev/null 2>&1 ; then
|
||||
export DARCS_SLOPPY_LOCKS=1
|
||||
if hash darcs > /dev/null 2>&1 ; then
|
||||
export DARCS_SLOPPY_LOCKS=1
|
||||
fi
|
||||
|
||||
|
|
41
files/bashrc.d/70-util-docker.sh
Normal file
41
files/bashrc.d/70-util-docker.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
WP_UID="${WP_UID:-"$(id -u)"}"
|
||||
WP_GID="${WP_GID:-"$(id -g)"}"
|
||||
|
||||
export WP_UID
|
||||
export WP_GID
|
||||
|
||||
docker_tags () {
|
||||
request="$1"
|
||||
repo="$(echo "$request" | awk '{split($0,a,"/"); print a[1];}')"
|
||||
name="$(echo "$request" | awk '{split($0,a,"/"); print a[2];}')"
|
||||
# >&2 echo "repo: $repo"
|
||||
# >&2 echo "name: $name"
|
||||
if [ -z "$name" ]; then
|
||||
# >&2 echo "Using 'library' as repository name"
|
||||
name="$repo"
|
||||
repo="library"
|
||||
fi
|
||||
>&2 echo "Looking for $repo/$name"
|
||||
|
||||
# Initial URL
|
||||
url="https://registry.hub.docker.com/v2/repositories/$repo/$name/tags/?page_size=100"
|
||||
(
|
||||
# Keep looping until the variable URL is empty
|
||||
while [ ! -z "$url" ]; do
|
||||
# >&2 echo "$url"
|
||||
# Every iteration of the loop prints out a single dot to show progress as it got through all the pages (this is inline dot)
|
||||
>&2 printf "."
|
||||
# Curl the URL and pipe the output to Python. Python will parse the JSON and print the very first line as the next URL (it will leave it blank if there are no more pages)
|
||||
# then continue to loop over the results extracting only the name; all will be stored in a variable called content
|
||||
content="$(curl -s "$url" | python -c 'import sys, json; data = json.load(sys.stdin); print(data.get("next", "") or ""); print("\n".join([x["name"] for x in data["results"]]))')"
|
||||
# Let's get the first line of content which contains the next URL for the loop to continue
|
||||
url="$(echo "$content" | head -n 1)"
|
||||
# Print the content without the first line (yes +2 is counter intuitive)
|
||||
echo "$content" | tail -n +2
|
||||
done;
|
||||
# Finally break the line of dots
|
||||
>&2 echo
|
||||
) | cut -d '-' -f 1 | sort --version-sort --unique;
|
||||
}
|
||||
|
|
@ -8,3 +8,6 @@ for pager in vim nano emacs ; do
|
|||
fi
|
||||
done
|
||||
|
||||
export EDITOR="vim"
|
||||
export MARKDOWN_DOC_EDITOR="ghostwriter"
|
||||
export MARKDOWN_SLIDES_EDITOR="Marp"
|
||||
|
|
5
files/bashrc.d/70-util-fzf.sh
Normal file
5
files/bashrc.d/70-util-fzf.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if hash fzf >/dev/null 2>&1 ; then
|
||||
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
|
||||
fi
|
||||
|
13
files/bashrc.d/70-util-git.sh
Normal file
13
files/bashrc.d/70-util-git.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Go forward in Git commit hierarchy, towards particular commit
|
||||
# Usage:
|
||||
# gofwd v1.2.7
|
||||
# Does nothing when the parameter is not specified.
|
||||
gitfwd() {
|
||||
git checkout "$(git rev-list --topo-order HEAD.."$*" | tail -1)"
|
||||
}
|
||||
|
||||
# Go back in Git commit hierarchy
|
||||
# Usage:
|
||||
# goback
|
||||
alias gitback='git checkout HEAD~'
|
||||
|
|
@ -5,5 +5,5 @@
|
|||
#export GREP_COLORS
|
||||
|
||||
# disable deprecated variable
|
||||
export GREP_OPTIONS=
|
||||
unset GREP_OPTIONS
|
||||
|
||||
|
|
9
files/bashrc.d/70-util-konsole.sh
Normal file
9
files/bashrc.d/70-util-konsole.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
KONSOLE_PROFILE_NAME=""
|
||||
if hash qdbus 2>&1 >/dev/null ; then
|
||||
if [ -n "$KONSOLE_DBUS_SERVICE" ] && [ -n "$KONSOLE_DBUS_SESSION" ]; then
|
||||
KONSOLE_PROFILE_NAME="$(qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION profile)"
|
||||
fi
|
||||
fi
|
||||
|
||||
export KONSOLE_PROFILE_NAME
|
2
files/bashrc.d/70-util-mail.sh
Normal file
2
files/bashrc.d/70-util-mail.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
export EMAIL=glenux@glenux.net
|
5
files/bashrc.d/70-util-moz-vpn.sh
Normal file
5
files/bashrc.d/70-util-moz-vpn.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
MOZ_TOKEN_FILE="$HOME/.config/mozilla-vpn/token"
|
||||
if [ -f "$MOZ_TOKEN_FILE" ]; then
|
||||
. "$MOZ_TOKEN_FILE"
|
||||
fi
|
7
files/bashrc.d/70-util-ncdu.sh
Normal file
7
files/bashrc.d/70-util-ncdu.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# NCDU
|
||||
if hash ncdu 2> /dev/null ; then
|
||||
export NCDU_SHELL=bash
|
||||
fi
|
||||
|
6
files/bashrc.d/70-util-travis.sh
Normal file
6
files/bashrc.d/70-util-travis.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
# added by travis gem
|
||||
if [ -f "$HOME/.travis/travis.sh" ]; then
|
||||
. "$HOME/.travis/travis.sh"
|
||||
fi
|
||||
|
5
files/bashrc.d/70-util-trello.sh
Normal file
5
files/bashrc.d/70-util-trello.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if [ -f "$HOME/.config/trello/glenux" ]; then
|
||||
. "$HOME/.config/trello/glenux"
|
||||
fi
|
||||
|
4
files/bashrc.d/70-util-vim.sh
Normal file
4
files/bashrc.d/70-util-vim.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
export VIM_NOTES_TEMPLATE="$HOME/.vim/templates/vim-notes"
|
||||
export VIM_NOTES_DIR="$HOME/Documents/GlenuxCloud/Notes"
|
||||
|
|
@ -7,13 +7,56 @@
|
|||
ps1_show() {
|
||||
local format=$1
|
||||
local fun=$2
|
||||
local str=$($fun)
|
||||
local str=""
|
||||
str=$($fun)
|
||||
|
||||
if [ ! -z "$str" ]; then
|
||||
printf "$format\n" "$str"
|
||||
fi
|
||||
}
|
||||
|
||||
ps1_timetracking() {
|
||||
local active_tracking=""
|
||||
local active_tags_count=""
|
||||
local active_tags=""
|
||||
local current_tag=""
|
||||
local bar_icon=""
|
||||
local dom_prefix=""
|
||||
# exit if timew is not installed
|
||||
if ! hash timew > /dev/null 2>&1 ; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# exit if no active tracking
|
||||
active_tracking="$(timew get dom.active)"
|
||||
if [ "$active_tracking" -eq 1 ]; then
|
||||
bar_icon="[▶]"
|
||||
dom_prefix="dom.active"
|
||||
else
|
||||
bar_icon="[■]"
|
||||
dom_prefix="dom.tracked.1"
|
||||
fi
|
||||
|
||||
active_tags_count="$(timew get "$dom_prefix.tag.count")"
|
||||
if [ "$active_tags_count" -gt 0 ]; then
|
||||
suffix=""
|
||||
active_tags=""
|
||||
if [ "$active_tags_count" -gt 1 ] && [ "$active_tracking" -eq 0 ]; then
|
||||
# Bug when accessing multiple tags on non-active tasks
|
||||
suffix="…"
|
||||
active_tags_count=1
|
||||
fi
|
||||
for tagidx in $(seq 1 "$active_tags_count") ; do
|
||||
current_tag="$(timew get "$dom_prefix.tag.$tagidx")"
|
||||
active_tags="$active_tags,$current_tag"
|
||||
done
|
||||
active_tags="$(echo "$active_tags" |cut -c2-)$suffix"
|
||||
else
|
||||
active_tags="(tag?)"
|
||||
fi
|
||||
echo "$bar_icon $active_tags "
|
||||
}
|
||||
|
||||
ps1_vcs_branch() {
|
||||
local vcs=""
|
||||
local vcs_branch=""
|
||||
|
@ -22,39 +65,53 @@ ps1_vcs_branch() {
|
|||
local vcs_root_url=""
|
||||
local vcs_branch_url=""
|
||||
|
||||
{
|
||||
if hash git && git rev-parse; then
|
||||
vcs='git'
|
||||
vcs_branch=$(git branch |sed -n "s/\* \(.*\)/\1/p")
|
||||
elif hash hg && hg -q status; then
|
||||
vcs='hg'
|
||||
if hash git > /dev/null 2>&1 && git rev-parse > /dev/null 2>&1; then
|
||||
vcs="git"
|
||||
vcs_branch=$(git symbolic-ref --short -q HEAD 2>/dev/null)
|
||||
vcs_branch=${vcs_branch:-(detached head)}
|
||||
elif hash hg > /dev/null 2>&1 && hg -q status > /dev/null 2>&1; then
|
||||
vcs="hg"
|
||||
vcs_branch=$(hg branch)
|
||||
elif hash svn && svn info; then
|
||||
vcs='svn'
|
||||
vcs_root_path=$(LANG=C LC_ALL=C svn info |sed -n 's/^Working Copy Root Path: //p')
|
||||
vcs_root_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n 's/^Repository Root: //p')
|
||||
vcs_branch_url=$(cd "$vcs_root" ; LANG=C LC_ALL=C svn info |sed -n 's/^URL: //p')
|
||||
elif hash svn > /dev/null 2>&1 && svn info > /dev/null 2>&1; then
|
||||
vcs="svn"
|
||||
# vcs_root_path=$(LANG=C LC_ALL=C svn info |sed -n "s/^Working Copy Root Path: //p")
|
||||
vcs_root_url=$(cd "$vcs_root" || return ; LANG=C LC_ALL=C svn info |sed -n "s/^Repository Root: //p")
|
||||
vcs_branch_url=$(cd "$vcs_root" || return ; LANG=C LC_ALL=C svn info |sed -n "s/^URL: //p")
|
||||
vcs_branch=$(echo "$vcs_branch_url" |sed "s#^$vcs_root_url/##")
|
||||
fi
|
||||
} >/dev/null 2>&1
|
||||
|
||||
if [ -z "$vcs" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo "$vcs:$vcs_branch"
|
||||
echo "$vcs $vcs_branch"
|
||||
fi
|
||||
}
|
||||
|
||||
#export PS1=" \t [#\#]\n[\u@\h \w]\\$ "
|
||||
#PS1='\[\033[1;32m\][\t|\d]\[\033[1;33m\][\u@\h] \[\033[0;36m\]\w\$\[\033[0m\]\n '
|
||||
PS1="${ps1_context:-}"
|
||||
PS1=$PS1"▪ \[\e[1;0m\]\w\[\e[0m\] "
|
||||
|
||||
PS1="$ps1_context ."
|
||||
PS1=$PS1": \[\e[1;33m\]\w\[\e[0m\] :"
|
||||
PS1=$PS1"\`ps1_show ': \[\e[1;34m\]%s\[\e[0m\] :' ps1_vcs_branch\`" # vcs branch
|
||||
PS1=$PS1": \[\e[0;32m\]\t\[\e[0m\] :"
|
||||
#PS1=$PS1": \[\e[1;34m\]#\#\[\e[0m\] :" #command count
|
||||
PS1=$PS1": \[\e[0;31m\]\u@\h " #username
|
||||
PS1=$PS1"("`uname -m`")\[\e[0m\] :" # architecture
|
||||
PS1=$PS1":.\n\$ "
|
||||
# Include VCS Info (eval at each line)
|
||||
# shellcheck disable=SC2089
|
||||
PS1=$PS1"\$(ps1_show '▪ \[\e[1;34m\]%s\[\e[0m\] ' ps1_vcs_branch)" # vcs branch
|
||||
|
||||
# Include DATETIME
|
||||
# PS1=$PS1"▪ \[\e[0;32m\]\t\[\e[0m\] "
|
||||
|
||||
# Include TIME TRACKING (timewarrior)
|
||||
PS1=$PS1"\$(ps1_show '▪ \[\e[1;32m\]%s\[\e[0m\] ' ps1_timetracking)" # timetracking
|
||||
|
||||
# Include command count
|
||||
# PS1=$PS1": \[\e[1;34m\]#\#\[\e[0m\] :"
|
||||
|
||||
# Include USERNAME
|
||||
PS1=$PS1"▪ \[\e[0;31m\]\u@\h "
|
||||
|
||||
# Include ARCHITECTURE (eval only once)
|
||||
PS1=$PS1"($(uname -m))\[\e[0m\] "
|
||||
PS1=$PS1"\n\$ "
|
||||
|
||||
# shellcheck disable=SC2090
|
||||
export PS1
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=10000
|
||||
|
||||
# don't put duplicate lines in the history. See bash(1) for more options
|
||||
export HISTCONTROL=ignoredups
|
||||
export HISTCONTROL=ignoredups:erasedups
|
||||
shopt -s histappend
|
||||
# Reload history on each command
|
||||
#PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||
|
||||
|
|
17
files/bashrc.d/99-completion-cht-sh.sh
Normal file
17
files/bashrc.d/99-completion-cht-sh.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
_cht_complete()
|
||||
{
|
||||
local cur prev opts
|
||||
_get_comp_words_by_ref -n : cur
|
||||
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="$(curl -s cheat.sh/:list)"
|
||||
|
||||
if [ ${COMP_CWORD} = 1 ]; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
__ltrim_colon_completions "$cur"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -F _cht_complete cht.sh
|
5
files/bashrc.d/99-completion-helm.sh
Normal file
5
files/bashrc.d/99-completion-helm.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if hash helm >/dev/null 2>&1 ; then
|
||||
eval "$(helm completion bash)"
|
||||
fi
|
||||
|
5
files/bashrc.d/99-completion-kind.sh
Normal file
5
files/bashrc.d/99-completion-kind.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if hash kind >/dev/null 2>&1 ; then
|
||||
eval "$(kind completion bash)"
|
||||
fi
|
||||
|
5
files/bashrc.d/99-completion-kompose.sh
Normal file
5
files/bashrc.d/99-completion-kompose.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if hash kompose >/dev/null 2>&1 ; then
|
||||
eval "$(kompose completion bash)"
|
||||
fi
|
||||
|
5
files/bashrc.d/99-completion-kubectl.sh
Normal file
5
files/bashrc.d/99-completion-kubectl.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
if hash kubectl >/dev/null 2>&1 ; then
|
||||
eval "$(kubectl completion bash)"
|
||||
fi
|
||||
|
19
files/bashrc.d/99-completion-rmplayer.sh
Normal file
19
files/bashrc.d/99-completion-rmplayer.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
# completion programmable sur les URLs qui vont bien
|
||||
|
||||
# mpv
|
||||
# complete -W " 'mms://vip7.yacast.fr/encoderouifm'
|
||||
# 'mms://vipbu.yacast.fr/encoderouifm'
|
||||
# 'mms://vip2.yacast.fr/encoderfun1'
|
||||
# 'mms://vipbu.yacast.fr/encoderfun'
|
||||
# 'mms://vip1.yacast.fr/encodernrj'
|
||||
# 'mms://vipbu.yacast.fr/encodernrj'
|
||||
# 'mms://vip1.yacast.fr/encodernostalgie'
|
||||
# " mpv
|
||||
#
|
||||
|
||||
_complete_mpv() {
|
||||
COMPREPLY=()
|
||||
}
|
||||
|
||||
complete -o default -o nospace -F _complete_mpv mpv
|
Loading…
Reference in a new issue