Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Elwell Elwell

View GitHub Profile
@Elwell
Elwell / automations.yaml
Created May 22, 2021
Alexa notify on parsed MQTT JSON payload
View automations.yaml
- id: 'whatever'
alias: Valid SMS for gate
description: Announces sender of a valid gate trigger
trigger:
- platform: mqtt
topic: twilio/sms
payload: true
value_template: '{{ value_json.Gate_Auth }}'
condition: []
action:
View gist:212a19271def21b1176640502e76fc2e
root@zero-1:~# python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tesserocr
!strcmp(locale, "C"):Error:Assert failed:in file baseapi.cpp, line 209
Segmentation fault
root@zero-1:~# dpkg -l | grep tess
ii libtesseract4:armhf 4.0.0-2 armhf Tesseract OCR library
@Elwell
Elwell / slurm_rpc.txt
Created Jan 6, 2021
Slurm RPC to version mapping
View slurm_rpc.txt
Slurm RPC version is a bitwise shift as documented at
https://github.com/SchedMD/slurm/blob/master/src/common/slurm_protocol_common.h#L56-L97
This table is a cheat sheet of recent versions to RPC
Slurm Int RPC
--------------------------
21.08. 37. 9472 (FUTURE)
20.11. 36. 9216 (CURRENT)
20.02. 35. 8960 (SUPPORTED)
@Elwell
Elwell / rbh2influx.py
Created Aug 6, 2020
robinhood rbh-report to influxdb parser
View rbh2influx.py
#!/usr/bin/python3
# rbh-report to influx publisher
# Andrew Elwell <Andrew.Elwell@pawsey.org.au>, July 2020
import time
import subprocess
import csv
import requests
for fs in ['lustre1','lustre2']:
@Elwell
Elwell / automations.yaml
Created May 7, 2020
Cheerlights into Mosquitto and Home assistant
View automations.yaml
- alias: 'Cheerlights to GlowOrb'
trigger:
platform: mqtt
topic: cheerlightsRGB
action:
service_template: light.turn_on
data_template:
brightness_pct: 50
rgb_color:
- "{{ trigger.payload[1:3] | int(0,16) }}"
@Elwell
Elwell / automations.yaml
Created Apr 28, 2020
Cheerlights in home assistant
View automations.yaml
- alias: 'Cheerlights to GlowOrb'
trigger:
platform: mqtt
topic: cheerlightsRGB
action:
service_template: light.turn_on
data_template:
brightness_pct: 50
rgb_color:
- "{{ trigger.payload[1:3] | int(0,16) }}"
@Elwell
Elwell / lnet.conf
Created Jul 9, 2019
Lustre LNET metrics parsing for collectd
View lnet.conf
LoadPlugin table
<Plugin table>
<Table "/proc/sys/lnet/stats">
Plugin "lustre"
Instance "lnet"
Separator " "
<Result>
InstancePrefix "msgs_alloc"
Type gauge
ValuesFrom 0
View automations.yaml
- alias: Gloworb on for ISS pass
trigger:
platform: state
entity_id: binary_sensor.iss
to: 'on'
action:
service: light.turn_on
data:
brightness: 100
rgb_color: [0, 0, 255]
@Elwell
Elwell / ruuvi2influxdb.py
Created Jan 15, 2018
Ruuvitag to influxdb
View ruuvi2influxdb.py
#!/usr/bin/python3
from influxdb import InfluxDBClient
from ruuvitag_sensor.ruuvi import RuuviTagSensor
tags = {'F6:B4:FB:E9:7C:A8':'incubator'}
client = InfluxDBClient(host="localhost", port=8086, database="sensors")
@Elwell
Elwell / psu.ino
Created Aug 28, 2017
Arduino PSU control
View psu.ino
/* Arduino control for (ex) server PSU
* Andrew Elwell <Andrew.Elwell@gmail.com> August 2016
* Released under BSD licence
*/
/* Controls / Pins based on data sheet available at
* https://belfuse.com/resources/PowerSolutions/SFP1050/bcd20031_ab_sfp1050-12bg.pdf
*
* A6/B4/C4/D4 +3.3 standby (power to arduino)
* A3/B1/B3/C1/C3/D3 Return