Skip to content

Instantly share code, notes, and snippets.

View andrewpurcell's full-sized avatar

Andrew Purcell andrewpurcell

View GitHub Profile
@andrewpurcell
andrewpurcell / keybase.md
Created February 19, 2018 19:32
keybase verification

Keybase proof

I hereby claim:

  • I am andrewpurcell on github.
  • I am drubi (https://keybase.io/drubi) on keybase.
  • I have a public key ASDBDtd2nT2kuQTyyl3hnyNczz13PlKlUUQM7Xi74kO_Hgo

To claim this, I am signing this object:

@andrewpurcell
andrewpurcell / bst_validate
Created December 21, 2012 06:20
"interview practice" solution for problem: write a function that validates a binary tree
require 'test/unit'
class Node
attr_accessor :val, :left, :right
def initialize val
@val = val
end
def >(other)
@val > other.val
@andrewpurcell
andrewpurcell / tree.md
Created April 24, 2012 00:12 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@andrewpurcell
andrewpurcell / winner.sql
Created April 5, 2012 05:58
select a winner for sentegy
SELECT * FROM
(
SELECT DISTINCT comfortfeedback.PersonID,
COUNT(comfortfeedback.PersonID) as c,
people.name,
people.email
FROM comfortfeedback, people
WHERE comfortfeedback.TimeStamp >= DATE('2012-3-26')
AND people.PersonID = comfortfeedback.PersonID GROUP BY PersonID
) as t1
@andrewpurcell
andrewpurcell / assembler.rb
Created December 19, 2011 16:46
calls mips module
#!/usr/bin/env ruby
require_relative 'mips'
def debug
return false unless ARGV[1].eql? "debug"
true
end
mips = Assembler.new(ARGV[0])
@andrewpurcell
andrewpurcell / mips.rb
Created December 19, 2011 16:45
EE126 MIPS Assembler
#!/usr/bin/env ruby
#
# mips.rb - a class for working with MIPS assembly code
# in ruby. Provides an assembler to translate
# non floating point operations to machine code.
#
# Andrew Purcell, Tufts University
# EE126: Computer Engineering, Fall 2011