Skip to content

Instantly share code, notes, and snippets.

from dataclasses import dataclass
from enum import IntEnum, unique
import hashlib
import os
import struct
import sys
from typing import Optional
if sys.version_info < (3, 11):
from typing_extensions import Self
@warhammerkid
warhammerkid / convert.py
Created December 21, 2024 18:19
Python script for converting cel-spec textproto files to JSON
"""
Setup steps:
- Install protoc
- git clone --depth 1 https://github.com/google/cel-spec.git
- git clone --depth 1 https://github.com/googleapis/googleapis.git
- protoc -Icel-spec/proto -Igoogleapis --python_out=. cel-spec/proto/cel/expr/*.proto cel-spec/proto/cel/expr/conformance/**/*.proto googleapis/google/rpc/status.proto
"""
import glob
import os
@warhammerkid
warhammerkid / simple_polling_example.py
Created March 25, 2023 23:09
Example of Custom Bluetti Polling Script
import asyncio
from bleak import BleakError
import sys
from bluetti_mqtt.bluetooth import (check_addresses, BluetoothClient, ParseError, BadConnectionError)
async def monitor_device(address):
devices = await check_addresses({address})
if len(devices) == 0:
sys.exit('Could not find the given device to connect to')
@warhammerkid
warhammerkid / server.rb
Created October 3, 2022 15:49
Bluetti Prometheus Montior
require 'bigdecimal'
require 'json'
require 'mqtt'
require 'prometheus_exporter'
require 'prometheus_exporter/server'
class MetricsServer
def initialize(broker)
@broker = broker
@warhammerkid
warhammerkid / README.md
Last active December 20, 2024 06:19
Bluetti Bluetooth Logger

This script requires python3.7 or greater.

pip install bleak
pip install crcmod

python3 research_logger.py --scan

python3 research_logger.py --log a-log-file.log 00:11:22:33:44:55

@warhammerkid
warhammerkid / data-pipeline-ami.json
Last active November 8, 2015 21:35
Dataduct AMI
{
"variables": {
"version": "2015-11-08"
},
"builders": [
{
"type": "amazon-ebs",
"name": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-ee146b84",
@warhammerkid
warhammerkid / Parsec v1 Benchmark.rb
Last active August 29, 2015 14:01
Parsec Benchmark
require 'typhoeus'
require 'json'
RAID_GROUP_COUNT = 500
RAID_GROUP_PASSWORD = 'pass'
RAID_USER_COUNT = 8
HOST_NAME = 'parsec.chromedshark.com'
=begin
# Build raid groups
@warhammerkid
warhammerkid / SocketTest.as
Created July 6, 2011 22:56
RocketAMF Socket Example
package {
import flash.display.Sprite;
import flash.net.registerClassAlias;
import org.rackAMF.*;
import flash.net.Socket;
import flash.events.*;
public class SocketTest extends Sprite {
private var socket:Socket;
/*
* Code is almost directly copied from firebug-http-observer.js in the Firebug
* extension
*/
// Constants
const CLASS_ID = Components.ID("{40004b06-77ac-41ef-be0a-cd910679b86e}");
const CLASS_NAME = "GTDInbox Gmail HTTP Observer Service";
const CONTRACT_ID = "@gtdinbox.com/glgmail-http-observer;1";