Add more config

This commit is contained in:
Glenn Y. Rolland 2021-12-31 13:03:38 +01:00
parent 80547553ad
commit eb14a6d8ec
23 changed files with 282 additions and 2 deletions

View 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

View file

@ -5,7 +5,8 @@
#
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
. /home/warbrain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
fi

View 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

View 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

View file

@ -0,0 +1,6 @@
#!/bin/sh
export DEBEMAIL="glenux@glenux.net"
export DEBFULLNAME="Glenn Y. Rolland"
export buildArea=$HOME/debian/build-area

View 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

View 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

View 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

View 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

View 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;
}

View file

@ -0,0 +1,5 @@
if hash fzf >/dev/null 2>&1 ; then
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
fi

View 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~'

View 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

View file

@ -0,0 +1,2 @@
export EMAIL=glenux@glenux.net

View file

@ -0,0 +1,7 @@
#!/bin/sh
# NCDU
if hash ncdu 2> /dev/null ; then
export NCDU_SHELL=bash
fi

View file

@ -0,0 +1,5 @@
export TRELLO_USER=glenux
export TRELLO_KEY=58117ebf843d49b05bca074c5fd520ee
export TRELLO_TOKEN=011311626e32209450bb05fafad4bd6c64f1f95355f2f853b919a4d7ff2c89cf

View file

@ -0,0 +1,4 @@
export VIM_NOTES_TEMPLATE="$HOME/.vim/templates/vim-notes"
export VIM_NOTES_DIR="$HOME/Documents/GlenuxCloud/Notes"

View 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

View file

@ -0,0 +1,5 @@
if hash helm >/dev/null 2>&1 ; then
eval "$(helm completion bash)"
fi

View file

@ -0,0 +1,5 @@
if hash kind >/dev/null 2>&1 ; then
eval "$(kind completion bash)"
fi

View file

@ -0,0 +1,5 @@
if hash kompose >/dev/null 2>&1 ; then
eval "$(kompose completion bash)"
fi

View file

@ -0,0 +1,5 @@
if hash kubectl >/dev/null 2>&1 ; then
eval "$(kubectl completion bash)"
fi

View 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