Skip to content

Instantly share code, notes, and snippets.

View branw's full-sized avatar
🐠
<º)))><

Brandon W branw

🐠
<º)))><
View GitHub Profile
@branw
branw / zr-batch-simulate.md
Last active August 29, 2015 14:10
A bookmarklet JavaScript snippet to automate the process of running several simulations in the Zero Robotics 2014-15 IDE and averaging their scores.

zr-batch-simulate.js

A bookmarklet JavaScript snippet to automate the process of running several simulations in the Zero Robotics 2014-15 IDE and averaging their scores.

Usage

Through a bookmark

  1. Copy the contents of bookmarklet.js below
  2. In a new bookmark, type javascript: followed by the copied text if bookmarklet.js; save the bookmark
@branw
branw / waterbears-3d-2015.cpp
Last active June 16, 2018 18:29
Submission for 3D round of SpySPHERES 2015-16 ZeroRobotics competition
/*
* _ _____ _____________ ___ _______ ___ ____
* | | /| / / _ |_ __/ __/ _ \/ _ )/ __/ _ | / _ \/ __/
* | |/ |/ / __ |/ / / _// . _/ _ / _// __ |/ . _/\ \
* |__/|__/_/ |_/_/ /___/_/|_/____/___/_/ |_/_/|_/___/
*
* ZEROROBOTICS 2015-16 SPYSPHERES 3D
*/
/*
#!/usr/bin/env python3
from collections import OrderedDict
from pprint import pprint
from struct import unpack
import io
import os
def read_byte(data):
return data.read(1)
@branw
branw / libil2cpp_0.29.3.idc
Created July 31, 2016 01:47
An IDC script for naming public, transpiled functions in libil2cpp.so of Pokemon GO 0.29.3. This assumes that the image is based at 0x9FE48000
This file has been truncated, but you can view the full file.
#include <idc.idc>
static main() {
MakeName(0xa02dd94c, "Music::ctor_");
MakeName(0xa02dd964, "Music::Play_");
MakeName(0xa0acdcac, "Music::Equals_");
MakeName(0xa0bcc6f4, "Music::Finalize_");
MakeName(0xa0acddb8, "Music::GetHashCode_");
MakeName(0xa0acdb7c, "Music::ToString_");
MakeName(0xa02dda5c, "MusicService::ctor_");
@branw
branw / .md
Created August 11, 2016 21:26
0000015638B96885_GAME_MASTER (Pokemon GO 0.31.0-2016073000) dumps

Pokemon GO Game Master Client Templates

The following dump was obtained from the cached GetGameMasterClientTemplatesOutProto message of Pokemon GO version 0.31.0-2016073000. The commands were used on a 0000015638B96885_GAME_MASTER file extracted from the app's data, using POGOProtos@3682394:

$ xxd  -p 0000015638B96885_GAME_MASTER | tr -d '\n' > 0000015638B96885_GAME_MASTER.hex
$ protoc --decode_raw < 0000015638B96885_GAME_MASTER > 0000015638B96885_GAME_MASTER.decoded_raw
$ protoc POGOProtos/src/POGOProtos/Networking/Responses/DownloadItemTemplatesResponse.proto --proto_path=POGOProtos/src --decode=POGOProtos.Networking.Responses.DownloadItemTemplatesResponse < 0000015638B96885_GAME_MASTER > 0000015638B96885_GAME_MASTER.decoded
@branw
branw / .md
Created August 11, 2016 21:40
0000015667288517_GAME_MASTER (Pokemon GO 0.33.0-2016080700) dumps

Pokemon GO Game Master Client Templates

The following dump was obtained from the cached GetGameMasterClientTemplatesOutProto message of Pokemon GO version 0.33.0-2016080700. The commands were used on a 0000015667288517_GAME_MASTER file extracted from the app's data, using POGOProtos@3682394:

$ xxd  -p 0000015667288517_GAME_MASTER  | tr -d '\n' > 0000015667288517_GAME_MASTER .hex
$ protoc --decode_raw < 0000015667288517_GAME_MASTER  > 0000015667288517_GAME_MASTER .decoded_raw
$ protoc POGOProtos/src/POGOProtos/Networking/Responses/DownloadItemTemplatesResponse.proto --proto_path=POGOProtos/src --decode=POGOProtos.Networking.Responses.DownloadItemTemplatesResponse < 0000015667288517_GAME_MASTER  > 0000015667288517_GAME_MASTER .decoded
classdef BatBot
% BATBOT is a client for NI-based BatBots
%
% PROPERTIES
% - VERSION (const) - Application version number
% - Hostname - Network address of the server
%
% METHODS
% - collectData - Run a task with given parameters and return the
% collected data
@branw
branw / goose.cpp
Last active September 17, 2018 19:18
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
// 1.6 MHz is the max frequency of the DAC, so it's easiest
// just to scale everything off of it
const int freq = 1.6e6;
// Duration of a single chirp
const double chirp_duration = 15E-3;
@branw
branw / due.cpp
Created September 8, 2018 17:37
digitalWrite() but without the overhead
namespace detail {
template<char port, int pin>
constexpr int get_pin() {
// In an ideal world, we could do something like this:
// return digitalPinToPort(pin) == port ? (1 << digitalPinToBitMask(pin)) : 0;
// But alas, C++11's constexpr support is very limited
return (port == 'A' && pin == 69) ? (1 << 0) :
(port == 'A' && pin == 68) ? (1 << 1) :
(port == 'A' && pin == 61) ? (1 << 2) :
(port == 'A' && pin == 60) ? (1 << 3) :
@branw
branw / mega.cpp
Last active September 20, 2018 18:31
#include <Arduino.h>
#include <BasicStepperDriver.h>
const int EAR_DIR = 48, EAR_STEP = 46, EAR_ENABLE = 62; // Z
const int EAR_02_DIR = 28, EAR_02_STEP = 26, EAR_02_ENABLE = 24; // E0
const int NOSE_UP_DIR = 34, NOSE_UP_STEP = 36, NOSE_UP_ENABLE = 30; // E1
const int NOSE_01_DIR = A7, NOSE_01_STEP = A6, NOSE_01_ENABLE = A2; // Y (left)
const int NOSE_02_DIR = A1, NOSE_02_STEP = A0, NOSE_02_ENABLE = 38; // X (right)
const int MOTOR_STEPS = 150;