Merge branch 'master' into dataport
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
This commit is contained in:
commit
c3c3969603
15 changed files with 20 additions and 207 deletions
|
@ -1,6 +1,7 @@
|
|||
### Funktionen
|
||||
#!/bin/bash
|
||||
function rgf {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
# shellcheck disable=SC2140
|
||||
echo "Finde alle Dateien die "\$1" im Namen haben."
|
||||
echo ""
|
||||
echo " Usage: rgf <string>"
|
||||
|
@ -11,14 +12,15 @@ function rgf {
|
|||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg --ignore-case --files --hidden --glob=!.git/ *"$1"*
|
||||
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"*
|
||||
find . -type f -not -path '*/\.git/*' -name -- *"$1"*
|
||||
fi
|
||||
}
|
||||
function rgi {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
# shellcheck disable=SC2140
|
||||
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
||||
echo ""
|
||||
echo " Usage: rgi <string>"
|
||||
|
@ -78,7 +80,7 @@ EOF
|
|||
(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
|
||||
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')
|
||||
|
@ -94,7 +96,7 @@ function glogs {
|
|||
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
|
||||
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 "$@"
|
||||
|
@ -104,13 +106,15 @@ function mdtoc {
|
|||
}
|
||||
# "scrolle" durch die commit-history
|
||||
ghist() {
|
||||
# shellcheck disable=2155
|
||||
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
|
||||
if [ "$current_commit" -le "$total_commits" ] && [ "$current_commit" -ge 1 ]; then
|
||||
# shellcheck disable=2155
|
||||
local commit_hash=$(git rev-list --reverse HEAD | sed -n "${current_commit}p")
|
||||
git --no-pager show $commit_hash
|
||||
git --no-pager show "$commit_hash"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -122,15 +126,17 @@ ghist() {
|
|||
echo "-----------------------------------------------------------"
|
||||
echo "Navigation: N - Next Commit, P - Previous Commit, Q - Quit"
|
||||
echo "-----------------------------------------------------------"
|
||||
read -n1 -s option
|
||||
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
|
||||
|
|
|
@ -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,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
|
|
@ -13,14 +13,14 @@ 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"
|
||||
git add .
|
||||
git stash
|
||||
git pull
|
||||
else
|
||||
scan *
|
||||
scan -- *
|
||||
fi
|
||||
cd .. > /dev/null
|
||||
fi
|
||||
|
@ -30,12 +30,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,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,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
|
|
@ -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
|
Loading…
Reference in a new issue