Skip to content

Instantly share code, notes, and snippets.

View elijahparker's full-sized avatar

Elijah Parker elijahparker

View GitHub Profile
@elijahparker
elijahparker / parse-sony-9209.c
Last active September 13, 2016 03:13
A little program for parsing the data returned by the 0x9209 opcode with Sony cameras via USB PTP
#include <stdio.h>
#include <stdint.h>
#include <string.h>
//uint8_t data9209[] = {0x7B, 0x04, 0x00, 0x00, 0x02, 0x00, 0x09, 0x92, 0x2D, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x50, 0x02, 0x00, 0x01, 0x01, 0x02, 0x10, 0x02, 0x05, 0x00, 0x02, 0x03, 0x04, 0x10, 0x13, 0x05, 0x50, 0x04, 0x00, 0x01, 0x01, 0x02, 0x00, 0x04, 0x00, 0x02, 0x0F, 0x00, 0x02, 0x00, 0x04, 0x00, 0x11, 0x80, 0x10, 0x80, 0x06, 0x00, 0x01, 0x80, 0x02, 0x80, 0x03, 0x80, 0x04, 0x80, 0x07, 0x00, 0x30, 0x80, 0x12, 0x80, 0x20, 0x80, 0x21, 0x80, 0x22, 0x80, 0x07, 0x50, 0x04, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0x01, 0x00, 0x0A, 0x50, 0x04, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x00, 0x02, 0x08, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x80, 0x05, 0x80, 0x08, 0x80, 0x06, 0x80, 0x07, 0x80, 0x0B, 0x50, 0x04, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x00, 0x02, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x80, 0x0C, 0x50, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x0A, 0x00
@elijahparker
elijahparker / upverter-fix.js
Created December 29, 2015 16:50
fix imported schematic grid alignment issues in Upverter
function fixUpverterFile(filename) {
try {
var upverterDoc = JSON.parse(fs.readFileSync(filename).toString());
var grid = 10;
var changes = fixUpverterSchematicGrid(upverterDoc, grid);
var newName = filename.replace(".upv", "") + "-fixed.upv";
return {
success: changes !== false,
newName: newName,
fileContents: JSON.stringify(upverterDoc)