Skip to content

Instantly share code, notes, and snippets.

Kevin Hoyt krhoyt

Block or report user

Report or block krhoyt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@krhoyt
krhoyt / firebase.php
Created Dec 6, 2014
Interact with Firebase from PHP.
View firebase.php
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_DELETE = "temperature.json";
$NODE_GET = "temperature.json";
$NODE_PATCH = ".json";
$NODE_PUT = "temperature.json";
// Data for PUT
@krhoyt
krhoyt / configuration.js
Last active Nov 29, 2019
Get complete list of repos and their respective details for a given GitHub user. Sorted by last updated, ascending. Output to CSV file.
View configuration.js
// Holds pertinent authentiation
module.exports = {
github: {
token: '__your__token__here__'
}
}
@krhoyt
krhoyt / arduino-stomp.ino
Last active Sep 29, 2019
STOMP Implementation for Arduino Yun
View arduino-stomp.ino
// Libraries
#include <Bridge.h>
#include <YunClient.h>
// Defines
// Used for connectivity parameters
#define ENDPOINT "kaazing.kevinhoyt.com"
#define LOGIN " "
#define PASSCODE " "
#define PORT 61613
@krhoyt
krhoyt / blockhash.js
Created May 31, 2017
Image Hashing in the Browser
View blockhash.js
// Original source:
// https://github.com/commonsmachinery/blockhash-js
// Update for local file reading
// Update (loosely) for ES6
// Removes dependencies from origina project
class Blockhash {
constructor() {
this.canvas = document.createElement( 'canvas' );
this.canvas.style.visibility = 'hidden';
this.canvas.style.position = 'absolute';
@krhoyt
krhoyt / async.js
Created Apr 6, 2019
IBM Cloud Function to handle Watson classification of image files placed into Cloud Object Storage.
View async.js
async function main( params ) {
if( params.status === 'added' ) {
const authorization = await rp( {
url: 'https://iam.ng.bluemix.net/oidc/token',
method: 'POST',
form: {
apikey: params.COS_API_KEY,
response_type: 'cloud_iam',
grant_type: 'urn:ibm:params:oauth:grant-type:apikey'
},
@krhoyt
krhoyt / index.html
Created Dec 23, 2017
Tesseract.JS OCR
View index.html
<html>
<head>
<title>Tesseract</title>
<style>
body {
align-items: center;
display: flex;
flex-direction: row;
@krhoyt
krhoyt / index.html
Last active Oct 23, 2018
Canvas ImageData to Web Worker
View index.html
<html>
<head>
<title>Image Processing Worker</title>
<style>
body {
align-items: center;
display: flex;
flex-direction: column;
@krhoyt
krhoyt / browser.js
Created Oct 22, 2018
Upload audio file from web to Watson via Cloud Function.
View browser.js
class Captions {
// Constructor
constructor() {
// Holds audio dialog
this.conversation = [];
// Watson logo
// Used as proxy for file selector
// Allowing for customization of interaction
let watson = document.querySelector( 'button.file' );
@krhoyt
krhoyt / kindle.js
Last active Jul 20, 2018
Parse Kindle Notes (July 2018)
View kindle.js
// Phase 1 - Create additional elements
let dummy = document.createElement( 'textarea' );
document.body.appendChild( dummy );
// Phase 2 - Parse, format, and place on clipboard
// Repeat as needed for each selected book
let notes = document.querySelectorAll( 'span[id=\'highlight\']' );
let pages = document.querySelectorAll( 'span[id=\'annotationHighlightHeader\']' );
let output = '';
@krhoyt
krhoyt / ble.swift
Created Feb 5, 2017
BLE notifications.
View ble.swift
import CoreBluetooth
import UIKit
class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate {
var manager:CBCentralManager!
var peripheral:CBPeripheral!
let BEAN_NAME = "Bean+"
let BEAN_SCRATCH_UUID = CBUUID(string: "a495ff21-c5b1-4b44-b512-1370f02d74de")
You can’t perform that action at this time.