Skip to content

Instantly share code, notes, and snippets.

View deleted's full-sized avatar

Ted Scharff deleted

View GitHub Profile

Keybase proof

I hereby claim:

  • I am deleted on github.
  • I am leted (https://keybase.io/leted) on keybase.
  • I have a public key ASAkKaNeWPqzKVo7rC2QqIlPr-TKYQPL2S2XosWvX6018Ao

To claim this, I am signing this object:

@deleted
deleted / db__db.go
Created September 1, 2017 18:49
go-swagger & gorp models
package db
import (
"database/sql"
"log"
_ "github.com/mattn/go-sqlite3" // registers sqlite driver
gorp "gopkg.in/gorp.v1"
)
// vim:set ft=c:
HardwareSerial uart = HardwareSerial();
int LED_PIN = 11;
int counter = 0;
void setup(){
uart.begin(19200);
Serial.begin(19200);
}
@deleted
deleted / thing.py
Last active December 19, 2015 19:09
import time
import vidplay
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
GPIO.setup(22, GPIO.IN)
GPIO.setwarnings(False)
vidplayer = vidplay.Vidplay()
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#define bit(A) (1 << A)
#define sbi(p,b) { p |= (unsigned char)bit(b); }
#define cbi(p,b) { p &= (unsigned char)~bit(b); }
#define tbi(p,b) { p ^= (unsigned char)bit(b); }
#define gbi(p,b) (p & (unsigned char)bit(b))
//#define BENCHMARK
def statRecursive(node, isRoot=True):
for subnode in node.subnodes:
if subnode.isDirectory:
statRecursive(subnode, False)
else:
GlobalHandler.trigger('result', stat(subnode))
if isRoot:
GlobalHandler.trigger('end_recursion')
@deleted
deleted / input.coffee
Last active December 14, 2015 22:28
I'm starting to think that maybe coffescript is actually okay... I would not have been able to wrap my primitive brain around this regular expression without it's block regex feature.
# An implementation of http://docs.python.org/2/library/string.html#format-specification-mini-language
# WARNING: Not complete.
applyFormat = (value, formatSpec) ->
pattern = ///
([^{}](?=[<>=^]))?([<>]^)? # fill & align
([\+\-\x20])? # sign
(\#)? # integer base specifier
(0)? # zero-padding
(\d+)? # width
# Create a deep copy of an object. - Based on https://github.com/documentcloud/underscore/pull/595
deepClone = (obj) ->
if !_.isObject obj or _.isFunction obj then return obj
if _.isDate obj then return new Date do obj.getTime
if _.isRegExp obj then return new RegExp obj.source, obj.toString().replace(/.*\//, "")
isArr = _.isArray obj or _.isArguments obj
func = (memo, value, key) ->
if isArr then memo.push deepClone value
@deleted
deleted / moon.py
Last active December 10, 2015 00:29
from datetime import date
def phase(m, d, y):
ref_date = date(2012, 1, 23)
our_date = date( y, m, d )
date_delta = our_date - ref_date
days = date_delta.days
phase_length = 29.53
return days % phase_length / phase_length
@deleted
deleted / index.html
Last active October 30, 2015 17:17
Wages vs Number of Jobs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Wages vs. Number of Jobs</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<style type="text/css">
body {
margin: 0;