Skip to content

Instantly share code, notes, and snippets.

@atx
atx / dpssigrokcal.py
Last active June 17, 2020 20:31
Hacky script which combines `sigrok-cli` and `dpsctl.py` to calibrate OpenDPS. Will likely need modifications before use. Note: The current calibration is currently untested, it looks like the DPS needs nonzero load resistor in order to measure current and I do not have any at hand.
#! /usr/bin/env python3
import argparse
import subprocess
import pathlib
import time
import scipy.stats
import numpy as np
@atx
atx / hspbatt.py
Last active October 21, 2019 20:59
Hacky way of displaying headset battery level by sniffing the raw bluetooth traffic and dumping it to a file
#! /usr/bin/env python3
import argparse
import pathlib
import pyshark
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output", type=lambda s: pathlib.Path(s).expanduser(), required=True)
@atx
atx / main.py
Created August 1, 2019 11:50
Hacky script to export Mozilla webthings gateway values to influxdb
#! /usr/bin/env python3
import argparse
import asyncio
import configparser
import datetime
import influxdb
import json
import pathlib
import requests
@atx
atx / __README.md
Last active August 29, 2023 22:17
My grafana dashboard for prometheus-tor_exporter

Don't forget to modify the __inputs key to match your data source setup. You should also replace the string your.instance.here with the instance name associated with your metrics.

@atx
atx / makekeyboardpcb.py
Created July 22, 2018 10:54
Script which eats JSONs from http://www.keyboard-layout-editor.com/ and spits out a KiCad PCB
#! /usr/bin/env python2
from __future__ import print_function, with_statement, division, generators
import argparse
import collections
import json
import pcbnew
@atx
atx / spiceresize.sh
Created July 13, 2018 14:12
Hacky script to support automatic screen resize with virt-manager VMs with arbitrary window manager (see https://bugzilla.redhat.com/show_bug.cgi?id=1352226 for details )
#! /bin/bash
if ! pgrep -u $(whoami) spice-vdagent; then
echo "Starting vdagent"
spice-vdagent
fi
INTERVAL=1
while true; do
@atx
atx / fixchiselvcd.py
Last active June 30, 2018 16:08
Script that filters VCD files produced by chisel in order to make it load in PulseView (EDIT: This does not seem necessary for the newest git version of sigrok)
#! /usr/bin/env python3
import argparse
import pathlib
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", type=pathlib.Path, required=True)
parser.add_argument("-o", "--output", type=pathlib.Path, required=True)
@atx
atx / upload.py
Created December 5, 2017 21:58
Quick hacky way to get Gadgetbridge exported data to InfluxDB
#! /usr/bin/env python3
import argparse
import datetime
import influxdb
import sqlite3
if __name__ == "__main__":
parser = argparse.ArgumentParser()
@atx
atx / README.md
Last active January 27, 2018 19:24 — forked from anonymous/README.md
Script for KBT Pure Pro firmware flashing

kbtflash

Some time ago, I reversed the protocol used by KBT Pure Pro for flashing its firmware in a hope of being able to flash a custom firmware (or do some BadUSB demonstration). This script is able to upload a firmware binary onto the keyboard.

The binary is obfuscated (already solved on SE) However, the firmware has a 32-bit checksum (at the end of the image), which does not seem to be any of the commonly used ones (there is this) (EDIT: Actually turned out to be a standard one, see edit below). If the uploaded firmware checksum does not match, the keyboard stays in the bootloader.

@atx
atx / build-orangepipc-gentoo.py
Last active November 17, 2023 19:41
Script for building a Gentoo image for the Allwinner H3, use at your own risk
#! /bin/bash
# This script builds a Gentoo image for the Allwinner H3
# Based on http://linux-sunxi.org/H3_Manual_build_howto
# Tested on Orange Pi PC
set -e
function green {
echo -e '\033[0;32m'$@'\033[0m'