Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Backtrace
  • Dallas, TX
View GitHub Profile
@cstrahan
cstrahan / SolarInfo.cs
Created January 6, 2011 05:06
A sunrise/sunset calculator.
using System;
using System.Diagnostics;
namespace SunriseCalculator
{
public class SolarInfo
{
public double SolarDeclination { get; private set; }
public TimeSpan EquationOfTime { get; private set; }
public DateTime Sunrise { get; private set; }
@cstrahan
cstrahan / README.md
Created June 8, 2011 23:06
Windows HLLAPI bindings in Ruby (via FFI)
@cstrahan
cstrahan / MapKata.txt
Created July 12, 2011 17:51 — forked from mattflo/MapKata.txt
Map Kata
Map Kata
========
* Given a simple grid, e.g. 10x10
* Given a game piece is placed somewhere on the grid, e.g. 5,5
* Given the piece canNOT be moved diagonally, e.g. one up, one left...
* Find all available squares the piece can move to in
** 1 move
** 2 moves
** etc...
** until you are thrilled with your solution or ready for something new
@cstrahan
cstrahan / UAC.rb
Created August 27, 2011 04:27
This can be used on Windows to determine if UAC is enabled, and whether the current process is elevated.
# Author: Charles Strahan
#
# This can be used on Windows to determine if UAC is enabled,
# and whether the current process is elevated.
require 'ffi'
require 'win32/registry'
module UAC
@cstrahan
cstrahan / build_emacs_tags.rb
Created October 11, 2011 02:46
Build Emacs TAGS files
#!/usr/bin/env ruby
# This script will build the TAGS files
# for any installed Emacs.
# Make sure you hae the elisp sources installed.
# (On Ubuntu, that would be the `emacs23-el' package)
require 'fileutils'
include FileUtils
#!/usr/bin/env bash
#
# Supported Operating Systems:
#
# - Arch Linux
# - RedHat Based (CentOS, ...)
# - Debian Based (Ubuntu, ...)
#
@cstrahan
cstrahan / sudoku_board.rb
Created January 15, 2012 04:56
A Sudoku solver written in Ruby.
# Author: Charles Strahan
# License: The MIT License
class SudokuBoard
attr_reader :cells
attr_reader :size
def initialize(puzzle=nil)
self.puzzle = puzzle if puzzle
end
@cstrahan
cstrahan / airports.rb
Created March 2, 2012 23:15
The A* algorithm, applied to finding airports routes with a given maximum leg distance.
# About:
# A flight planning algorithm, particularly useful for private pilots.
# The idea is that one might be interested in, say, flying into LED (in Russia)
# from DCA (in DC); bearing in mind that small aircraft can only go so far
# on a single tank of gas, this algorithm will perform the hard work of
# computing a rather tricky route.
#
# Concretely:
# Given a set of airports (and their code, latitude and longitude),
# find the shortest route between any given airport A and B,
@cstrahan
cstrahan / notes.md
Created March 3, 2012 19:18
Notes on "Hackers and Poets"

Requirements

For each chapter:

  1. Summarize the chapter ( 1+ bullets )
  2. What was one idea that surprised or stood out to you? Why? ( 2-4 sentences )
  3. What was a question that you saw as unanswered? ( 1-2 sentences )
  4. Did you have any objections or disagreements? ( 1-2 sentences)
  5. What were your key take aways or things you want to remember? ( 1+ bullets )
@cstrahan
cstrahan / gist:1975217
Created March 4, 2012 22:49
Emacs Sr Speedbar
(require 'sr-speedbar)
(setq speedbar-frame-parameters
'((minibuffer)
(width . 40)
(border-width . 0)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(unsplittable . t)
(left-fringe . 0)))