Merge branch 'dataport' of https://git.mgrote.net/mg/dotfiles into dataport
This commit is contained in:
commit
28ea93b9e5
41 changed files with 570 additions and 393 deletions
|
@ -25,8 +25,10 @@ alias gdel="git reset --hard ; git clean -f"
|
|||
alias glast="git log -1 HEAD --stat"
|
||||
alias gd="git difftool"
|
||||
alias gsp="git stage -p"
|
||||
alias gflog="git log -- "
|
||||
# docker
|
||||
alias dcu="docker-compose up"
|
||||
alias dlogs="docker-compose logs -f"
|
||||
alias dcd="docker-compose down"
|
||||
alias dcr="docker-compose down && docker-compose up -d"
|
||||
# safeguard
|
||||
|
|
|
@ -22,6 +22,9 @@ if [[ $- == *i* ]] ; then
|
|||
### keychain
|
||||
export GPG_TTY=$(tty)
|
||||
fi
|
||||
if [ "$(hostname -s)" == "lzeorpt001" ] ; then
|
||||
export EDITOR="/usr/bin/vim"
|
||||
fi
|
||||
### tmux auto attach
|
||||
if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
|
||||
tmux attach -t default || tmux new -s default
|
||||
|
|
160
.bash_functions
160
.bash_functions
|
@ -1,40 +1,4 @@
|
|||
### Funktionen
|
||||
function rgf {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Finde alle Dateien die "\$1" im Namen haben."
|
||||
echo ""
|
||||
echo " Usage: rgf <string>"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg --ignore-case --files --hidden --glob=!.git/ *"$1"*
|
||||
else
|
||||
echo "[INFO] ripgrep ist nicht installiert... suche mit 'find'"
|
||||
find . -type f -not -path '*/\.git/*' -name *"$1"*
|
||||
fi
|
||||
}
|
||||
function rgi {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
||||
echo ""
|
||||
echo " Usage: rgi <string>"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg --ignore-case --hidden --glob=!.git/ "$1"
|
||||
else
|
||||
echo "[INFO] ripgrep ist nicht installiert... suche mit 'grep'"
|
||||
grep --recursive --line-number --ignore-case --exclude-dir=".git" "$1" .
|
||||
fi
|
||||
}
|
||||
#!/bin/bash
|
||||
function ssh {
|
||||
# benennt das aktuelle tmux-windows nach dem ssh-ziel
|
||||
# baut ssh-verbindung auf
|
||||
|
@ -46,129 +10,7 @@ function ssh {
|
|||
tmux rename-window "$(hostname -f)"
|
||||
fi
|
||||
}
|
||||
function gcm {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Commit-Message fehlt, setze Default-Message..."
|
||||
git commit -s -m "changed Files: $(git diff --name-only --staged)"
|
||||
else
|
||||
# übergibt alle argumente an git commit -m als commit nachricht
|
||||
git commit -s -m "$*"
|
||||
fi
|
||||
}
|
||||
function gc {
|
||||
case "$1" in
|
||||
--help | -h)
|
||||
cat <<EOF
|
||||
|
||||
Description:
|
||||
"git checkout" on steroids
|
||||
|
||||
Usage:
|
||||
gc [--help|--new-branch] [branch]
|
||||
|
||||
Options:
|
||||
-h, --help Print this help.
|
||||
-b, --new-branch Create a new Branch instead changing to an existing branch.
|
||||
|
||||
Author:
|
||||
michael.grote@posteo.de - git.mgrote.net
|
||||
EOF
|
||||
;;
|
||||
--new-branch | -b)
|
||||
(git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ')
|
||||
;;
|
||||
*)
|
||||
if [ ! -z $1 ] ; then
|
||||
(echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!")
|
||||
else
|
||||
(git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') || (git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') || (git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release')
|
||||
fi
|
||||
esac
|
||||
}
|
||||
function glogs {
|
||||
# https://git-scm.com/docs/pretty-formats
|
||||
# https://stackoverflow.com/questions/3631005/git-log-tabular-formatting
|
||||
# https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue
|
||||
if [ -z "$1" ]; then
|
||||
ncommits=30;
|
||||
else
|
||||
ncommits="$1";
|
||||
fi;
|
||||
git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -$ncommits
|
||||
}
|
||||
function gp {
|
||||
git pull "$@"
|
||||
}
|
||||
function mdtoc {
|
||||
grep --recursive --include="*.md" ^# | sort --version-sort --field-separator=":" | awk 'BEGIN {FS=":"}{print $2 "&&" $1}' | column --table --separator "&&" --table-truncate 1,2
|
||||
}
|
||||
# "scrolle" durch die commit-history
|
||||
ghist() {
|
||||
local total_commits=$(git rev-list HEAD --count)
|
||||
local current_commit=$total_commits
|
||||
|
||||
show_commit_diff() {
|
||||
if [ $current_commit -le $total_commits ] && [ $current_commit -ge 1 ]; then
|
||||
local commit_hash=$(git rev-list --reverse HEAD | sed -n "${current_commit}p")
|
||||
git --no-pager show $commit_hash
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear # Clear the terminal
|
||||
show_commit_diff
|
||||
|
||||
# Display navigation options
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "Navigation: N - Next Commit, P - Previous Commit, Q - Quit"
|
||||
echo "-----------------------------------------------------------"
|
||||
read -n1 -s option
|
||||
|
||||
case $option in
|
||||
p|P)
|
||||
if [ $current_commit -gt 1 ]; then
|
||||
((current_commit--))
|
||||
fi
|
||||
;;
|
||||
n|N)
|
||||
if [ $current_commit -lt $total_commits ]; then
|
||||
((current_commit++))
|
||||
fi
|
||||
;;
|
||||
q|Q)
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function sar {
|
||||
case "$1" in
|
||||
--help | -h)
|
||||
cat <<EOF
|
||||
Description:
|
||||
Search and replace recursively.
|
||||
|
||||
Usage:
|
||||
sar [--help] <search> <replace>
|
||||
|
||||
Options:
|
||||
-h, --help Print this help.
|
||||
|
||||
Author:
|
||||
michael.grote@posteo.de - git.mgrote.net
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
if [ "$1" != "-h" ] && [ "$1" != "--help" ] ; then
|
||||
if [ $# = 2 ] ; then
|
||||
find . -name '*' -type f -not -path '*/\.git/*' -exec sed -i "s/$1/$2/" {} \;
|
||||
elif [ $# = 1 ] ; then
|
||||
echo ">>> Not enough arguments..."
|
||||
elif [ $# -gt 2 ] ; then
|
||||
echo ">>> Too many arguments..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ wsErrorHighlight = all
|
|||
[fetch]
|
||||
prune = true
|
||||
[safe]
|
||||
directory = ~/dotfiles
|
||||
directory = *
|
||||
[advice]
|
||||
addIgnoredFile = true
|
||||
addEmptyPathspec = false
|
||||
|
|
83
.tmux.conf
83
.tmux.conf
|
@ -1,37 +1,62 @@
|
|||
set-option -g set-titles on # Automatically set window title
|
||||
set-option -g status-position top # position the status bar at top of screen
|
||||
set-option -g monitor-activity off # Deaktiviere "Markierung" aktiver Fenster
|
||||
set-option -g renumber-windows on # Automatische Neu-Nummerierung der Fenster aktivieren; Beispielsweise nach dem Schließen eines Fensters
|
||||
set-option -g base-index 1 # Nummerierung der Fenster und Teilfenster jeweils mit 1 beginnen
|
||||
set -g pane-base-index 1 # Nummerierung der Fenster und Teilfenster jeweils mit 1 beginnen
|
||||
set-option -g status-right "#(hostname -f)" # Statuszeile - rechts
|
||||
# Automatically set window title
|
||||
set-window-option -g automatic-rename on
|
||||
set-option -g set-titles on
|
||||
|
||||
# position the status bar at top of screen
|
||||
set-option -g status-position top
|
||||
|
||||
# Deaktiviere "Markierung" aktiver Fenster
|
||||
set-option -g monitor-activity off
|
||||
|
||||
# Automatische Neu-Nummerierung der Fenster aktivieren; Beispielsweise nach dem Schließen eines Fensters
|
||||
set-option -g renumber-windows on
|
||||
|
||||
# Nummerierung der Fenster und Teilfenster jeweils mit 1 beginnen
|
||||
set-window-option -g pane-base-index 1
|
||||
set-option -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
|
||||
# Statuszeile
|
||||
set-option -g status-right "#(hostname -f)"
|
||||
set -g status-right-length 100
|
||||
|
||||
# resize
|
||||
set-option -gw aggressive-resize on
|
||||
set -g default-terminal screen-256color # Farb-Optionen für Shell-Fenster
|
||||
set -g history-limit 50000 # increase scrollback buffer size
|
||||
set -g mouse on # Maus-Unterstützung aktivieren
|
||||
set-window-option -g clock-mode-style 24 # Uhrzeit auf 24h Format
|
||||
set-window-option -g pane-base-index 1 # Nummerierung der Fenster und Teilfenster jeweils mit 1 beginnen:
|
||||
set-window-option -g automatic-rename on # Automatically set window title
|
||||
|
||||
#------------ Buttons ------------#
|
||||
bind k select-pane -U # Wechsle Fenster mit vim keybindings
|
||||
bind j select-pane -D # Wechsle Fenster mit vim keybindings
|
||||
bind h select-pane -L # Wechsle Fenster mit vim keybindings
|
||||
bind l select-pane -R # Wechsle Fenster mit vim keybindings
|
||||
unbind '"' # alte Tastenkombination deaktivieren
|
||||
unbind % # alte Tastenkombination deaktivieren
|
||||
bind | split-window -h # Vertikal splitten
|
||||
bind - split-window -v # Horizontal splitten
|
||||
# Farb-Optionen für Shell-Fenster
|
||||
set -g default-terminal screen-256color
|
||||
|
||||
set -s escape-time 0 # address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||||
set -g display-time 4000 # tmux messages are displayed for 4 seconds
|
||||
# increase scrollback buffer size
|
||||
set -g history-limit 50000
|
||||
|
||||
# schließe windows mit prefix + w
|
||||
bind w killw
|
||||
# öffne windows mit prefix + t
|
||||
bind t new-window
|
||||
# gehe in copy mode und starte suche
|
||||
# Maus-Unterstützung aktivieren
|
||||
set -g mouse on
|
||||
|
||||
# Wechsle Fenster mit vim keybindings
|
||||
bind k select-pane -U
|
||||
bind j select-pane -D
|
||||
bind h select-pane -L
|
||||
bind l select-pane -R
|
||||
|
||||
# display more of the session name
|
||||
set -g status-left-length 20
|
||||
|
||||
# Splits
|
||||
unbind '"'
|
||||
unbind %
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
|
||||
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||||
set -s escape-time 0
|
||||
|
||||
# tmux messages are displayed for 4 seconds
|
||||
set -g display-time 4000
|
||||
|
||||
# gehe in copy mode und starte suche
|
||||
# prefix + f
|
||||
set-window-option -g mode-keys vi
|
||||
bind f copy-mode\; send-keys ?
|
||||
|
||||
# Focus events enabled for terminals that support them
|
||||
set -g focus-events on
|
||||
|
|
25
.vimrc
25
.vimrc
|
@ -244,10 +244,6 @@ function! ToggleNERDTreeFind()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" yaml einrückung
|
||||
autocmd FileType yaml setlocal ai ts=2 sw=2 et
|
||||
autocmd FileType yml setlocal ai ts=2 sw=2 et
|
||||
|
||||
" timeouts
|
||||
set timeoutlen=100
|
||||
|
||||
|
@ -255,3 +251,24 @@ set timeoutlen=100
|
|||
if &diff
|
||||
colorscheme nord
|
||||
endif
|
||||
|
||||
augroup spell
|
||||
autocmd!
|
||||
autocmd FileType * highlight SpellBad cterm=underline ctermfg=red ctermbg=NONE
|
||||
if $HOSTNAME == "lbdlspa001"
|
||||
autocmd FileType * set spellfile=~/repos/dotfiles/vim/spell/own.add
|
||||
elseif $HOSTNAME == "lzeorpt001"
|
||||
autocmd FileType * set spellfile=/homes/MGMT/grotemi-admin/repos/dotfiles/vim/spell/own.add
|
||||
endif
|
||||
autocmd FileType * set spellsuggest=fast,10
|
||||
autocmd FileType * set spell spelllang=de_de,en
|
||||
augroup END
|
||||
" z= Korrektur
|
||||
" ]s/[s gehe vor/zurück nächsten fehlerhaften wort
|
||||
" zg add to dictionary
|
||||
|
||||
augroup yaml
|
||||
autocmd!
|
||||
autocmd FileType yml setlocal ai ts=2 sw=2 et
|
||||
autocmd FileType yaml,yml setlocal ai ts=2 sw=2 et
|
||||
augroup END
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# i3-get-window-criteria - Get criteria for use with i3 config commands
|
||||
# https://faq.i3wm.org/question/2172/how-do-i-find-the-criteria-for-use-with-i3-config-commands-like-for_window-eg-to-force-splashscreens-and-dialogs-to-show-in-floating-mode.1.html
|
||||
# To use, run this script, then click on a window.
|
||||
# Output is in the format: [<name>=<value> <name>=<value> ...]
|
||||
|
||||
# Known problem: when WM_NAME is used as fallback for the 'title="<string>"' criterion,
|
||||
# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
|
||||
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807
|
||||
|
||||
PROGNAME=`basename "$0"`
|
||||
|
||||
# Check for xwininfo and xprop
|
||||
for cmd in xwininfo xprop; do
|
||||
if ! which $cmd > /dev/null 2>&1; then
|
||||
echo "$PROGNAME: $cmd: command not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
match_int='[0-9][0-9]*'
|
||||
match_string='".*"'
|
||||
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference
|
||||
|
||||
{
|
||||
# Run xwininfo, get window id
|
||||
window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
|
||||
echo "id=$window_id"
|
||||
|
||||
# Run xprop, transform its output into i3 criteria. Handle fallback to
|
||||
# WM_NAME when _NET_WM_NAME isn't set
|
||||
xprop -id $window_id |
|
||||
sed -nr \
|
||||
-e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
|
||||
-e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
|
||||
-e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
|
||||
-e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
|
||||
-e '${g; p}'
|
||||
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'
|
1
scripts/gc
Symbolic link
1
scripts/gc
Symbolic link
|
@ -0,0 +1 @@
|
|||
git_checkout
|
1
scripts/gcm
Symbolic link
1
scripts/gcm
Symbolic link
|
@ -0,0 +1 @@
|
|||
git_commit
|
1
scripts/ghist
Symbolic link
1
scripts/ghist
Symbolic link
|
@ -0,0 +1 @@
|
|||
git_history
|
28
scripts/git_checkout
Executable file
28
scripts/git_checkout
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
case "$1" in
|
||||
--help | -h)
|
||||
cat <<EOF
|
||||
|
||||
Description:
|
||||
"git checkout" on steroids
|
||||
|
||||
Usage:
|
||||
gc [--help|--new-branch] [branch]
|
||||
|
||||
Options:
|
||||
-h, --help Print this help.
|
||||
-b, --new-branch Create a new Branch instead changing to an existing branch.
|
||||
|
||||
Author:
|
||||
michael.grote@posteo.de - git.mgrote.net
|
||||
EOF
|
||||
;;
|
||||
--new-branch | -b)
|
||||
(git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ')
|
||||
;;
|
||||
*)
|
||||
if [ -n "$1" ] ; then (echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch! ")
|
||||
else
|
||||
(git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') || (git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') || (git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release')
|
||||
fi
|
||||
esac
|
8
scripts/git_commit
Executable file
8
scripts/git_commit
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
if [ -z "$1" ]; then
|
||||
echo "Commit-Message fehlt, setze Default-Message..."
|
||||
git commit -s -m "changed Files: $(git diff --name-only --staged)"
|
||||
else
|
||||
# übergibt alle argumente an git commit -m als commit nachricht
|
||||
git commit -s -m "$*"
|
||||
fi
|
|
@ -1,2 +1,3 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2063
|
||||
git branch | grep -v "*" | grep -v master | grep -v main | xargs git branch -D ; git fetch --prune
|
42
scripts/git_history
Executable file
42
scripts/git_history
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
total_commits=$(git rev-list HEAD --count)
|
||||
current_commit=$total_commits
|
||||
|
||||
show_commit_diff() {
|
||||
if [ "$current_commit" -le "$total_commits" ] && [ "$current_commit" -ge 1 ]; then
|
||||
commit_hash=$(git rev-list --reverse HEAD | sed -n "${current_commit}p")
|
||||
git --no-pager show "$commit_hash"
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
clear # Clear the terminal
|
||||
show_commit_diff
|
||||
|
||||
# Display navigation options
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "Navigation: N - Next Commit, P - Previous Commit, Q - Quit"
|
||||
echo "-----------------------------------------------------------"
|
||||
read -r -n1 -s option
|
||||
|
||||
case $option in
|
||||
p|P)
|
||||
# shellcheck disable=2086
|
||||
if [ $current_commit -gt 1 ]; then
|
||||
((current_commit--))
|
||||
fi
|
||||
;;
|
||||
n|N)
|
||||
# shellcheck disable=2086
|
||||
if [ $current_commit -lt $total_commits ]; then
|
||||
((current_commit++))
|
||||
fi
|
||||
;;
|
||||
q|Q)
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option"
|
||||
;;
|
||||
esac
|
||||
done
|
10
scripts/git_logs
Executable file
10
scripts/git_logs
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
# https://git-scm.com/docs/pretty-formats
|
||||
# https://stackoverflow.com/questions/3631005/git-log-tabular-formatting
|
||||
# https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue
|
||||
if [ -z "$1" ]; then
|
||||
ncommits=30;
|
||||
else
|
||||
ncommits="$1";
|
||||
fi;
|
||||
git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -"$ncommits"
|
|
@ -13,14 +13,15 @@ function update {
|
|||
if [ -e "$d/.ignore" ]; then
|
||||
echo -e "\n${HIGHLIGHT}Ignoring $d${NORMAL}"
|
||||
else
|
||||
cd $d > /dev/null
|
||||
cd "$d" || exit > /dev/null
|
||||
if [ -d ".git" ]; then
|
||||
echo -e "\n${HIGHLIGHT}Updating pwd$NORMAL"
|
||||
echo $PWD
|
||||
git add .
|
||||
git stash
|
||||
git pull
|
||||
else
|
||||
scan *
|
||||
scan -- *
|
||||
fi
|
||||
cd .. > /dev/null
|
||||
fi
|
||||
|
@ -30,12 +31,12 @@ function update {
|
|||
|
||||
function scan {
|
||||
#echo "pwd"
|
||||
for x in $*; do
|
||||
for x in "$@"; do
|
||||
update "$x"
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$1" != "" ]; then cd $1 > /dev/null; fi
|
||||
if [ "$1" != "" ]; then cd "$1" || exit > /dev/null; fi
|
||||
|
||||
echo -e "${HIGHLIGHT}Scanning ${PWD}${NORMAL}"
|
||||
scan *
|
||||
scan -- *
|
1
scripts/glogs
Symbolic link
1
scripts/glogs
Symbolic link
|
@ -0,0 +1 @@
|
|||
git_logs
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Function to ask for confirmation
|
||||
ask_confirmation() {
|
||||
read -rp "Are you sure you want to proceed? (y/n): " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
return 0 ;; # Proceed
|
||||
*)
|
||||
return 1 ;; # Cancel
|
||||
esac
|
||||
}
|
||||
|
||||
if ask_confirmation; then
|
||||
echo "Proceeding..."
|
||||
echo "docker system prune"
|
||||
docker system prune -a
|
||||
echo "Entferne inaktive Container"
|
||||
docker container prune
|
||||
echo "Entferne ungenutzte Images"
|
||||
docker image prune
|
||||
echo "Entferne inaktive Volumes"
|
||||
docker volume prune
|
||||
echo "Entferne inaktive Netzwerke"
|
||||
docker network prune | docker images -q | xargs docker rmi
|
||||
else
|
||||
echo "Cancelled."
|
||||
fi
|
|
@ -1,80 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
function lock {
|
||||
# Take a screenshot
|
||||
scrot /tmp/screen_locked.png
|
||||
# Pixellate it 10x
|
||||
mogrify -scale 10% -scale 1000% /tmp/screen_locked.png
|
||||
# Lock screen displaying this image.
|
||||
i3lock -i /tmp/screen_locked.png
|
||||
# delete Image
|
||||
rm -f /tmp/screen_locked.png
|
||||
}
|
||||
function reboot {
|
||||
sudo systemctl reboot
|
||||
}
|
||||
function shutdown {
|
||||
sudo systemctl poweroff
|
||||
}
|
||||
function suspend {
|
||||
lock
|
||||
sudo systemctl suspend
|
||||
}
|
||||
function hibernate {
|
||||
lock
|
||||
sudo systemctl hibernate
|
||||
}
|
||||
function help {
|
||||
echo "
|
||||
Usage:
|
||||
./pwr.sh [-r|-s|-sd|-hb]
|
||||
|
||||
Arguments:
|
||||
-r, --reboot Reboot this system.
|
||||
-s, --shutdown Shutdown this system.
|
||||
-sd, --suspend Suspends this system.
|
||||
-hb, --hibernate Hibernates this system.
|
||||
-h, --help Displays this help.
|
||||
"
|
||||
}
|
||||
function display_off {
|
||||
# Turn the screen off
|
||||
xset dpms force off
|
||||
}
|
||||
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
case "$1" in
|
||||
--reboot | -r)
|
||||
dunstify -u critical "reboot"
|
||||
sleep 3
|
||||
reboot
|
||||
;;
|
||||
--shutdown | -s)
|
||||
dunstify -u critical "shutdown"
|
||||
sleep 3
|
||||
shutdown
|
||||
;;
|
||||
--suspend | -sd)
|
||||
dunstify -u critical "suspend"
|
||||
sleep 3
|
||||
suspend
|
||||
;;
|
||||
--hibernate | -hb)
|
||||
dunstify -u critical "hibernate"
|
||||
sleep 3
|
||||
hibernate
|
||||
;;
|
||||
--help | -h)
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo -e "\e[31mUnbekannter Parameter!"
|
||||
exit 1
|
||||
esac
|
||||
else
|
||||
lock
|
||||
sleep 60
|
||||
display_off
|
||||
fi
|
1
scripts/rgi
Symbolic link
1
scripts/rgi
Symbolic link
|
@ -0,0 +1 @@
|
|||
ripgrep_inline
|
18
scripts/ripgrep_inline
Executable file
18
scripts/ripgrep_inline
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
# shellcheck disable=SC2140
|
||||
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
||||
echo ""
|
||||
echo " Usage: rgi <string>"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg --ignore-case --hidden --glob=!.git/ "$1"
|
||||
else
|
||||
echo "[INFO] ripgrep ist nicht installiert... suche mit 'grep'"
|
||||
grep --recursive --line-number --ignore-case --exclude-dir=".git" "$1" .
|
||||
fi
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
tmpfile=$(mktemp)
|
||||
cat << EOF
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: NAME_DES_SECRETS
|
||||
namespace: drone
|
||||
stringData:
|
||||
ICH_BIN_DER VARIABLEN_NAME: ICH_BIN_DAS_PASSWORT
|
||||
EOF > $tmpfile
|
||||
|
||||
vim $tmpfile
|
||||
|
||||
cat $tmpfile | kubeseal --controller-namespace kube-system --format yaml > ./sealed-secret.yaml
|
||||
|
||||
cat sealed-secret.yaml
|
||||
rm $tmpfile ./sealed-secret.yaml
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [[ "$#" -eq 2 ]]; then
|
||||
kubectl get secret $1 -n $2 -o jsonpath="{.data.<key>}" | base64 --decode ; echo""
|
||||
else
|
||||
echo "Missing:
|
||||
\$1 = secretname
|
||||
\$2 = namespace"
|
||||
fi
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo ">>> write key to ./main.key"
|
||||
kubectl get secret -n kube-system -l sealedsecrets.bitnami.com/sealed-secrets-key -o yaml > main.key
|
||||
|
||||
# https://github.com/bitnami-labs/sealed-secrets#how-can-i-do-a-backup-of-my-sealedsecrets
|
||||
# restore with:
|
||||
# kubectl apply -f main.key
|
||||
# kubectl delete pod -n kube-system -l name=sealed-secrets-controller
|
79
scripts/search_and_replace
Executable file
79
scripts/search_and_replace
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
|
||||
function rename_directories {
|
||||
find . -type d -not -path '*/\.git/*' -execdir rename "$SEARCH" "$REPLACE" {} \; > /dev/null 2>&1
|
||||
}
|
||||
|
||||
function rename_files {
|
||||
find . -name '*' -type f -not -path '*/\.git/*' -exec rename "$SEARCH" "$REPLACE" {} \;
|
||||
}
|
||||
|
||||
function rename_inline {
|
||||
find . -name '*' -type f -not -path '*/\.git/*' -exec sed -i "s/${SEARCH}/${REPLACE}/g" {} \;
|
||||
}
|
||||
|
||||
# das erste Argument der Funktion ist die Anzahl der Argumente des aufrufenden Scripts
|
||||
# das zweite Argument ist die erwünschte Anzahl an Argumenten
|
||||
function check_argument_count {
|
||||
if [ "$1" -lt "$2" ] ; then
|
||||
echo ">>> Not enough arguments..."
|
||||
exit 1
|
||||
elif [ "$1" -gt "$2" ] ; then
|
||||
echo ">>> Too many arguments..."
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
function print_help {
|
||||
cat <<EOF
|
||||
|
||||
Description:
|
||||
Search and replace recursively.
|
||||
|
||||
Usage:
|
||||
sr [-h|-d|-i|-f] <search> <replace>
|
||||
|
||||
Options:
|
||||
-d Rename only directories.
|
||||
-f Rename only files.
|
||||
-i Rename only in files.
|
||||
-h Print this help.
|
||||
|
||||
Author:
|
||||
michael.grote@posteo.de - git.mgrote.net
|
||||
EOF
|
||||
}
|
||||
|
||||
SEARCH="$2"
|
||||
REPLACE="$3"
|
||||
|
||||
case "$1" in
|
||||
-f)
|
||||
check_argument_count "$#" "3"
|
||||
rename_files
|
||||
;;
|
||||
-i)
|
||||
check_argument_count "$#" "3"
|
||||
rename_inline
|
||||
;;
|
||||
-d)
|
||||
check_argument_count "$#" "3"
|
||||
rename_directories > /dev/null 2>&1
|
||||
;;
|
||||
-h)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
# ohne Parameter wird alles gemacht
|
||||
*)
|
||||
check_argument_count "$#" "2"
|
||||
SEARCH=$1
|
||||
REPLACE=$2
|
||||
echo ">>> Rename files..."
|
||||
rename_files
|
||||
echo ">>> Rename directories..."
|
||||
rename_directories > /dev/null 2>&1
|
||||
echo ">>> Rename inline..."
|
||||
rename_inline
|
||||
;;
|
||||
esac
|
|
@ -2,7 +2,7 @@
|
|||
# Aufruf: wget https://git.mgrote.net/mg/dotfiles/raw/branch/master/scripts/setup_minimal.sh && bash ./setup_minimal.sh
|
||||
cd ~
|
||||
|
||||
sudo apt update && sudo apt install git tmux vim ripgrep ca-certificates
|
||||
sudo apt update && sudo apt install git tmux vim ripgrep ca-certificates curl wget tree keychain
|
||||
|
||||
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
||||
git clone https://git.mgrote.net/mg/dotfiles ~/dotfiles
|
||||
|
@ -10,6 +10,8 @@ git clone https://git.mgrote.net/mg/dotfiles ~/dotfiles
|
|||
ln -s ~/dotfiles/.tmux.conf ~/.tmux.conf
|
||||
ln -s ~/dotfiles/.vimrc ~/.vimrc
|
||||
|
||||
ln -s ~/dotfiles/vim/spell/ ~/.vim/
|
||||
|
||||
echo "source ~/dotfiles/.bash_extra" >> ~/.bashrc
|
||||
|
||||
vim +PluginInstall +qall
|
||||
|
|
1
scripts/sr
Symbolic link
1
scripts/sr
Symbolic link
|
@ -0,0 +1 @@
|
|||
search_and_replace
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
if ! pgrep -x "alacritty" > /dev/null
|
||||
then
|
||||
# wechsle zu workspace 1 und starte alacritty
|
||||
i3-msg 'workspace 1; exec --no-startup-id /usr/local/bin/alacritty'
|
||||
else
|
||||
# wenn alacritty schon läuft wechsle nur zu workspace 1
|
||||
dunstify -u low "alacritty is already running"
|
||||
i3-msg 'workspace 1'
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
rofi -combi-modi window,drun -show combi
|
4
scripts/sync_dotfiles_dp.sh
Executable file
4
scripts/sync_dotfiles_dp.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
if [ "$HOSTNAME" = lbdlspa001 ]; then
|
||||
rsync -av --delete -e ssh /home/.autofs/lunixpf001/home-linux/grotemi-admin/repos/dotfiles/ lzeorpt001.mgmt.dpaor.org:/homes/MGMT/grotemi-admin/repos/dotfiles
|
||||
fi
|
0
scripts/zfs_release_duplicate_holds.sh → scripts/zfs_release_duplicate_holds
Normal file → Executable file
0
scripts/zfs_release_duplicate_holds.sh → scripts/zfs_release_duplicate_holds
Normal file → Executable file
BIN
vim/spell/de.utf-8.spl
Normal file
BIN
vim/spell/de.utf-8.spl
Normal file
Binary file not shown.
BIN
vim/spell/de.utf-8.sug
Normal file
BIN
vim/spell/de.utf-8.sug
Normal file
Binary file not shown.
BIN
vim/spell/en.utf-8.spl
Normal file
BIN
vim/spell/en.utf-8.spl
Normal file
Binary file not shown.
BIN
vim/spell/en.utf-8.sug
Normal file
BIN
vim/spell/en.utf-8.sug
Normal file
Binary file not shown.
283
vim/spell/own.add
Normal file
283
vim/spell/own.add
Normal file
|
@ -0,0 +1,283 @@
|
|||
dotfiles
|
||||
Ansible
|
||||
LVM
|
||||
PV
|
||||
LV
|
||||
YAML
|
||||
Orchestrierungs
|
||||
Konfigmanagementools
|
||||
Patchmanagement
|
||||
TDC
|
||||
Konfigmanagment
|
||||
Ausbildungscloud
|
||||
TOML
|
||||
yaml
|
||||
lvm
|
||||
ansible
|
||||
Shellcheck
|
||||
committen
|
||||
gitlab
|
||||
dataport
|
||||
linux
|
||||
Gruppenkeepass
|
||||
ARTIFACTORY
|
||||
Tokenname
|
||||
Paketrepository
|
||||
Installierbarkeit
|
||||
Skripte
|
||||
Artifactory
|
||||
Paketrepo
|
||||
config
|
||||
forken
|
||||
PRs
|
||||
ci
|
||||
Baseimage
|
||||
buildcontainer
|
||||
yml
|
||||
Hauptbranch
|
||||
shellcheck
|
||||
gitleaks
|
||||
StackOverflow
|
||||
yamllint
|
||||
gepushed
|
||||
tl
|
||||
dr
|
||||
Monorepository
|
||||
Grote
|
||||
Paketrepos
|
||||
comitted
|
||||
gemerged
|
||||
Mitgeltende
|
||||
Protokollierungskonzeptes
|
||||
fachbereichsbezogenen
|
||||
BHB
|
||||
BD
|
||||
Basisinfrastrukturdienst
|
||||
Multiverfahrensdienst
|
||||
MVD
|
||||
RZ
|
||||
Protokollierungskonzept
|
||||
Mandantenkonzept
|
||||
TST
|
||||
LDN
|
||||
zzeor
|
||||
d001
|
||||
PSQL
|
||||
TZ4
|
||||
RHEL9
|
||||
QS
|
||||
awx
|
||||
keycloak
|
||||
RDP
|
||||
Kubernetes
|
||||
Webhook
|
||||
FluxCD
|
||||
Quellrepository
|
||||
OCI
|
||||
Containerregistry
|
||||
SHA256
|
||||
Checksummen
|
||||
SSO
|
||||
ZEOR
|
||||
Loadbalancer
|
||||
Fileservice
|
||||
artifactory
|
||||
CMDB
|
||||
OCP
|
||||
Releasemanagementkonzept
|
||||
Patchmanagementkonzept
|
||||
lzeor
|
||||
Patchfenster
|
||||
zLinux
|
||||
Postgres
|
||||
gepatcht
|
||||
Notfallvorsorgemanagement
|
||||
Multiverfahrensdienste
|
||||
OpenShift
|
||||
RedHat
|
||||
NTP
|
||||
PTR
|
||||
FQDN
|
||||
Infoblox
|
||||
WinRM
|
||||
ALG
|
||||
ESXi
|
||||
ServiceCMBD
|
||||
MGMT
|
||||
SLA
|
||||
BSI
|
||||
Notfallhandbücher
|
||||
checkMK
|
||||
S3
|
||||
etcd
|
||||
zcdi
|
||||
CONFIGFILE
|
||||
shyaml
|
||||
xargs
|
||||
amd64
|
||||
fi
|
||||
podman
|
||||
Herstellerrepositories
|
||||
Multiline
|
||||
debian12
|
||||
ubuntu20
|
||||
ubuntu22
|
||||
rhel7
|
||||
rhel8
|
||||
rhel9
|
||||
sles12
|
||||
sles15
|
||||
dists
|
||||
Configdatei
|
||||
baseimages
|
||||
microdnf
|
||||
ubi7
|
||||
ubi8
|
||||
ubi9
|
||||
dnf
|
||||
txt
|
||||
tmp
|
||||
mv
|
||||
fpm
|
||||
SHA
|
||||
env
|
||||
EOF
|
||||
dpkg
|
||||
usr
|
||||
opensuse
|
||||
zypper
|
||||
test
|
||||
RHEL
|
||||
SLES
|
||||
reddit
|
||||
localhost
|
||||
hostname
|
||||
Tanium
|
||||
shawn
|
||||
huebner
|
||||
hostvars
|
||||
tanium
|
||||
Hospitationsanfragen
|
||||
Timeboxing
|
||||
Ditmar
|
||||
FVM
|
||||
JIRA
|
||||
TQ
|
||||
grundschutzkonform
|
||||
dSecurecloud
|
||||
Präsenzrunde
|
||||
Postinstall
|
||||
Releasekonzept
|
||||
Ressourcelimits
|
||||
OOM
|
||||
KIMs
|
||||
zzeorqd001
|
||||
zzeorpd001
|
||||
AAP
|
||||
TODO
|
||||
ServiceCMDB
|
||||
Fur/!
|
||||
EE
|
||||
ee
|
||||
zeor
|
||||
Patchlaufs
|
||||
Paketrepositories
|
||||
md
|
||||
Replikationsdatenbank
|
||||
vorgefiltert
|
||||
#in
|
||||
ein/!
|
||||
ein
|
||||
Shortnames
|
||||
Datacenter
|
||||
apiVersion
|
||||
nfs
|
||||
subdir
|
||||
argocd
|
||||
argoproj
|
||||
enableAutoSync
|
||||
#eyCloak
|
||||
ArgoCD
|
||||
KeyCloak/!
|
||||
FFMPEG
|
||||
grotemi
|
||||
lbdlspa001
|
||||
mgmt
|
||||
dpaor
|
||||
ctrl
|
||||
#uestion
|
||||
quote
|
||||
tmux
|
||||
Workaround/!
|
||||
Workaround
|
||||
TVM
|
||||
DCS
|
||||
TZ
|
||||
PoC
|
||||
CoreOS
|
||||
Konfigurationsmgmt
|
||||
IPv6
|
||||
HANA
|
||||
KRB
|
||||
SMB
|
||||
Hiera
|
||||
Puppetversion
|
||||
SuMa
|
||||
GSC
|
||||
sysctl
|
||||
Cloudera
|
||||
Feldhoff
|
||||
Entwicklungssharepoint
|
||||
vllt
|
||||
rsync
|
||||
chown
|
||||
chmod
|
||||
ed25519
|
||||
scp
|
||||
sudo
|
||||
systemctl
|
||||
sshd
|
||||
X11
|
||||
buildah
|
||||
zentro
|
||||
python3
|
||||
pip3
|
||||
releasever
|
||||
basearch
|
||||
fedoraepel
|
||||
EPEL
|
||||
nodejs
|
||||
baseurl
|
||||
gpgcheck
|
||||
gpgkey
|
||||
lzeorpt001
|
||||
noqa
|
||||
k8s
|
||||
mkdir
|
||||
cp
|
||||
ln
|
||||
kommandozeilentools1
|
||||
url
|
||||
github
|
||||
SLB
|
||||
hostet
|
||||
heredoc
|
||||
#uestion
|
||||
question/!
|
||||
question
|
||||
#TDOUT
|
||||
Kommandozeilentools/!
|
||||
STDOUT/!
|
||||
#ur/!
|
||||
fur/!
|
||||
eingegebende
|
||||
bashrc
|
||||
sourcen
|
||||
Sharepoint
|
||||
GitLab
|
||||
Anderungen/!
|
||||
#rstmal
|
||||
erstmal/!
|
||||
erstmal
|
||||
postinstall
|
||||
Systeminfrastrukturdiagramm
|
BIN
vim/spell/own.add.spl
Normal file
BIN
vim/spell/own.add.spl
Normal file
Binary file not shown.
Loading…
Reference in a new issue