Skip to content

Instantly share code, notes, and snippets.

View DavidBennettPIO's full-sized avatar

David Bennett DavidBennettPIO

View GitHub Profile
@svdamani
svdamani / spline.c
Last active August 19, 2024 07:51
Natural Cubic Spline Interpolation in C
/** Numerical Analysis 9th ed - Burden, Faires (Ch. 3 Natural Cubic Spline, Pg. 149) */
#include <stdio.h>
int main() {
/** Step 0 */
int n, i, j;
scanf("%d", &n);
n--;
float x[n + 1], a[n + 1], h[n], A[n], l[n + 1],
u[n + 1], z[n + 1], c[n + 1], b[n], d[n];
@amiryal
amiryal / spawn_process.rb
Created October 23, 2013 13:35
Wrapper to Ruby spawn() with standard IO capture and basic exception handling.
module SpawnProcess
class NonSuccessStatus < StandardError
attr_accessor :status
def initialize(str, status)
@status = status
super(str)
end
end
def self.do(*args, &block)
@imageaid
imageaid / gist:6100726
Created July 28, 2013 23:35
RubyMine regular expression to convert Ruby 1. hashes to the badass Ruby 1.9+ hashes. Can be used in RubyMine's Find/Replace option on a file.
Find -- :([a-z\_]*) =>
Replace -- $1:
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8