In global config:
This file contains hidden or 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
| from pymodbus.client import ModbusTcpClient | |
| # --- Network & Device Settings --- | |
| DEVICE_IP = '192.168.2.230' | |
| PORT = 502 | |
| SLAVE_ID = 0x11 # 17 in decimal | |
| # --- Modbus Read Parameters --- | |
| START_ADDRESS = 5 | |
| COUNT = 55 # 59 - 5 + 1 = 55 registers to cover the whole range |
This file contains hidden or 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 serial | |
| from pymodbus.client import ModbusSerialClient | |
| import time | |
| # Configuration | |
| PORT = '/dev/ttyAMA0' | |
| BAUD = 9600 | |
| ORIGINAL_ADDR = 1 | |
| NEW_ADDR = 2 |
This file contains hidden or 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
| # For Econet Grant Heatpump | |
| - authentication: basic | |
| username: "admin" | |
| password: "admin" | |
| scan_interval: 30 | |
| resource: http://192.168.86.31/econet/editParams | |
| sensor: | |
| - name: "Grant Heat pump SCOP" | |
| unique_id: 'f541d4d5-b12a-4c2b-9566-d284d75d5c7e' |
This file contains hidden or 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 minimalmodbus | |
| import serial | |
| import struct | |
| import time | |
| def millis(): | |
| return int(round(time.time() * 1000)) | |
| def C(val): | |
| return struct.pack('!H', val) |
This file contains hidden or 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/python3 | |
| import requests | |
| import json | |
| # Setup OpenWeather Map | |
| openweather_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
| lat = "xx.xxx" | |
| lon = "-x.xxxx" | |
| openweather_url = "https://api.openweathermap.org/data/2.5/onecall?lat=%s&lon=%s&appid=%s&units=metric&exclude=minutely,hourly,daily,alerts" % (lat, lon, openweather_api_key) |
This file contains hidden or 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
| # rename all files with extension passed as argument 1 to m4v | |
| # e.g to rename MOV extension to m4v ./rename-m4v.sh MOV | |
| for file in *.$1 | |
| do | |
| mv "$file" "${file%.$1}.m4v" | |
| done |
This file contains hidden or 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
| # https://gist.github.com/KonradIT/ee685aee15ba1c3c44b4 | |
| $ ls > gopro.txt | |
| $ mencoder -nosound -ovc lavc -lavcopts \ | |
| vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 \ | |
| -vf scale=1920:1080 -mf type=jpeg:fps=20 \ | |
| mf://@gopro.txt -o gopro.mp4 |
This file contains hidden or 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 | |
| # Convert DHI phantom 4 / Mavi MP4/MPV to an MP4 that will play on android devices | |
| # Adjust extension and handbreak preset as required | |
| # To install Handbrake | |
| # sudo add-apt-repository ppa:stebbins/handbrake-releases | |
| # sudo apt-get update | |
| # sudo apt-get install handbrake-gtk | |
| # sudo apt-get install handbrake-cli |
This file contains hidden or 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
| for file in ./*.html; do | |
| [ -f "$file" ] && | |
| length=$(tail -n 1 "$file" | wc -c) && | |
| [ "$length" -gt 0 ] && | |
| truncate -s "-$length" "$file" | |
| done |
NewerOlder


