Skip to content

Instantly share code, notes, and snippets.

View heaversm's full-sized avatar

Mike Heavers heaversm

View GitHub Profile
@heaversm
heaversm / accel.ino
Created March 19, 2018 03:33
Arduino Code to use the accelerometer of a LightBlue Bean to act as mouse x and y coordinates via HID
void setup() {
BeanHid.enable();
}
void loop() {
AccelerationReading accel = Bean.getAcceleration();
int16_t x = accel.xAxis;
int16_t y = accel.yAxis;
int16_t z = accel.zAxis;
@heaversm
heaversm / led_slack_messenger.ino
Created March 20, 2018 04:10
Arduino sketch to handle input from a grove push button, light up an LED bar, and send messages via HID to Slack
/*
Grove LED Bar
dec hex binary
0 = 0x0 = 0b000000000000000 = all LEDs off
5 = 0x05 = 0b000000000000101 = LEDs 1 and 3 on, all others off
341 = 0x155 = 0b000000101010101 = LEDs 1,3,5,7,9 on, 2,4,6,8,10 off
1023 = 0x3ff = 0b000001111111111 = all LEDs on
| |
10 1
@heaversm
heaversm / pix2pix-imagemagick.md
Created May 4, 2018 19:01
Pix2Pix image processing commands with ImageMagick and Montage

Image Processing with ImageMagick

Grid of Images to Individual Images

Given a grid of images, generate single images

@heaversm
heaversm / quickdraw-d3.html
Last active May 10, 2018 17:44
Google Quickdraw D3 SVG Viewer
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
@heaversm
heaversm / CubeScript.cs
Last active October 26, 2018 04:14
A script for rotating a game object around its Y axis in Unity using OSCSimpl
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeScript : MonoBehaviour {
public OscIn oscIn;
public GameObject go;
private float receivedVal;
// Copyright (c) 2018 ml5
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
/* ===
ml5 Example
Creating a regression extracting features of MobileNet. Build with p5js.
=== */
@heaversm
heaversm / trimet-arrivals-by-stop
Created December 13, 2018 23:34
Query the Portland Oregon Trimet Arrivals by Stop
const $arrivals = $('.arrivals');
let arrivalInterval;
window.onload = function(){
getArrivals();
pollForArrivals();
}
pollForArrivals = function(){
arrivalInterval = setInterval(getArrivals,60000);
@heaversm
heaversm / OpenCvCameraManager.h
Created March 6, 2019 19:47
opencvcameramanager header
#import <React/RCTViewManager.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <opencv2/videoio/cap_ios.h>
#import "ChordCodeLocator.hpp"
#import "RNTUIImageView.h"
using namespace cv;
@interface OpenCvCameraManager : RCTViewManager<CvVideoCameraDelegate>
#import "OpenCvCameraManager.h"
#import <React/RCTBridge.h>
#import <opencv2/videoio/cap_ios.h>
using namespace cv;
@implementation OpenCvCameraManager
@synthesize camera, img, cameraId;
@heaversm
heaversm / undoArray.js
Created March 10, 2019 00:05
Undo Array Troubleshooting
let data = {}; // Global object to hold results from the loadJSON call
let shapes = []; // Global array to hold all shape arrays of coords
let mousePressedCoords = [];
let mouseReleasedCoords = [];
let isMousePressed = false;
let marqueeIsActive = false; //true when shift key selected
let closestShapeIndex;
let closestCoordIndex;
let mouseMovedX, mouseMovedY, mouseStartX, mouseStartY;
let selectedPoints = [];