Ralf Beckesch 1 hafta önce
ebeveyn
işleme
558b468d9f

+ 9 - 0
dot_bashrc.d/app-specifics.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+bashrcd_dir=~/.bashrc.d
+app_specifics_dir=$bashrcd_dir/app_specifics
+
+for i in $app_specifics_dir/*sh; do
+    echo . $i
+done
+

+ 9 - 0
dot_bashrc.d/app_specifics/kubernetes.sh

@@ -0,0 +1,9 @@
+cmd=kubectl
+if [ -n "$(which $cmd)" ]; then
+	alias k='kubectl'
+	source <(kubectl completion bash)
+	complete -o default -F __start_kubectl k
+	alias kgp='kubectl get pods'
+	alias kc='kubectx'
+	alias kn='kubens'
+fi

+ 19 - 0
dot_bashrc.d/app_specifics/ssh-agent.sh

@@ -0,0 +1,19 @@
+
+#
+# Taken from Arch Wiki: https://wiki.archlinux.org/title/SSH_keys
+#
+# 	does it run for Debian/Ubuntu?
+#
+sshAgentEnv="$XDG_RUNTIME_DIR/ssh-agent.env"
+
+if [ ! -e "${sshAgentEnv}" ]; then
+	touch "${sshAgentEnv}"
+fi
+
+if ! pgrep -u "$USER" ssh-agent > /dev/null; then
+    ssh-agent -t 4h > "${sshAgentEnv}"
+fi
+if [ ! -f "$SSH_AUTH_SOCK" ]; then
+    source "${sshAgentEnv}" >/dev/null
+fi
+

+ 15 - 0
dot_bashrc.d/app_specifics/ssh-completion.sh

@@ -0,0 +1,15 @@
+
+# https://unix.stackexchange.com/questions/50054/bash-auto-completion-feature-for-sshing-into-different-hosts
+
+_ssh() 
+{
+    local cur prev opts
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+    opts=$(grep '^Host' ~/.ssh/config | awk '{print $2}')
+
+    COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
+    return 0
+}
+complete -F _ssh ssh

+ 4 - 0
dot_bashrc.d/arch-default-editor.sh

@@ -0,0 +1,4 @@
+EDITORCFG=/etc/profile.d/editor.sh
+if [ -f "$EDITORCFG" ]; then
+    . $EDITORCFG
+fi

+ 71 - 0
dot_bashrc.d/bash-setup-generic.sh

@@ -0,0 +1,71 @@
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+#!/bin/bash
+DEBUG=1
+[ -n "$DEBUG" ] && echo debug $0 >&2
+
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=10000
+HISTFILESIZE=50000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# make less more friendly for non-text input files, see lesspipe(1)
+#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+if [ -f ~/.bash_aliases ]; then
+    . ~/.bash_aliases
+fi
+
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if ! shopt -oq posix; then
+  if [ -f /usr/share/bash-completion/bash_completion ]; then
+    . /usr/share/bash-completion/bash_completion
+  elif [ -f /etc/bash_completion ]; then
+    . /etc/bash_completion
+  fi
+fi
+
+
+
+
+bashrcd_only="aaa bbb ccc"
+bashrcd_exlcude="ddd eee fff"
+
+for src in ~/.bashrc.d/*; do
+  if [ -e "$src" ]; then
+    echo . $src
+  fi
+done
+
+
+# Do something only on specific hosts
+
+only_at_home="ralf-21kscto1ww"
+if [ "$(hostname -f)" == "ralf-21kscto1ww" ]; then
+	export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock"
+fi
+
+
+
+

+ 3 - 0
dot_bashrc.d/chezmoi.sh

@@ -0,0 +1,3 @@
+if [ -n "$(which chezmoi)" ];then
+	source <(chezmoi completion bash)
+fi

+ 6 - 0
dot_bashrc.d/containerlab.sh

@@ -0,0 +1,6 @@
+cmd=containerlab
+if [ -n "$(which $cmd)" ];then
+	alias clab='containerlab'
+	source <(containerlab completion bash)
+	complete -o default -F __start_containerlab clab
+fi

+ 3 - 0
dot_bashrc.d/devpod.sh

@@ -0,0 +1,3 @@
+if [ -n "$(which devpod)" ]; then
+	source <(devpod completion bash)
+fi

+ 0 - 0
dot_bashrc.d/empty_agent-env


+ 0 - 0
dot_bashrc.d/host_specifics/.keep


+ 6 - 0
dot_bashrc.d/mybashrc.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+bashrc=~/bin/mybashrc
+
+if [ -e "$bashrc" ]; then
+	. $bashrc
+fi

+ 2 - 0
dot_bashrc.d/prompt-dirtrim.sh

@@ -0,0 +1,2 @@
+PROMPT_DIRTRIM=2
+

+ 3 - 0
dot_bashrc.d/randomstrings.sh

@@ -0,0 +1,3 @@
+# Random String
+alias randomstring="tr -dc A-Za-z0-9 </dev/urandom | head -c 64; echo"
+

+ 1 - 0
dot_bashrc.d/vi.sh

@@ -0,0 +1 @@
+alias vi='nvim'