Skip to content

Instantly share code, notes, and snippets.

View trishume's full-sized avatar

Tristan Hume trishume

View GitHub Profile
@trishume
trishume / keybase.md
Created October 2, 2014 20:25
Keybase Proof

Keybase proof

I hereby claim:

  • I am trishume on github.
  • I am thume (https://keybase.io/thume) on keybase.
  • I have a public key whose fingerprint is FF73 AF0E EB29 A514 0316 3DFE BE54 21FC B054 2047

To claim this, I am signing this object:

@trishume
trishume / plus.idr
Last active August 29, 2015 14:06
Peano Proofs in Idris
-- Idris Proof for Commutativity of Addition + Lemmas
-- By Tristan Hume
-- Citations:
-- https://github.com/idris-lang/Idris-dev/wiki/Manual (learning proof techniques)
-- http://rosettacode.org/wiki/Proof#Idris (Example proofs with Peano numbers)
module Plus
-- Enable totality checker. Proofs are only correct if functions
-- always terminate with a result for all inputs.
@trishume
trishume / gem.md
Created June 14, 2014 20:29
Ruby Gem Presentation

Creating a gem in 10m

First we will create a new gem scaffold using the bundler gem that comes with Ruby.

$ bundle gem tofu
$ cd tofu
$ subl .

Now we can edit the gemspec file to add metadata to our gem.

@trishume
trishume / slate.js
Created December 14, 2013 13:15
My newer javascript based Slate configuration.
S.log("-- Starting config --");
S.cfga({
defaultToCurrentScreen : true,
nudgePercentOf : "screenSize",
resizePercentOf : "screenSize",
// "keyboardLayout" : "dvorak",
"secondsBetweenRepeat" : 0.1,
"checkDefaultsOnLoad" : true,
"focusCheckWidthMax" : 3000,
"windowHintsShowIcons" : true,
@trishume
trishume / art_gen.py
Created December 9, 2013 21:30
My Math Summative Program. Requires matplotlib, Numpy, Pillow and Latex to render the tex documents. Create the output folder before running.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import math
import string
import sys
import matplotlib.pyplot as plt
from PIL import Image
import random
from bisect import bisect_left, bisect, insort
@trishume
trishume / econ_elasticity.rb
Created September 30, 2013 00:03
Doing my economics homework with a simple Ruby program.
# Econ Elasticity Program - By Tristan Hume
#
# When this program is run with the Ruby language interpreter
# it shows a prompt where calculations can be run.
# Some examples:
# >> cross_elasticity(8, 12, 6000, 8000)
# => 0.714
# >> set_demand2(22,11)
# Setting demand with slope -2.0 and y-int 22
# >> data
@trishume
trishume / liquid_shell.rb
Created August 30, 2013 21:03
Liquid Templating Language REPL
require 'liquid'
require 'readline'
require 'colorize'
$state = {'test' => 5, 'wat' => "yup"}
def eval_liquid(str)
temp = Liquid::Template.parse(str)
temp.render($state)
end
@trishume
trishume / tmux.conf
Created June 6, 2013 23:55
My tmux config
## keybindings
unbind %
unbind ,
unbind .
unbind n
unbind p
unbind [
unbind '"'
unbind l
unbind &
@trishume
trishume / golf.hs
Created May 10, 2013 00:32
Haskell code golf Leibniz PI approximation
-- Ruby Solution
gets.to_i.times{puts (0..gets.to_i-1).map{|i|(-1)**i/(2*i+1).to_f}.inject(:+)}
-- Umpteen Haskell solutions, semicolons replace newlines for length comparison
-- Crashes on second test case but really short
l=readLn>>=(\n->print.sum$[(-1)**i/(2*i+1)|i<-[0..n-1]])>>l;main=getLine>>l
-- Working ones
l n=show.sum$[(-1)**i/(2*i+1)|i<-[0..n-1]];main=interact$unlines.(map$l.read).tail.lines
@trishume
trishume / robot.js
Created December 5, 2012 22:21
NINJAX!
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);