Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Heavers heaversm

View GitHub Profile
@heaversm
heaversm / accel.ino
Created Mar 19, 2018
Arduino Code to use the accelerometer of a LightBlue Bean to act as mouse x and y coordinates via HID
View accel.ino
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 Mar 20, 2018
Arduino sketch to handle input from a grove push button, light up an LED bar, and send messages via HID to Slack
View led_slack_messenger.ino
/*
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
Pix2Pix image processing commands with ImageMagick and Montage
View pix2pix-imagemagick.md

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
Google Quickdraw D3 SVG Viewer
View quickdraw-d3.html
<!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 Oct 26, 2018
A script for rotating a game object around its Y axis in Unity using OSCSimpl
View CubeScript.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeScript : MonoBehaviour {
public OscIn oscIn;
public GameObject go;
private float receivedVal;
View font-regressor
// 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 Dec 13, 2018
Query the Portland Oregon Trimet Arrivals by Stop
View trimet-arrivals-by-stop
const $arrivals = $('.arrivals');
let arrivalInterval;
window.onload = function(){
getArrivals();
pollForArrivals();
}
pollForArrivals = function(){
arrivalInterval = setInterval(getArrivals,60000);
@heaversm
heaversm / trimet-next-arrival.ino
Created Dec 14, 2018
Getting the arrival API data for a specific stop on the Portland Trimet bus network, and lighting up an LED strip with the number of minutes before a bus arrives
View trimet-next-arrival.ino
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <TimeLib.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Adafruit_NeoPixel.h>
//WIFI
const char* ssid = "[MY_SSID]";
@heaversm
heaversm / OpenCvCameraManager.h
Created Mar 6, 2019
opencvcameramanager header
View OpenCvCameraManager.h
#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>
View OpenCvCameraManager.mm
#import "OpenCvCameraManager.h"
#import <React/RCTBridge.h>
#import <opencv2/videoio/cap_ios.h>
using namespace cv;
@implementation OpenCvCameraManager
@synthesize camera, img, cameraId;