Skip to content

Instantly share code, notes, and snippets.

View mplewis's full-sized avatar
🐕
柴犬

Matt Lewis mplewis

🐕
柴犬
View GitHub Profile
@mplewis
mplewis / bubblesort-int-list.scm
Created April 3, 2014 10:27
This is a bubblesort algorithm written in Scheme. It sorts a list of integers from least to greatest.
(define (re)
(load "bubblesort-int-list.scm"))
(define (sort-list origlist)
(define (get-first a b)
(if (< a b)
a
b))
(define (get-second a b)
(if (< a b)
@mplewis
mplewis / lastfm-analysis.ipynb.json
Last active August 29, 2015 13:58
Exporting your Last.fm history into an SQLite DB for analysis
{
"metadata": {
"celltoolbar": "Raw Cell Format",
"name": "",
"signature": "sha256:322a2974ad58e39abb5e8cfd03bfb8a7a1dda552cc215255577037e09b5195fc"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
@mplewis
mplewis / Polygon contains point.ipynb
Created April 29, 2014 09:50
Demonstration of polygon contains point algorithm for Usafe use
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var fs = require('fs');
var path = require('path');
var glob = require('glob');
var async = require('async');
var Client = require('./client').Client;
var client = new Client();
function cp2remote(src, dest, callback) {
client.parse(dest);
@mplewis
mplewis / scanner.ino
Last active August 29, 2015 14:01
Analog proximity sensor array scanner code. EE 4951W, Spring 2014, Group 10: Optical Guitar
/* Analog proximity sensor array scanner code
*
* EE 4951W Spring 2014
* Group 10: Optical Guitar
* Advisor: Dr. James Leger
* Group members: Sandra Arnold, Justin Buth, Matthew Lewis, Steffen Moeller, Anh Nguyen
*
* Target device: Teensy 2.0
* Program Teensy 2.0 with this sketch using Arduino software
*/
@mplewis
mplewis / safe_schedule.py
Last active December 19, 2024 08:52
An implementation of Scheduler that catches jobs that fail. For use with https://github.com/dbader/schedule
import logging
from traceback import format_exc
import datetime
from schedule import Scheduler
logger = logging.getLogger('schedule')
queries = {
activities: squel.select()
.from('strava_activities')
.field('name')
.field('type')
.field('start_date')
.field('distance_mi')
.field('pace_mins_per_mi')
.field('polyline')
.order('start_date', false)
@mplewis
mplewis / phant-vis.css
Last active December 6, 2017 14:21
Data logger visualization with Sparkfun's Phant and Highcharts. Licensed under the MIT License.
body {
margin-top: 40px;
margin-bottom: 40px;
}
.chart {
width: 100%;
height: 250px;
margin-top: 10px;
margin-bottom: 10px;
@mplewis
mplewis / PTDIntelHex.h
Last active July 17, 2024 01:38
PTD's Intel Hex helper. This converts Intel Hex into NSData suitable for programming to a Bean. License: The MIT License
#import <Foundation/Foundation.h>
@interface PTDIntelHex : NSObject
@property (nonatomic, strong) NSString* name;
+ (PTDIntelHex*)intelHexFromHexString:(NSString*)hexString;
+ (PTDIntelHex*)intelHexFromFileURL:(NSURL*)file;
- (id)initWithHexString:(NSString*)hexString;
@mplewis
mplewis / watchdiff.py
Last active April 30, 2022 22:32
Watch a single file and output a diff when it changes.
#!/usr/bin/env python3
from diff_match_patch import diff_match_patch
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import sys
import time
from os.path import abspath, dirname