Skip to content

Instantly share code, notes, and snippets.

View rchowe's full-sized avatar

RC Howe rchowe

View GitHub Profile

Keybase proof

I hereby claim:

  • I am rchowe on github.
  • I am rchowe (https://keybase.io/rchowe) on keybase.
  • I have a public key whose fingerprint is 4035 6EF9 A5C7 B19B BA6B A139 320F C984 0C5F 311A

To claim this, I am signing this object:

#!/usr/bin/env python
import math
import sys
if len(sys.argv) < 2:
sys.stderr.write('USAGE: {} <number>\n'.format(sys.argv[0]))
sys.exit(1)
N = int(sys.argv[1])
#!/usr/bin/env python
#
# Run the program, then type this in when it asks for your name:
#
# os.system('say hello')
#
import os
name = eval(input('Enter your name: '))
print('Hello, {}'.format(name))
@rchowe
rchowe / load_prices.m
Created November 27, 2013 21:19
Loads prices from blockchain.info's CSV of market prices.
function [ dates, prices, changes ] = load_prices( filename )
% LOAD_PRICES Loads prices from a blockchain.info market-price.txt
% Loads prices from the CSV file provided by blockchain.info at
% http://blockchain.info/charts/market-price
fid = fopen( filename );
raw = textscan( fid, '%s %f', 'delimiter', ',' );
fclose( fid );
@rchowe
rchowe / .bashrc
Created February 3, 2012 02:41
Sample .bashrc
##
## Slightly nicer .bashrc
## Makes pretty colors and stuff
##
## Set $PATH, which tells the computer where to search for commands
export PATH="$PATH:/usr/sbin:/sbin:/bin:/usr/bin:/etc:/usr/ucb:/usr/local/bin:/usr/local/local_dfs/bin:/usr/bin/X11:/usr/local/sas"
## Where to search for manual pages
export MANPATH="/usr/share/man:/usr/local/man:/usr/local/local_dfs/man"
@rchowe
rchowe / gist:1648287
Created January 20, 2012 16:34
Selector-based create for jquery
# Creates an element based on a selector.
# Currently only works for tag, id, and class.
$.fn.create = (selector) ->
# Process the selector string if necessary
if typeof selector is 'string'
# Convenience
class Selector
@rchowe
rchowe / dice.rb
Created August 16, 2011 15:37
Ruby Dice Roller
def roll expression
return [0] if (/^(?<count>\d+)d(?<sides>\d+)(?:s(?<drop>\d+))?$/i =~ expression ).nil?
Array.new( count.to_i, nil ).
map { (Random.rand sides.to_i) + 1 }.
sort.reverse.
take( count.to_i - drop.to_i )
end
expr = "(#{ARGV.join ' '})"; last = ''
#include "WPILib.h"
#include "nr/diag/diagnostics_center.h"
#include "nr/diag/observable_wpi.h"
Jaguar motorA( 1 );
nr::diag::diagnostics_center& diagnostics =
nr::diag::diagnostics_center::get_shared_instance();
diagnostics.register_device( motorA );
@rchowe
rchowe / Visual Novel.hs
Created July 22, 2010 00:48
The same visual novel program as before, but in haskell
module Main (main) where
import System (getArgs)
import System.IO (hFlush, stdout)
-- Runs a novel from a file
runNovel :: String -> IO [()]
runNovel filename = readFile filename >>= (mapM runLine)
. (filter (\x -> not (isBlank x)))
#!/usr/bin/env ruby
=begin
> An interactive novel
> This program parses formatted text files and turns them into an interactive
> novel. Currently, the text files support two types of lines: display lines, or
> lines beginning with a greater than sign. Those lines will be printed out to
> the console. This program also supports prompt lines. These lines will take
> user input and store it in a variable. All other lines are ignored. This file
> can be run as an interactive novel. For completeness, please enter your name