Compare commits

...

44 Commits

Author SHA1 Message Date
Dirk Alders
d829902516 +apt-extend-debian 2025-07-13 21:56:00 +02:00
c476336de9 giti - fix cursor jump on tab extension 2025-07-01 22:28:17 +02:00
a1d511779f giti - promp color masking for zsh/bash 2025-07-01 21:48:13 +02:00
163bf1dbc9 Fix giti symbol compatibility 2025-06-28 12:01:10 +02:00
ee9d3749c1 giti - background color slightly more blue 2025-06-23 21:17:57 +02:00
9660bf333f giti - minor optical changes 2025-06-23 13:17:21 +02:00
8e3ee44ea4 giti - branch color fix 2025-06-22 22:02:05 +02:00
5f9af54423 giti - Fix branch color and branch name 2025-06-22 18:00:55 +02:00
7adde4847b giti - SYMBOLFIX 2025-06-22 16:57:22 +02:00
95f53f2e6f giti - Color adaption 2025-06-22 14:24:51 +02:00
b146375353 giti - Improved background for reduced available colors 2025-06-22 12:08:14 +02:00
5b9d636295 giti - optical and color adaptions 2025-06-22 11:40:57 +02:00
1a1999fcef giti - brakets in branch color 2025-06-22 07:33:20 +02:00
e6c9f4ae5d giti - fix to color code normal after output 2025-06-22 07:28:51 +02:00
ec06a305f6 giti adaption for branches != master / main 2025-06-22 07:15:45 +02:00
f744338ad0 giti shorter prompt line 2025-06-22 00:27:56 +02:00
71937c6fb9 giti color adaption + content adaption for prompt version 2025-06-22 00:26:09 +02:00
cd6d66aade giti minor adaption 2025-06-21 23:52:47 +02:00
1c67c47c30 rework of giti 2025-06-21 23:48:12 +02:00
35e0358bb6 improved less messy giti 2025-06-21 09:58:35 +02:00
1cc32a60c5 cleanup 2025-06-15 07:44:23 +02:00
82a0e99984 venv ignore for git 2025-06-10 16:29:46 +02:00
24f4338fc2 bin update 2025-06-02 21:02:34 +02:00
bcf9563649 Merge branch 'master' of https://git.mount-mockery.de/dirk/bin 2025-05-04 12:00:11 +02:00
root
81f5848f37 add_vlan script adde for sescueue issues 2025-05-04 11:54:34 +02:00
494620210e mx extended for surface touch issues 2025-02-20 06:50:22 +01:00
root
92dfe01700 Fix gitconfig 2025-02-19 19:22:21 +01:00
bc772048ad x
Merge branch 'master' of https://git.mount-mockery.de/dirk/bin
2025-02-14 14:47:38 +01:00
3068d4330b mx software collection improved 2025-02-14 14:47:21 +01:00
1d30668b5a dnsleases improved 2025-01-29 13:29:25 +01:00
b536b751cd nas_halt adaption (call with parameter) 2025-01-27 13:15:19 +01:00
9929539860 nas related changes + some updates 2025-01-06 15:08:11 +01:00
aa5f642398 Update nagios.src 2024-08-21 09:45:32 +02:00
root
645b1919fd Update nagios.src 2024-08-21 09:27:39 +02:00
c883d545aa nagios status: added possibilty to report recent problems of the last -l hours 2024-08-16 07:36:12 +02:00
da9fdb3046 nagios_status added 2024-08-12 15:29:43 +02:00
e8b9106559 enabled gitt with arguments and update of ap-extend-mx 2024-07-04 13:22:54 +02:00
45adf6f5a6 default packages for mx updated 2024-05-12 19:45:24 +02:00
b44cfef41d Exception handling for wrong device 2024-03-23 14:13:53 +01:00
4a5ea44daa netst added to my bin folder 2024-03-23 14:06:19 +01:00
d5f22f1a49 mqtt_smarthome in tmux 2023-11-08 12:46:39 +01:00
33f1b70a13 giti: option short added again to support repo collector status 2023-09-30 09:58:56 +02:00
5fde2ca413 giti final line correction if no files affected 2023-09-30 09:41:57 +02:00
7354bb9e3a detail output color correction (revert) 2023-09-30 09:30:41 +02:00
33 changed files with 435 additions and 281 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
venv
*/venv
# ---> Linux # ---> Linux
*~ *~

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "nagios"]
path = nagios.src
url = https://git.mount-mockery.de/pylib/nagios.git
[submodule "pyrip"]
path = pyrip
url = https://git.mount-mockery.de/application/pyrip.git
[submodule "pyrip.src"]
path = pyrip.src
url = https://git.mount-mockery.de/application/pyrip.git

View File

@ -1,5 +0,0 @@
#!/bin/bash
#
echo -n | openssl s_client -showcerts -connect git.mount-mockery.de:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee /usr/local/share/ca-certificates/mount-mockery.crt
sudo update-ca-certificates

22
add_vlan.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
#
if [[ $UID != 0 ]]; then
echo "You need to be root to execute that script"
exit 1
fi
if [[ $# != 2 ]]; then
echo "You need to give at least 2 parameters <network_interface> <vlan_id>."
exit 1
fi
apt install vlan
modprobe 8021q
ip link add link $1 name $1.$2 type vlan id $2
if [[ $2 == 10 ]]; then
ip addr add 192.168.0.217/24 dev $1.$2
else
ip addr add 192.168.$2.217/24 dev $1.$2
fi
ip link set up $1.$2

47
apt-extend-debian Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
#
#
# Additional Packages
COMMON=""
COMMON="$COMMON htop keepassxc vim-nox" # systemd-sysv
## COMMON="$COMMON curlftpfs"
COMMON="$COMMON tlp tlp-rdw"
## COMMON="$COMMON fonts-powerline"
COMMON="$COMMON nextcloud-desktop dolphin-nextcloud"
## Use KDE-Wayland and activate maliit under System (Search Virtual Keyboard)
## COMMON="$COMMON maliit-keyboard"
## COMMON="$COMMON fonts-powerline powerline powerline-gitstatus"
MULTIMEDIA=""
MULTIMEDIA="$MULTIMEDIA rhythmbox ario kodi kodi-pvr-hts"
## MULTIMEDIA="$MULTIMEDIA lame"
## MULTIMEDIA="$MULTIMEDIA qjackctl carla carla-lv2 carla-vst ardour calf-plugins eq10q fluid-soundfont-gm fluid-soundfont-gs lame"
TOOLS=""
TOOLS="$TOOLS wavemon retext" # gnuplot
TOOLS="evolution gnuplot latexmk texlive-latex-recommended texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended"
PROGRAMMING=""
PROGRAMMING="python3-venv python3-wxgtk4.0 jq meld"
## PROGRAMMING="python-is-python3 pkgconf libgtk2.0-dev"
ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING
echo The followin packages and their required depending packages will be installed:
echo ------------------------------------------------------------------------------
echo $ALL
echo ------------------------------------------------------------------------------
read -r -p "Are you sure? [y/N] " response
echo ------------------------------------------------------------------------------
case "$response" in
[yY][eE][sS]|[yY])
echo $ALL
su --command="apt-get install -y $ALL"
;;
*)
echo Installation aborted!
;;
esac

View File

@ -3,48 +3,23 @@
# #
# Additional Packages # Additional Packages
COMMON="joe keepass2 xdotool powerline fonts-powerline powerline-gitstatus curlftpfs libstdc++6" COMMON="keepassx systemd-sysv openssh-server vim-nox tree"
# COMMON="$COMMON curlftpfs"
COMMON="$COMMON tlp tlp-rdw"
COMMON="$COMMON fonts-powerline"
COMMON="$COMMON nextcloud-desktop dolphin-nextcloud"
# Use KDE-Wayland and activate maliit under System (Search Virtual Keyboard)
COMMON="$COMMON maliit-keyboard"
# COMMON="$COMMON fonts-powerline powerline powerline-gitstatus"
_COMMON=" MULTIMEDIA="rhythmbox ario kodi kodi-pvr-hts"
joe git tmux MULTIMEDIA="$MULTIMEDIA lame"
keepass2 xdotool MULTIMEDIA="$MULTIMEDIA qjackctl carla carla-lv2 carla-vst ardour calf-plugins eq10q fluid-soundfont-gm fluid-soundfont-gs lame"
brasero
sshfs curlftpfs openssh-server
fonts-powerline powerline python3-powerline python3-powerline-gitstatus
lib32stdc++6
"
MULTIMEDIA="qjackctl ardour calf-plugins eq10q fluid-soundfont-gm fluid-soundfont-gs lame kodi" TOOLS="wavemon evolution retext gnuplot latexmk texlive-latex-recommended texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended"
_MULTIMEDIA=" PROGRAMMING="python-is-python3 python3-venv python3-wxgtk4.0 pkgconf libgtk2.0-dev jq meld"
ffmpeg
kodi kodi-pvr-hts
spotify-client
"
TOOLS="evolution latexmk texlive-generic-recommended texlive-latex-extra texlive-lang-german texlive-fonts-recommended"
_TOOLS="
evolution
gnuplot
gnome-boxes
gvncviewer
texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended texstudio
gimp
"
PROGRAMMING="virtualenv python3-wxgtk4.0 qt5dxcb-plugin"
_PROGRAMMING="
pycodestyle
virtualenv
python-coverage python3-coverage python-jinja2 python3-jinja2
python-wxtools python3-wxgtk4.0
python3-evdev python3-serial
python3-sphinx python3-sphinx-rtd-theme
meld
retext
"
ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING

View File

@ -1,30 +0,0 @@
#!/bin/sh
#
#
# Additional Packages
COMMON="
zsh zsh-syntax-highlighting zsh-autosuggestions
vim vim-python-jedi vim-autopep8 git tmux
neofetch figlet powerline
"
ALL=$COMMON
echo The followin packages and their required depending packages will be installed:
echo ------------------------------------------------------------------------------
echo $ALL
echo ------------------------------------------------------------------------------
read -r -p "Are you sure? [y/N] " response
echo ------------------------------------------------------------------------------
case "$response" in
[yY][eE][sS]|[yY])
sudo apt-get -y install $ALL
#
echo
echo
;;
*)
echo Installation aborted!
;;
esac

View File

@ -1,73 +0,0 @@
#!/bin/sh
#
#
# Additional Packages
COMMON="
joe
neofetch
tlp tlp-rdw
keepass2
synaptic
owncloud-client
dolphin-owncloud
"
_COMMON_="
git tmux
sshfs curlftpfs libneon27
openssh-server
nfs-kernel-server
lib32stdc++6
powerline powerline-gitstatus fonts-powerline
gnome-tweaks chrome-gnome-shell caffeine
"
MULTIMEDIA="
kodi kodi-pvr-hts
ubuntu-restricted-extras libdvd-pkg
"
_MULTIMEDIA_="
ubuntu-restricted-extras libdvd-pkg
ardour ubuntustudio-controls calf-plugins eq10q fluid-soundfont-gm fluid-soundfont-gs guitarix-ladspa swh-plugins
gxtuner
lame
"
_TOOLS_="
evolution
gnuplot
gvncviewer
texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended latexila
gimp
kicad kicad-packages3d
openscad freecad
"
_PROGRAMMING_="
arduino
minicom
virtualenv
libgtk-3-dev
python3-pip
meld
"
ALL=$COMMON\ $MULTIMEDIA\ $TOOLS\ $PROGRAMMING
echo The followin packages and their required depending packages will be installed:
echo ------------------------------------------------------------------------------
echo $ALL
echo ------------------------------------------------------------------------------
read -r -p "Are you sure? [y/N] " response
echo ------------------------------------------------------------------------------
case "$response" in
[yY][eE][sS]|[yY])
sudo apt-get -y install $ALL
;;
*)
echo Installation aborted!
;;
esac

View File

@ -1,6 +1,7 @@
#!/bin/python3 #!/bin/python3
# #
import subprocess import subprocess
import sys
import time import time
class host(object): class host(object):
@ -87,7 +88,22 @@ with open('/var/lib/misc/dnsmasq.leases', 'r') as fh:
if h.mac not in hl: if h.mac not in hl:
hl.append(h) hl.append(h)
for vlan in [20, 30, 40, 50, 60, 90]:
print("Hosts in VLAN %d" % vlan)
VLANs = {
20: "Network Devices - Switch, AP, ...",
30: "Private VLAN",
40: "Smarthome with Internet",
50: "Smarthome no Internet",
60: "Guest VLAN",
}
try:
PRINT_LIST = [int(sys.argv[1]), ]
except (IndexError, ValueError) as e:
PRINT_LIST = VLANs.keys()
for vlan in PRINT_LIST:
print(f"Hosts in VLAN {vlan} - {VLANs.get(vlan, 'Unknown')}")
print(hl.vlan_list(vlan)) print(hl.vlan_list(vlan))
print() print()

3
ftail
View File

@ -1,3 +0,0 @@
#!/bin/sh
clear
/opt/ftail/venv/bin/python /opt/ftail/ftail.py $*

3
garage
View File

@ -1,3 +0,0 @@
#!/bin/sh
#
python3 ~/prj/clients/garage/tcp_client.py

View File

@ -3,7 +3,12 @@
git config --global user.name "Dirk Alders" git config --global user.name "Dirk Alders"
git config --global user.email dirk@mount-mockery.de git config --global user.email dirk@mount-mockery.de
# #
git config --global pull.rebase false
#
git config --global diff.tool meld git config --global diff.tool meld
git config --global merge.tool meld git config --global merge.tool meld
git config --global merge.tool.cmd 'meld --auto-merge "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"'
git config --global --add difftool.prompt false git config --global --add difftool.prompt false
git config --global pull.rebase false #
git config --global credential.helper store

248
giti
View File

@ -1,13 +1,12 @@
#!/bin/bash #!/bin/bash
# #
# # COMMAND LINE ARGUMENTS ##########################################################################
# command line arguments usage="Usage: $0 [-p | output for prompt] [-s | short output]"
# while getopts "hps" options; do
usage="Usage: $0 [-p | output for prompt]"
while getopts "hp" options; do
case $options in case $options in
p ) PROMPT="True";; p ) PROMPT="True";;
s ) SHORT="True";;
h ) echo $usage h ) echo $usage
exit 0 exit 0
;; ;;
@ -17,93 +16,190 @@ while getopts "hp" options; do
esac esac
done done
# # DEFINITIONS #####################################################################################
# color definitions if [[ $PROMPT == "True" ]]; then
# COLOR_BACKGROUND="%{\033[48;2;48;64;72m%}" # RGB BACKGROUND
COLOR_WHITE="\033[00m" COLOR_FOR_AS_BACKGROUND="%{\033[38;2;48;64;72m%}" # RGB FOREGROUND LIKE BACKGROUND
COLOR_CYAN="\033[1;36m" COLOR_DARKGREEN="%{\033[0;32m%}" # PROMPT LINES
COLOR_RED="\033[1;31m" COLOR_NORMAL="%{\033[0m%}" # RESET
COLOR_YELLOW="\033[1;33m" else
COLOR_DARKYELLOW="\033[0;33m" COLOR_BACKGROUND="\033[48;2;48;64;72m" # RGB BACKGROUND
COLOR_GREEN="\033[1;32m" COLOR_FOR_AS_BACKGROUND="\033[38;2;48;64;72m" # RGB FOREGROUND LIKE BACKGROUND
COLOR_DARKGREEN="\033[0;32m" COLOR_DARKGREEN="\033[0;32m" # PROMPT LINES
COLOR_OCHRE="\033[38;5;95m" COLOR_NORMAL="\033[0m" # RESET
fi
# SYMBOL_START="$COLOR_NORMAL$COLOR_FOR_AS_BACKGROUND\xee\x82\xb2$COLOR_BACKGROUND "
# git information storage SYMBOL_END="$COLOR_BACKGROUND $COLOR_NORMAL$COLOR_FOR_AS_BACKGROUND\xee\x82\xb0"
# SYMBOL_SPLIT=" "
git_status="$(LANGUAGE='en_US.UTF-8 git' git status 2> /dev/null)" SYMBOL_BRANCH="\xee\x82\xa0"
git_diff="$(git status --porcelain 2> /dev/null)" SYMBOL_NEW="…"
SYMBOL_AHEAD="↑"
SYMBOL_BEHIND="↓"
SYMBOL_CHANGED="✚"
SYMBOL_COMMITED="●"
SYMBOL_STASH="⚑"
if [[ $PROMPT == "True" ]]; then
COLOR_BRANCH_CLEAN="%{\033[38;2;0;192;0m%}"
COLOR_BRANCH_CHANGED="%{\033[38;2;255;192;8m%}"
COLOR_BRANCH_OUTDATED="%{\033[38;2;152;152;152m%}"
COLOR_BRANCH_COMMIT="%{\033[38;2;208;168;224m%}"
COLOR_BRANCH_BRANCH="%{\033[38;2;140;208;240m%}"
COLOR_NEW="%{\033[38;2;224;48;8m%}"
COLOR_AHEAD="%{\033[38;2;192;192;192m%}"
COLOR_BEHIND="$COLOR_AHEAD"
COLOR_CHANGED="%{\033[38;2;224;128;8m%}"
COLOR_COMMITED="%{\033[38;2;8;224;160m%}"
COLOR_STASH="%{\033[38;2;0;32;224m%}"
COLOR_URL="%{\033[38;2;0;224;192m%}"
else
COLOR_BRANCH_CLEAN="\033[38;2;0;192;0m"
COLOR_BRANCH_CHANGED="\033[38;2;255;192;8m"
COLOR_BRANCH_OUTDATED="\033[38;2;152;152;152m"
COLOR_BRANCH_COMMIT="\033[38;2;208;168;224m"
COLOR_BRANCH_BRANCH="\033[38;2;140;208;240m"
COLOR_NEW="\033[38;2;224;48;8m"
COLOR_AHEAD="\033[38;2;192;192;192m"
COLOR_BEHIND="$COLOR_AHEAD"
COLOR_CHANGED="\033[38;2;224;128;8m"
COLOR_COMMITED="\033[38;2;8;224;160m"
COLOR_STASH="\033[38;2;0;32;224m"
COLOR_URL="\033[38;2;0;224;192m"
fi
BRANCH_VAL="unknown"
AHEAD_VAL="0"
BEHIND_VAL="0"
NEW_VAL="0"
CHANGED_VAL="0"
COMMITED_VAL="0"
# # GIT COMMANDS ####################################################################################
GIT_URL="$(LANGUAGE='en_US.UTF-8 git' git config --get remote.origin.url 2> /dev/null)"
GIT_STATUS="$(LANGUAGE='en_US.UTF-8 git' git status -sb 2> /dev/null)"
GIT_FILES="$(LANGUAGE='en_US.UTF-8 git' git status -s 2> /dev/null)"
BRANCH_VAL="$(LANGUAGE='en_US.UTF-8 git' git branch 2> /dev/null | sed --quiet 's/* \(.*\)/\1/p')"
STASH_VAL=$(LANGUAGE='en_US.UTF-8 git' git stash list 2> /dev/null | wc -l)
# decision for git output (path is repository) # decision for git output (path is repository)
# if [ -z "$GIT_STATUS" ]; then
if [ -z "$git_status" ]; then
# No GIT repository # No GIT repository
exit exit
fi fi
# # GIT MAGIC #######################################################################################
# git preparations # BEHIND_VAL, AHEAD_VAL
# BEHIND_VAL=$(echo $GIT_STATUS | grep -Po "behind\s+\K\w+")
git_branch="$(git branch 2> /dev/null | sed --quiet 's/* \(.*\)/\1/p')" AHEAD_VAL=$(echo $GIT_STATUS | grep -Po "ahead\s+\K\w+")
git_url="$(git config --get remote.origin.url 2> /dev/null)"
if [[ ! $git_status =~ "working tree clean" ]] && [[ ! $git_status =~ "working directory clean" ]]; then # NEW_VAL, MODIFIED_VAL, COMMITED_VAL
git_status_color="$COLOR_RED" GIT_STATUS_DETAILS=""
git_status_text="local changes" if [[ ! -z "$GIT_FILES" ]]; then
elif [[ $git_status =~ "Your branch is behind" ]]; then while IFS= read -r line ;do
git_status_color="$COLOR_YELLOW" FILES_STATUS=${line:0:2}
git_status_text="pull required" FILES_STATUS_COMMITED=${FILES_STATUS:0:1}
elif [[ $git_status =~ "Your branch is ahead of" ]]; then FILES_STATUS_CHANGED=${FILES_STATUS:1:1}
git_status_color="$COLOR_YELLOW" FILES_NAME=$(echo $line | awk '{print $2}')
git_status_text="push required" # NEW FILE increase
elif [[ $git_status =~ "nothing to commit" ]]; then if [[ $FILES_STATUS == "??" ]]; then
git_status_color="$COLOR_DARKGREEN" ((NEW_VAL++))
git_status_text="clean " fi
# CHANGED
if [[ $FILES_STATUS_CHANGED != "?" && $FILES_STATUS_CHANGED != " " && $FILES_STATUS_CHANGED != "" ]]; then
((CHANGED_VAL++))
fi
# COMMITED
if [[ $FILES_STATUS_COMMITED != "?" && $FILES_STATUS_COMMITED != " " && $FILES_STATUS_COMMITED != "" ]]; then
((COMMITED_VAL++))
fi
done <<< "$GIT_FILES"
fi
# GIT STATUS COLOR ################################################################################
if [[ $BRANCH_VAL == "master" || $BRANCH_VAL == "main" ]]; then
COLOR_BRANCH=$COLOR_BRANCH_CLEAN
elif [[ $BRANCH_VAL == *"HEAD detached at"* ]]; then
COLOR_BRANCH=$COLOR_BRANCH_COMMIT
BRANCH_VAL=$(echo $BRANCH_VAL | awk '{print $4}')
BRANCH_VAL=${BRANCH_VAL::-1}
else else
git_status_color="$COLOR_OCHRE" COLOR_BRANCH=$COLOR_BRANCH_BRANCH
git_status_text="unknown "
fi fi
if [[ $COMMITED_VAL > 0 || $CHANGED_VAL > 0 ]]; then
COLOR_BRANCH="$COLOR_BRANCH_CHANGED"
elif [[ $BEHIND_VAL > 0 || $AHEAD_VAL > 0 || $NEW_VAL > 0 ]]; then
COLOR_BRANCH="$COLOR_BRANCH_OUTDATED"
fi
# # GIT GATHERING ###################################################################################
# Start of console output BRANCH="$COLOR_BRANCH$COLOR_BACKGROUND$SYMBOL_BRANCH$BRANCH_VAL"
# BEHIND="$COLOR_BEHIND$COLOR_BACKGROUND$SYMBOL_BEHIND$BEHIND_VAL"
AHEAD="$COLOR_AHEAD$COLOR_BACKGROUND$SYMBOL_AHEAD$AHEAD_VAL"
NEW="$COLOR_NEW$COLOR_BACKGROUND$SYMBOL_NEW$NEW_VAL"
CHANGED="$COLOR_CHANGED$COLOR_BACKGROUND$SYMBOL_CHANGED$CHANGED_VAL"
COMMITED="$COLOR_COMMITED$COLOR_BACKGROUND$SYMBOL_COMMITED$COMMITED_VAL"
STASH="$COLOR_STASH$COLOR_BACKGROUND$SYMBOL_STASH$STASH_VAL"
## STATUS AND INFO ###### # GIT OUTPUT ######################################################################################
if [[ $PROMPT ]]; then GIT_STATUS_SUMMARY="$BRANCH"
# print status if [[ $BEHIND_VAL > 0 ]]; then
echo -e "$git_status_color├──$COLOR_GREEN($git_branch)$git_status_color - $git_status_text - $COLOR_CYAN$git_url$COLOR_WHITE" GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$BEHIND
fi
if [[ $AHEAD_VAL > 0 ]]; then
GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$AHEAD
fi
if [[ $COMMITED_VAL > 0 ]]; then
GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$COMMITED
fi
if [[ $CHANGED_VAL > 0 ]]; then
GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$CHANGED
fi
if [[ $NEW_VAL > 0 ]]; then
GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$NEW
fi
if [[ $STASH_VAL > 0 ]]; then
GIT_STATUS_SUMMARY=$GIT_STATUS_SUMMARY$SYMBOL_SPLIT$STASH
fi
if [[ $PROMPT == "True" ]]; then
if [[ $SHORT == "True" ]]; then
echo -ne " $SYMBOL_START$GIT_STATUS_SUMMARY$SYMBOL_END"
else else
# print status and echo -ne "$COLOR_DARKGREEN├"
echo -e "$git_status_color┌───┤ $git_status_text ├────────────────────────────────────────────────────────────────" echo -ne "$SYMBOL_START"
echo -e "$git_status_color│ $COLOR_GREEN($git_branch) $COLOR_CYAN$git_url" echo -ne "$GIT_STATUS_SUMMARY "
echo -ne "$COLOR_NORMAL$COLOR_BACKGROUND- "
if [[ ! $git_diff == "" ]]; then echo -ne "$COLOR_URL$GIT_URL"
echo -e "$git_status_color├────────────────────────────────────────────────────────────────────────────────────" echo -e "$SYMBOL_END"
if [[ $GIT_PROMPT_DETAILS == "on" && ! -z "$GIT_FILES" ]]; then
while IFS= read -r line ;do
FILES_STATUS=${line:0:2}
FILES_STATUS_CHANGED=${FILES_STATUS:1:1}
if [[ $FILES_STATUS_CHANGED != "?" && $FILES_STATUS_CHANGED != " " ]]; then
echo -e "$COLOR_DARKGREEN│ $COLOR_BRANCH$line"
fi
done <<< "$GIT_FILES"
fi
echo -e "$COLOR_NORMAL"
fi
else else
echo -e "$git_status_color└────────────────────────────────────────────────────────────────────────────────────$COLOR_WHITE\n \b" if [[ $SHORT == "True" ]]; then
fi echo -ne " $SYMBOL_START$GIT_STATUS_SUMMARY$SYMBOL_END$COLOR_NORMAL"
fi
## FILE INFO ############
if [[ ! $git_diff == "" ]]; then
if [[ ! $PROMPT || "$GIT_PROMPT_DETAILS" == "on" ]]; then
IFS=$'\n'
for ENTRY in $git_diff; do
if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "MM"* ]] || [[ $ENTRY = "R "* ]]; then
echo -e "$git_status_color│ $COLOR_DARKYELLOW$ENTRY"
else else
echo -e "$git_status_color│ $COLOR_YELLOW$ENTRY" echo -e "$SYMBOL_START$GIT_STATUS_SUMMARY $COLOR_NORMAL$COLOR_BACKGROUND- $COLOR_URL$GIT_URL$SYMBOL_END"
if [[ ! -z "$GIT_FILES" ]]; then
while IFS= read -r line ;do
if [[ $line != "??"* ]]; then
echo -e " $COLOR_BRANCH$line"
fi fi
done done <<< "$GIT_FILES"
fi
echo -ne "$COLOR_NORMAL"
fi fi
fi fi
## CLOSING ##############
if [[ $PROMPT ]]; then
echo -e " \b"
else
echo -e "$git_status_color└────────────────────────────────────────────────────────────────────────────────────$COLOR_WHITE\n \b"
fi

2
gitt
View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
# #
git log --graph --oneline --all --decorate --topo-order git log --graph --oneline --all --decorate --topo-order $*

3
leyk
View File

@ -1,3 +0,0 @@
#!/bin/sh
#
python3 ~/prj/clients/leyk/tcp_client.py

View File

@ -1,4 +1,16 @@
#!/bin/sh #!/bin/sh
clear clear
/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home
#!/bin/sh
#
for s in $(tmux list-sessions -F '#{session_name}'); do
p=$(tmux list-panes -F '#{pane_tty}' -t "$s")
if [ "$p" = "$(tty)" ]; then
# Session already running
exit 0
fi
done
tmux attach-session -t mqtt_smarthome || tmux new-session -s mqtt_smarthome "/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home"

4
mqtt_sniffer Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
#
/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py $*

16
mqtt_test_smarthome Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
clear
#!/bin/sh
#
for s in $(tmux list-sessions -F '#{session_name}'); do
p=$(tmux list-panes -F '#{pane_tty}' -t "$s")
if [ "$p" = "$(tty)" ]; then
# Session already running
exit 0
fi
done
tmux attach-session -t mqtt_test_smarthome || tmux new-session -s mqtt_test_smarthome "/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home -p 1884 -n"

1
nagios.src Submodule

@ -0,0 +1 @@
Subproject commit 8726b19639832d3ce0653bb91bd74e2e2a64bc3f

10
nagios_status Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
#
BASEDIR=$(dirname $0)
if [ $# -eq 0 ]; then
python3 $BASEDIR/nagios.src/status.py nagios.home
else
python3 $BASEDIR/nagios.src/status.py $*
fi

8
nas_halt Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
#
if [ $# == 0 ]
then
ssh nas sudo /usr/sbin/shutdown -P 5
else
ssh nas sudo /usr/sbin/shutdown -P $1
fi

4
nas_wake Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
#
wakeonlan 38:ea:a7:a6:03:9d

6
netst Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
#
BASEDIR=$(dirname $0)
$BASEDIR/netst.src/venv/bin/python $BASEDIR/netst.src/netst.py $*

67
netst.src/netst.py Normal file
View File

@ -0,0 +1,67 @@
import dns.resolver
import ifcfg
import json
import socket
import struct
import sys
import time
interfaces = ifcfg.interfaces()
def exit_device():
print("Possible devices:", ", ".join(interfaces.keys()))
sys.exit(1)
def gateway(device):
with open("/proc/net/route") as fh:
# skip header
next(fh)
for line in fh:
routes = line.strip().split()
if routes[0] == device:
destination = socket.inet_ntoa(struct.pack("<L", int(routes[1], 16)))
if destination != "0.0.0.0":
continue
return socket.inet_ntoa(struct.pack("<L", int(routes[2], 16)))
try:
DEVICE = sys.argv[1]
except IndexError:
print("You need to give the device name as first argument!\n")
exit_device()
HRN = { # Human Readable Name
'MAC': 'ether',
'MTU': 'mtu',
'IP': 'inet',
'Netmask': 'netmask',
}
try:
info = interfaces[DEVICE]
except KeyError:
print("Unknown device:", DEVICE, "\n")
exit_device()
try:
dns_resolver = dns.resolver.Resolver()
except dns.resolver.NoResolverConfiguration:
dns_server = []
else:
dns_server = dns_resolver.nameservers
print('+' + 27 * '-' + '+')
print("|%9s: %s" % ('Device', DEVICE) + (16 - len(DEVICE)) * ' ' + '|')
print('+' + 27 * '-' + '+')
for name in HRN:
print("%10s: %s" % (name, info[HRN[name]]))
print("%10s: %s" % ('Gateway', gateway(DEVICE)))
try:
print("%10s: %s" % ("Domain", socket.getfqdn().split('.', 1)[1]))
except IndexError:
print("%10s: None" % "Domain")
for i, dns in enumerate(dns_server):
print("%10s: %s" % ("DNS_%d" % (i + 1), dns))

View File

@ -0,0 +1,3 @@
ifcfg
dnspython

View File

@ -1,10 +0,0 @@
#!/bin/bash
#
IP=`wget -O - stdout http://pdns.mount-mockery.de 2> /dev/null|jq .$1`
if [[ "$IP" = "null" ]]; then
echo No IP found for host $1.
exit 1
else
echo $IP
fi

View File

@ -1,8 +0,0 @@
#/bin/bash
#
HOST=`pdns-get $1`
if [[ $? -eq 0 ]]; then
socat stdio tcp:$HOST:22
else
>&2 echo CONNECTION ERROR: IP of host $1 is unknown.
fi

View File

@ -1,4 +0,0 @@
#!/bin/sh
#
wget -O - stdout http://pdns.mount-mockery.de/pdns/$(hostname) 2> /dev/null 1> /dev/null

6
pyrip Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
#
BASEDIR=$(dirname $0)
$BASEDIR/pyrip.src/venv/bin/python $BASEDIR/pyrip.src/pyrip.py $*

1
pyrip.src Submodule

@ -0,0 +1 @@
Subproject commit 64d42cdc57d03b323ebcbc8a29cf8f0aa2a96a58

View File

@ -1,8 +0,0 @@
#!/bin/sh
#
echo "* Creating virtual env"
./mkvenv
echo "* Creating link in homedirectory"
ln -s `pwd` ~/bin

View File

@ -1,9 +0,0 @@
#!/bin/sh
#
if ! gnome-terminal -- $*; then
if ! konsole -e $*; then
if ! xfce4-terminal -e $*; then
$*
fi
fi
fi

View File

@ -1 +0,0 @@
sudo gpsbabel -t -i gpx -f "$1" -o garmin -F usb: