This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rpi_revision_code() { | |
# see https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes | |
code=$(grep Revision /proc/cpuinfo | cut -f 2 -d \: | xargs) | |
echo $((16#${code})) | |
} | |
rpi_type() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
nm_files="dhcp-eth0.nmconnection dhcp-eth1.nmconnection fallback-link-local-eth0.nmconnection fallback-link-local-eth1.nmconnection 99-revpi.conf" | |
download_dir=$(mktemp -d) | |
echo -n "This script will change the network configuration from dhcpcd to NetworkManager. Do you want to proceed? [yN] " | |
read choice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $(id -u) != 0 ]]; then | |
echo "usage: sudo $(basename $0)" | |
exit 1 | |
fi | |
pibridge_static_mac() { | |
interface=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VENDOR_ID=2109 | |
PRODUCT_ID=2817 | |
# find all devices which match our product id | |
for f in $(grep --include='idProduct' -rlw "$PRODUCT_ID" /sys/bus/usb/devices/usb* 2>/dev/null); do | |
device=$(dirname $f) | |
# ensure that vendor id also matches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import revpimodio2 | |
def loop_function(ct): | |
# copy 5 input register from modbus to gateway | |
rpi.io.Gateway_Output_Word_1.value = rpi.io.Input_Word_1.value | |
rpi.io.Gateway_Output_Word_2.value = rpi.io.Input_Word_2.value | |
rpi.io.Gateway_Output_Word_3.value = rpi.io.Input_Word_3.value | |
rpi.io.Gateway_Output_Word_4.value = rpi.io.Input_Word_4.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import json | |
import argparse | |
import os.path | |
DEFAULT_CONFIG_NEW = "/var/www/revpi/pictory/projects/_config.rsc" | |
DEFAULT_CONFIG_OLD = "/var/www/pictory/projects/_config.rsc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import revpimodio2 | |
def ev(name, value): | |
# payload is bytes, so we need to know the enconding (eg. ascii, utf-8, etc...) | |
print(name, value.decode('ascii')) | |
rpi = revpimodio2.RevPiModIO(autorefresh=True, monitoring=True) | |
rpi.handlesignalend() | |
# define IO: change length of string in the frm argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: schedule downtime | |
uri: | |
url: "https://{{ icinga_host }}:{{ icinga_port | default(5665) }}/v1/actions/schedule-downtime" | |
user: "{{ icinga_user }}" | |
password: "{{ icinga_password }}" | |
force_basic_auth: True | |
validate_certs: False | |
method: POST | |
headers: | |
Accept: "application/json" |
NewerOlder