Skip to content

Instantly share code, notes, and snippets.

View enkrates's full-sized avatar

William Sullivan enkrates

View GitHub Profile
@enkrates
enkrates / revolution.php
Created October 19, 2013 02:51
A very simple bit of PHP to follow a coding challenge.
<?php
$url = 'http://letsrevolutionizetesting.com/challenge?id=756775492';
do {
echo "following the json\n";
$json = file_get_contents($url . '&format=json');
$data = json_decode($json);
$url = isset($data->follow) ? $data->follow : NULL;
} while ( isset($data->follow) );
@enkrates
enkrates / invoices.rb
Created March 16, 2012 21:41 — forked from mokolabs/invoices.rb
archive your slicehost invoices
require 'rubygems'
require 'mechanize'
a = Mechanize.new { |agent|
agent.follow_meta_refresh = true
agent.pluggable_parser.pdf = Mechanize::FileSaver
}
a.get('https://manage.slicehost.com/') do |home_page|
@enkrates
enkrates / utcs.rb
Created September 4, 2011 15:11
A quick script to automatically choose the UTCS 32-bit server with the lowest current load
#! /usr/bin/env ruby
# This script is pretty fragile in that it will break if the UTCS
# lab status page changes its HTML in a fairly small way. So far,
# it works great.
# It requires nokogiri (gem install nokogiri).
# I have my user name set automatically with my ssh-config file, so
# it doesn't figure into the ssh command below. Later, I might either
@enkrates
enkrates / gist:1134773
Created August 9, 2011 18:18 — forked from rajiv/gist:957181
version control info in your bash shell prompt
# based on http://pastie.org/230805
# and http://gist.github.com/3829/
# from http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
_bold=$(tput bold)
_normal=$(tput sgr0)
__vcs_dir() {
local vcs base_dir sub_dir ref
class Polynomial
def initialize array
if array.length < 2
raise ArgumentError.new('Need at least 2 coefficients')
exit
end
@result = ''