Skip to content

Instantly share code, notes, and snippets.

View duanebester's full-sized avatar

Duane duanebester

View GitHub Profile
@duanebester
duanebester / opengl_test
Last active November 1, 2016 15:11
Making shapes
/*
Makefile:
CC = g++
CFLAGS = -Wall
PROG = basicshapes
SRCS = main.cpp
@duanebester
duanebester / joystick-demo.go
Created May 6, 2014 23:39
Go Write Random Bytes to Serial Port
package main
import (
"github.com/tarm/goserial"
"log"
"flag"
"math/rand"
. "time"
)
@duanebester
duanebester / serial-read.go
Last active September 15, 2023 11:20
Quick read of serial port in Go
package main
import (
"bufio"
"flag"
"fmt"
"github.com/tarm/goserial"
"log"
"os"
)
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/usb.h"
#include "usblib/usblib.h"
#include "usblib/usblibpriv.h"
#include "usblib/device/usbdevice.h"
#include "usblib/usbhid.h"
#ifndef __USBDHIDGENERIC_H__
#define __USBDHIDGENERIC_H__
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
@duanebester
duanebester / Indexer.scala
Last active August 29, 2015 14:19
Indexer Fun
class Indexer(sentences : List[String]) {
// Let's pre-process the words for thousands of calls
val sentenceList = sentences.map(words(_))
def find(key: String) {
for {
sentence <- sentenceList
count = sentence.count{ _.equalsIgnoreCase(key) } if count > 0
debug = sentence.mkString(" ")
import java.io.ByteArrayInputStream
import javax.xml.parsers.DocumentBuilderFactory
import org.w3c.dom._
val factory = DocumentBuilderFactory.newInstance()
val builder = factory.newDocumentBuilder();
val content = """<start>
<div id="header_nav">
<div class="avatar">
<img width="40" />
@duanebester
duanebester / Code.gs
Last active August 29, 2015 14:21
Gmail filtering into google Spread Sheet
function createHeaders(sheet) {
// The SpreadSheet headers
var headers = ["Subject", "First Message From", "First Message Date",
"Message Count", "Last Message Date", "Have we replied?"];
// Let's give the columns some info
sheet.appendRow(headers);
// Bold the first row for the headers
@duanebester
duanebester / Merge.sc
Last active August 29, 2015 14:22
Merge Enumerations In Scala Worksheet
import java.util.Enumeration
class Merge(a:Enumeration[Integer], b:Enumeration[Integer]) extends Enumeration[Integer]
{
/**
* Checks to see if either Enumeration has any elements
* @return true if either input Enumeration has an element
* false if both Enumerations have no elements
*/
override def hasMoreElements: Boolean = {
@duanebester
duanebester / MessageOnlyWindow.cs
Created July 1, 2015 19:18
Message Only Window C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace MyAPI
{