Skip to content

Instantly share code, notes, and snippets.

@appleguru
appleguru / decode.py
Created October 4, 2017 14:35
Decode UDP streaming data from panda
import struct
import binascii
import csv
with open('output.bin', mode='rb') as file: # b is important -> binary
dat = file.read()
ret = []
for j in range(0, len(dat), 0x10):
ddat = dat[j:j+0x10]
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import time
from collections import defaultdict
import binascii
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
from panda import Panda
@appleguru
appleguru / uvcsnapshot.py
Created May 3, 2019 01:51 — forked from LukeLambert/uvcsnapshot.py
A quick-and-dirty script to grab a JPEG snapshot from a Ubiquiti camera at a specified interval.
#!/usr/bin/env python
"""Grab a JPEG snapshot from a Ubiquiti camera at a specified interval.
Usage: python uvcsnapshot.py -i INTERVAL -c CAMERA -p PASSWORD -o OUTPUT
Required arguments:
-i interval in seconds
-c camera IP address
-p camera password
-o path to output directory
@appleguru
appleguru / github_org_clone.sh
Created November 1, 2019 17:23
Clone all GitHub repos in an organization
curl -u [username] -s https://api.github.com/orgs/[organization]/repos\?per_page=200 | grep -e 'clone_url*' | cut -d \" -f 4 | xargs -L1 git clone
@appleguru
appleguru / repo-rinse.sh
Created March 20, 2020 03:11 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@appleguru
appleguru / mkteslaemmcimg.sh
Last active November 2, 2023 03:24 — forked from wido/mkteslaemmcimg.sh
Tesla Model S/X MCU1 eMMC image creator
#!/bin/bash
#
# Create a 8GB eMMC image for Tesla Model S/X MCU1
#
# Example usage: ./mkteslaemmcimg.sh ./vinXXXXX.img ./develop-2019.20.2.1-16-5659e07dfd.img
#
set -e
FIRMWARE=$2
IMAGE=$1
@appleguru
appleguru / ha-HUSBZB-fw-update.md
Last active January 11, 2023 02:57
Home Assistant HUSBZB-1 firmware update cheatsheet

Home assistant HUSBZB-1 fw update cheatsheet. SSH into your HA machine and then:

ha core stop
git clone https://github.com/walthowd/husbzb-firmware.git && cd husbzb-firmware
pip install pyserial
pip install xmodem
python3 ncp.py scan
python3 ncp.py flash -p /dev/ttyUSB1 -f ncp-uart-sw-6.7.8.ebl
python3 ncp.py scan