Skip to content

Instantly share code, notes, and snippets.

View MZachmann's full-sized avatar

Mark Zachmann MZachmann

  • Chapel Hill, NC
View GitHub Profile
@MZachmann
MZachmann / Main.ino
Created December 1, 2016 16:09
Photon Source for REST Controller
// include the HttpClient code so we can send REST commands
#include "HttpClient.h"
// -----------------------------------------------
// Defines
// -----------------------------------------------
// turn this on to usb test
#define USE_DUMMY 0
// for now hardcode IR and temperature sensors to a 4-count
#define num_sense 4
@MZachmann
MZachmann / lampservice.ts
Created December 4, 2016 18:20
Angular2 Lamp Service Code
import { Http, Headers, ConnectionBackend, BaseRequestOptions, Response, ResponseOptions } from '@angular/http';
import { Observable } from 'rxjs';
import { Injectable, Inject } from '@angular/core';
export class Lamp{
public name : string;
public address : string;
public deviceClass : string;
public type : string;
public bright : string;
@MZachmann
MZachmann / Smidgen.groovy
Created December 4, 2016 22:49
A chunk of the ISY994 <-> SmartThings code
// Fourth GUI Page
// This page has no data entry. Its just a placeholder where we wait for the Nodes to be polled
// and then enumerated
def nodePage() {
printDebug "*****Running node page"
def nodes = getNodes()
// turn off the ssdp searcher here
stopSubscribing()
/// <summary>
/// DirectShow definitions pulled from the headers
/// </summary>
using System;
namespace MFModels
{
// See CppSDK\SDK\include\shared\ksmedia.h
// typedef enum {
// KSPROPERTY_CAMERACONTROL_PAN, // RW O
@MZachmann
MZachmann / EventWait.cs
Last active October 6, 2018 23:23
A Method that waits for an Event to trigger or a timeout.
using System.Threading;
using System.Windows.Threading;
/// <summary>
/// Wait for an Event to trigger or for a timeout
/// </summary>
/// <param name="eventHandle">The event to wait for</param>
/// <param name="timeout">Maximum time to wait</param>
/// <returns>true if the event triggered, false on timeout</returns>
private bool WaitForEvent(EventWaitHandle eventHandle, TimeSpan timeout)
@MZachmann
MZachmann / BitmapFontHelpers.py
Last active February 6, 2022 23:48
Python Code For Bitmap Font Translation
# this is a set of functions to convert from a bitmap image and fnt to
# C++ compatible data streams for use by LargeFont
import png
# This requires a variable named font, which is the font name font='Arial11'
Basepath = '/users/mark/my documents/'
font = 'Arial11'
ClipPng(font)
FntToInfo(font)
# -------------------------------------------------------
@MZachmann
MZachmann / PycomConsoleEntry.py
Last active February 22, 2018 14:12
Create boot.py for a Pycom LoPy
def addmore() :
boottxt='''
# boot.py -- run on boot-up
import os
import time
from network import WLAN
from machine import UART
uart = UART(0, 115200)
os.dupterm(uart)
wlan = WLAN() # get current object, without changing the mode
@MZachmann
MZachmann / QuickMail.py
Created March 16, 2018 01:41
Trivial send mail example to show Raspberry PI -> GMail
import smtplib
# start talking to the SMTP server for Gmail
s = smtplib.SMTP(‘smtp.gmail.com’, 587)
s.starttls()
s.ehlo()
# now login as my gmail user
username=’myname’
password=’mypassword’
s.login(username,password)
# the email objects
@MZachmann
MZachmann / LoraPingPong.ino
Last active March 16, 2018 02:13
LoRa High Level Examples using LightLora
include "LoraUtil.h"
unsigned long _SendTime = 0;
unsigned long _SendInterval = 10000; // 10 seconds allowed for send
int packetnum = 0; // packet counter
setup()
{
_Lru = new LoraUtil();
}
@MZachmann
MZachmann / TransmitTest.grc
Last active April 24, 2019 00:00
Gnu Radio Definition for Transceiver Testing
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.11'?>
<flow_graph>
<timestamp>Tue May 8 09:47:18 2018</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>