Skip to content

Instantly share code, notes, and snippets.

View KevinRohn's full-sized avatar
🏃‍♂️

KevinR KevinRohn

🏃‍♂️
View GitHub Profile
@KevinRohn
KevinRohn / file.md
Last active October 10, 2024 12:30
Romod Safestate Erklärung

Fehlerprotokoll: Modbus Modul SafeState Problematik

Betroffenes Gerät

Modbus Modul 8DO / 8DO-R

Problembeschreibung

Der SafeState des Modbus Moduls wird vorzeitig aufgehoben, wenn ein beliebiges Register abgefragt wird, auch wenn dies nicht das Register zur Steuerung der digitalen Ausgänge (R121) ist. Dies führt zu unerwarteten Zustandsänderungen der Ausgänge, was zu Fehlern in der Anlagensteuerung führen kann.

Erwartetes Verhalten

Der SafeState sollte aktiv bleiben, bis das Register R121 zur Steuerung der digitalen Ausgänge explizit beschrieben wird.

@KevinRohn
KevinRohn / prompt instruction
Last active September 2, 2024 19:51
Python prompt instruction
---
Version: 1.1921.21
Name: Python senior-level development assistant
Description:
- Mainly used for analysis of existing code
- Optimized for short code optimization parts
- No focus on full application creation
---
You are an expert Python developer tasked with analyzing and improving a piece of Python code.
@KevinRohn
KevinRohn / aptinstall.sh
Created November 24, 2023 09:29
Install apt
#!/bin/bash
wget http://ftp.de.debian.org/debian/pool/main/a/apt/apt_1.8.2.3_armhf.deb
wget http://ftp.de.debian.org/debian/pool/main/a/apt/libapt-pkg5.0_1.8.2.3_armhf.deb
dpkg -i *.deb && rm *.deb
apt update
@KevinRohn
KevinRohn / ap.sh
Last active December 19, 2023 10:30
setup ap
#!/bin/bash
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
ITF_NAME=$1
@KevinRohn
KevinRohn / main.py
Last active November 24, 2023 08:53
Quick and Dirty modbus Python request
from pymodbus.client import ModbusTcpClient
import time
host = '192.168.20.203' # Replace with the IP address of your Modbus server
port = 502 # Replace with the port number of your Modbus server
start_address = 250 # Replace with the starting address of the register you want to read
count = 10 # Number of registers to read
slaves = [1] # List of Slave IDs of the Modbus servers
client = ModbusTcpClient(host, port)
@KevinRohn
KevinRohn / validate_ipv4.sh
Created November 3, 2023 15:06
validate IPv4
#!/bin/bash
IP=$1
result=`echo $IP | awk -F"\." ' $0 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}$/ && $1 <=255 && $2 <= 255 && $3 <= 255 && $4 <= 255 '` 2>/dev/null
if [ "$result" = "" ]; then
echo "IPv4 is invalid: $IP"
exit 1
fi
exit 0
3.5.18.3
@KevinRohn
KevinRohn / clear_logs.sh
Last active June 7, 2021 09:57
Clear all logs #commands
for CLEAN in $(find /var/log/ -type f)
do
cp /dev/null $CLEAN
done
@KevinRohn
KevinRohn / remove-remote-git-tags.txt
Last active June 7, 2021 09:59 — forked from okunishinishi/Remove all git tags
Delete all git remote tags #commands
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@KevinRohn
KevinRohn / cleanhistory.sh
Last active June 7, 2021 09:58
Clean up shell history #commands
history -c
shred -u ~/.bash_history && touch ~/.bash_history