Skip to content

Instantly share code, notes, and snippets.

@w7dup
w7dup / diff.go
Created April 20, 2013 15:03
Go: Working through the diff algorithms from Myers "An O(ND) Difference Algorithm and Its Variations"
package main
import "fmt"
/*******************************************************************************
* Reference:
* An O(ND) Difference Algorithm and Its Variations
* Eugene W. Myers
*******************************************************************************/
@w7dup
w7dup / simple-forth
Last active December 16, 2015 08:19
Exercise with Go. A super simple forth/four function integer RPN calculator.
package main
import (
"bytes"
"fmt"
"io"
"strconv"
"strings"
)
@w7dup
w7dup / KMP
Last active December 16, 2015 06:48
Working though the Knuth-Morris-Pratt algorithm.
package main
import "fmt"
//naive approach
func inStr(s, w string) int {
pos, i := 0, 0
for pos+i < len(s) {
//fmt.Printf("%x: s[%x+%x] == w[%x] / %c == %c\n", pos, pos, i, i, s[pos+i], w[i])
if s[pos+i] == w[i] {
@w7dup
w7dup / WOL.pde
Created January 8, 2012 06:43
Simple web server for Nanode v5 that also provides Wake-On-LAN broadcast on network segment in response to a HTTP request. This provides a route-able way to start a server on another network segment.
// Simple web server for Nanode v5 that also provides Wake-On-LAN broadcast on
// network segment in response to a HTTP request. This provides a route-able
// way to start a server on another network segment.
// 2012-01-07 <matthew@densons.org> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
#include <NanodeUNIO.h>
// ethernet mac address - must be unique on your network
static byte mymac[6];