Skip to content

Instantly share code, notes, and snippets.

View benagricola's full-sized avatar
🐒
Working on MillenniumOS!

Ben Agricola benagricola

🐒
Working on MillenniumOS!
View GitHub Profile
@benagricola
benagricola / test.py
Last active June 8, 2024 16:16
Using MicroPython's new pure-python USB driver to send audio data to the host.
import array
import math
import time
import os
import usb.device
from uac2 import AudioInterface
print("Okay, configuring the audio interface now...")
@benagricola
benagricola / README.md
Last active March 18, 2024 13:47
Working out how to enable Modbus over TCP on Solis RHI-3.6K-48ES-5G inverter with datalogger S3-WIFI-ST - without having either.

Intro

Data from this issue indicates that the wifi dongle uses a MXCHIP EMW3080-E SOC.

Searches for that model number found a bunch of useful issues, including the MX Guide which contains a list of AT commands that might be supported by the module.

Further digging indicated that Solis has an App that they use to configure the logger, called Solis Cloud

Steps

  • Decompile the APK using jadx-gui. Look for any hints of bluetooth or wifi connectivity configuration and AT commands
@benagricola
benagricola / process-trace.py
Created July 10, 2022 13:55
Script to convert QEMU VFIO Intel HD Audio traces to a more human readable format for debugging card initialisation issues.
#!/usr/bin/env python3
import sys
import re
tre = r"^(?P<function>[^\s]+)\s+\((?P<device>[0-9a-fA-F:\.]+):region(?P<region>[0-9]+)\+(?P<offset>(0x)?[0-9a-fA-F]+),\s(?P<arg1>(0x)?[0-9a-zA-Z]+)(,\s(?P<arg2>(0x)?[0-9a-zA-Z]+))?\)(\s=\s(?P<ret>(0x)?[0-9a-zA-Z]+))?$"
str_to_int = lambda x: int(x)
str_to_hex = lambda x: int(x, 16)
def extract_bits(v, o, c=1):
@benagricola
benagricola / database-definition.yaml
Last active July 14, 2022 13:46
Crossplane provider-aws and provider-sql integration example
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
labels:
res.company.io/purpose: database-instance
res.company.io/provider: aws
database.res.company.io/instance-engine: rds-postgres
database.res.company.io/cluster-type: standalone
name: database-instance-aws-rds-standalone
spec:
@benagricola
benagricola / log.txt
Last active September 16, 2020 16:49
Broken aws-cdk Cloudfront Distribution when referencing an S3 bucket from another stack
➜ cdk ✗ BROKEN=awwyiss cdk synth --app "npx ts-node test-stack.ts"
cdk/node_modules/@aws-cdk/core/lib/stack.ts:691
throw new Error(`'${target.node.path}' depends on '${this.node.path}' (${cycle.join(', ')}). Adding this dependency (${reason}) would create a cyclic reference.`);
^
Error: 'buckets' depends on 'distribution' (buckets -> distribution/web-distribution/Origin1/S3Origin/Resource.S3CanonicalUserId). Adding this dependency (distribution -> buckets/bucket/Resource.RegionalDomainName) would create a cyclic reference.
at DistributionStack._addAssemblyDependency (cdk/node_modules/@aws-cdk/core/lib/stack.ts:691:13)
at Object.addDependency (cdk/node_modules/@aws-cdk/core/lib/deps.ts:52:20)
at DistributionStack.addDependency (cdk/node_modules/@aws-cdk/core/lib/stack.ts:448:5)
at resolveValue (cdk/node_modules/@aws-cdk/core/lib/private/refs.ts:102:12)
@benagricola
benagricola / s3ql_install-centos7.sh
Last active March 20, 2019 13:15 — forked from scottames/s3ql_install-centos7.sh
s3ql - centos 7 install
#!/usr/bin/env bash
#
## Install s3ql on centos 7 machine
### https://bitbucket.org/nikratio/s3ql/
# yum packages
sudo yum install -y epel-release
sudo yum install -y \
bzip2 \
git \
fuse \
<?php
/**
* Class X_Io_File
*/
class X_Io_File extends Varien_Io_File {
/**
* @return void
*/
@benagricola
benagricola / 0_get_bgp.yml
Last active July 3, 2017 15:39
junos_command module does not return parsed XML object
- name: Get BGP Neighbor Info
hosts: all
gather_facts: False
connection: local
tasks:
- name: Get BGP Peers
junos_command:
rpcs:
- "get-bgp-summary-information"
display: xml
@benagricola
benagricola / hook-cot.py
Created June 22, 2017 16:51
One-File, redistributable Scrapy based Crawler, using pyinstaller. Generate binary using pyinstaller scrape.spec
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
# This hooks the scrapy project 'cot' to import all submodules, change name to match scrapy project
hiddenimports = (collect_submodules('cot'))

Keybase proof

I hereby claim:

  • I am benagricola on github.
  • I am benagricola (https://keybase.io/benagricola) on keybase.
  • I have a public key ASDAOij939_OvDosgdcagrYc05hIcl90KgzflKn7aGj7Gwo

To claim this, I am signing this object: