Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
9929539860 | |||
aa5f642398 | |||
|
645b1919fd | ||
c883d545aa | |||
da9fdb3046 | |||
e8b9106559 | |||
45adf6f5a6 | |||
b44cfef41d | |||
4a5ea44daa | |||
d5f22f1a49 | |||
33f1b70a13 | |||
5fde2ca413 | |||
7354bb9e3a |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
*/venv
|
||||||
|
|
||||||
# ---> Linux
|
# ---> Linux
|
||||||
*~
|
*~
|
||||||
|
|
||||||
|
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal 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
|
@ -3,48 +3,21 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Additional Packages
|
# Additional Packages
|
||||||
COMMON="joe keepass2 xdotool powerline fonts-powerline powerline-gitstatus curlftpfs libstdc++6"
|
COMMON="keepass2 xdotool 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"
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
@ -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 config credential.helper store
|
||||||
|
|
||||||
|
12
giti
12
giti
@ -4,10 +4,11 @@
|
|||||||
#
|
#
|
||||||
# command line arguments
|
# command line arguments
|
||||||
#
|
#
|
||||||
usage="Usage: $0 [-p | output for prompt]"
|
usage="Usage: $0 [-p | output for prompt] [-s | short output]"
|
||||||
while getopts "hp" options; do
|
while getopts "hps" 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
|
||||||
;;
|
;;
|
||||||
@ -75,6 +76,9 @@ fi
|
|||||||
if [[ $PROMPT ]]; then
|
if [[ $PROMPT ]]; then
|
||||||
# print status
|
# print status
|
||||||
echo -e "$git_status_color├──$COLOR_GREEN($git_branch)$git_status_color - $git_status_text - $COLOR_CYAN$git_url$COLOR_WHITE"
|
echo -e "$git_status_color├──$COLOR_GREEN($git_branch)$git_status_color - $git_status_text - $COLOR_CYAN$git_url$COLOR_WHITE"
|
||||||
|
elif [[ $SHORT ]]; then
|
||||||
|
echo -n -e "$COLOR_GREEN($git_branch)$git_status_color - $git_status_text $COLOR_WHITE"
|
||||||
|
exit 0
|
||||||
else
|
else
|
||||||
# print status and
|
# print status and
|
||||||
echo -e "$git_status_color┌───┤ $git_status_text ├────────────────────────────────────────────────────────────────"
|
echo -e "$git_status_color┌───┤ $git_status_text ├────────────────────────────────────────────────────────────────"
|
||||||
@ -82,8 +86,6 @@ else
|
|||||||
|
|
||||||
if [[ ! $git_diff == "" ]]; then
|
if [[ ! $git_diff == "" ]]; then
|
||||||
echo -e "$git_status_color├────────────────────────────────────────────────────────────────────────────────────"
|
echo -e "$git_status_color├────────────────────────────────────────────────────────────────────────────────────"
|
||||||
else
|
|
||||||
echo -e "$git_status_color└────────────────────────────────────────────────────────────────────────────────────$COLOR_WHITE\n \b"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -92,7 +94,7 @@ if [[ ! $git_diff == "" ]]; then
|
|||||||
if [[ ! $PROMPT || "$GIT_PROMPT_DETAILS" == "on" ]]; then
|
if [[ ! $PROMPT || "$GIT_PROMPT_DETAILS" == "on" ]]; then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for ENTRY in $git_diff; do
|
for ENTRY in $git_diff; do
|
||||||
if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "MM"* ]] || [[ $ENTRY = "R "* ]]; then
|
if [[ $ENTRY = "D "* ]] || [[ $ENTRY = "A "* ]] || [[ $ENTRY = "M "* ]] || [[ $ENTRY = "R "* ]]; then
|
||||||
echo -e "$git_status_color│ $COLOR_DARKYELLOW$ENTRY"
|
echo -e "$git_status_color│ $COLOR_DARKYELLOW$ENTRY"
|
||||||
else
|
else
|
||||||
echo -e "$git_status_color│ $COLOR_YELLOW$ENTRY"
|
echo -e "$git_status_color│ $COLOR_YELLOW$ENTRY"
|
||||||
|
2
gitt
2
gitt
@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
git log --graph --oneline --all --decorate --topo-order
|
git log --graph --oneline --all --decorate --topo-order $*
|
||||||
|
@ -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
4
mqtt_sniffer
Executable 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
16
mqtt_test_smarthome
Executable 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
1
nagios.src
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8726b19639832d3ce0653bb91bd74e2e2a64bc3f
|
10
nagios_status
Executable file
10
nagios_status
Executable 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
|
||||||
|
|
3
nas_halt
Executable file
3
nas_halt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
ssh nas sudo /usr/sbin/shutdown -P 5
|
6
netst
Executable file
6
netst
Executable 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
67
netst.src/netst.py
Normal 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))
|
||||||
|
|
3
netst.src/requirements.txt
Normal file
3
netst.src/requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ifcfg
|
||||||
|
dnspython
|
||||||
|
|
6
pyrip
Executable file
6
pyrip
Executable 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
1
pyrip.src
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 48dc481f268e1ecdcd8d5e0126df553781e40a78
|
Loading…
x
Reference in New Issue
Block a user