diff --git a/files/bashrc.d/50-dev-asdf.sh b/files/bashrc.d/50-dev-asdf.sh new file mode 100644 index 0000000..0229c5c --- /dev/null +++ b/files/bashrc.d/50-dev-asdf.sh @@ -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 diff --git a/files/bashrc.d/50-dev-opam.sh b/files/bashrc.d/50-dev-opam.sh index a2cb195..39da4e7 100644 --- a/files/bashrc.d/50-dev-opam.sh +++ b/files/bashrc.d/50-dev-opam.sh @@ -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 diff --git a/files/bashrc.d/55-dev-android.sh b/files/bashrc.d/55-dev-android.sh new file mode 100644 index 0000000..b7bce87 --- /dev/null +++ b/files/bashrc.d/55-dev-android.sh @@ -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 diff --git a/files/bashrc.d/55-dev-bash.sh b/files/bashrc.d/55-dev-bash.sh new file mode 100644 index 0000000..dd0f614 --- /dev/null +++ b/files/bashrc.d/55-dev-bash.sh @@ -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 + diff --git a/files/bashrc.d/55-dev-debian.sh b/files/bashrc.d/55-dev-debian.sh new file mode 100644 index 0000000..ca88e00 --- /dev/null +++ b/files/bashrc.d/55-dev-debian.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +export DEBEMAIL="glenux@glenux.net" +export DEBFULLNAME="Glenn Y. Rolland" +export buildArea=$HOME/debian/build-area + diff --git a/files/bashrc.d/55-dev-go.sh b/files/bashrc.d/55-dev-go.sh new file mode 100644 index 0000000..92bea48 --- /dev/null +++ b/files/bashrc.d/55-dev-go.sh @@ -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 diff --git a/files/bashrc.d/55-dev-opam.sh b/files/bashrc.d/55-dev-opam.sh new file mode 100644 index 0000000..9079308 --- /dev/null +++ b/files/bashrc.d/55-dev-opam.sh @@ -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 diff --git a/files/bashrc.d/55-dev-rbenv.sh b/files/bashrc.d/55-dev-rbenv.sh new file mode 100644 index 0000000..a9f3175 --- /dev/null +++ b/files/bashrc.d/55-dev-rbenv.sh @@ -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 diff --git a/files/bashrc.d/70-util-asdf.sh b/files/bashrc.d/70-util-asdf.sh new file mode 100644 index 0000000..7a07b82 --- /dev/null +++ b/files/bashrc.d/70-util-asdf.sh @@ -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`), 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`), 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 diff --git a/files/bashrc.d/70-util-docker.sh b/files/bashrc.d/70-util-docker.sh new file mode 100644 index 0000000..08559da --- /dev/null +++ b/files/bashrc.d/70-util-docker.sh @@ -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; +} + diff --git a/files/bashrc.d/70-util-fzf.sh b/files/bashrc.d/70-util-fzf.sh new file mode 100644 index 0000000..9e56801 --- /dev/null +++ b/files/bashrc.d/70-util-fzf.sh @@ -0,0 +1,5 @@ + +if hash fzf >/dev/null 2>&1 ; then + export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' +fi + diff --git a/files/bashrc.d/70-util-git.sh b/files/bashrc.d/70-util-git.sh new file mode 100644 index 0000000..39201e5 --- /dev/null +++ b/files/bashrc.d/70-util-git.sh @@ -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~' + diff --git a/files/bashrc.d/70-util-konsole.sh b/files/bashrc.d/70-util-konsole.sh new file mode 100644 index 0000000..e49c1ae --- /dev/null +++ b/files/bashrc.d/70-util-konsole.sh @@ -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 diff --git a/files/bashrc.d/70-util-mail.sh b/files/bashrc.d/70-util-mail.sh new file mode 100644 index 0000000..0f9b8f5 --- /dev/null +++ b/files/bashrc.d/70-util-mail.sh @@ -0,0 +1,2 @@ + +export EMAIL=glenux@glenux.net diff --git a/files/bashrc.d/70-util-ncdu.sh b/files/bashrc.d/70-util-ncdu.sh new file mode 100644 index 0000000..95d6bb7 --- /dev/null +++ b/files/bashrc.d/70-util-ncdu.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# NCDU +if hash ncdu 2> /dev/null ; then + export NCDU_SHELL=bash +fi + diff --git a/files/bashrc.d/70-util-trello.sh b/files/bashrc.d/70-util-trello.sh new file mode 100644 index 0000000..cb169a7 --- /dev/null +++ b/files/bashrc.d/70-util-trello.sh @@ -0,0 +1,5 @@ + +export TRELLO_USER=glenux +export TRELLO_KEY=58117ebf843d49b05bca074c5fd520ee +export TRELLO_TOKEN=011311626e32209450bb05fafad4bd6c64f1f95355f2f853b919a4d7ff2c89cf + diff --git a/files/bashrc.d/70-util-vim.sh b/files/bashrc.d/70-util-vim.sh new file mode 100644 index 0000000..2339378 --- /dev/null +++ b/files/bashrc.d/70-util-vim.sh @@ -0,0 +1,4 @@ + +export VIM_NOTES_TEMPLATE="$HOME/.vim/templates/vim-notes" +export VIM_NOTES_DIR="$HOME/Documents/GlenuxCloud/Notes" + diff --git a/files/bashrc.d/99-completion-cht-sh.sh b/files/bashrc.d/99-completion-cht-sh.sh new file mode 100644 index 0000000..4a9ae4a --- /dev/null +++ b/files/bashrc.d/99-completion-cht-sh.sh @@ -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 diff --git a/files/bashrc.d/99-completion-helm.sh b/files/bashrc.d/99-completion-helm.sh new file mode 100644 index 0000000..c3384f0 --- /dev/null +++ b/files/bashrc.d/99-completion-helm.sh @@ -0,0 +1,5 @@ + +if hash helm >/dev/null 2>&1 ; then + eval "$(helm completion bash)" +fi + diff --git a/files/bashrc.d/99-completion-kind.sh b/files/bashrc.d/99-completion-kind.sh new file mode 100644 index 0000000..3d8021a --- /dev/null +++ b/files/bashrc.d/99-completion-kind.sh @@ -0,0 +1,5 @@ + +if hash kind >/dev/null 2>&1 ; then + eval "$(kind completion bash)" +fi + diff --git a/files/bashrc.d/99-completion-kompose.sh b/files/bashrc.d/99-completion-kompose.sh new file mode 100644 index 0000000..3baa347 --- /dev/null +++ b/files/bashrc.d/99-completion-kompose.sh @@ -0,0 +1,5 @@ + +if hash kompose >/dev/null 2>&1 ; then + eval "$(kompose completion bash)" +fi + diff --git a/files/bashrc.d/99-completion-kubectl.sh b/files/bashrc.d/99-completion-kubectl.sh new file mode 100644 index 0000000..7857d1a --- /dev/null +++ b/files/bashrc.d/99-completion-kubectl.sh @@ -0,0 +1,5 @@ + +if hash kubectl >/dev/null 2>&1 ; then + eval "$(kubectl completion bash)" +fi + diff --git a/files/bashrc.d/99-completion-rmplayer.sh b/files/bashrc.d/99-completion-rmplayer.sh new file mode 100644 index 0000000..eb31044 --- /dev/null +++ b/files/bashrc.d/99-completion-rmplayer.sh @@ -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