Skip to content

Instantly share code, notes, and snippets.

View film42's full-sized avatar
✔️
Verified

Garrett Thornburg film42

✔️
Verified
View GitHub Profile
@film42
film42 / simplex.cs
Created March 20, 2014 03:53
Simplex
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication1 {
class SimplexSolver {
private int[] N; // Indicies of non-basic variables
@film42
film42 / euler_11.clj
Last active August 29, 2015 14:01
Project Euler #11
(ns euler.euler-11
(:require [clojure.string :as s]))
(def grid-data
"Open data from file"
(slurp "files/11.txt"))
(defn- get-grid
"Get the matrix from the slurped text. Break on new lines, then split and parse for Ints"
[]
@film42
film42 / jane-street-rain-collection.clj
Last active August 29, 2015 14:01
An Interview Question from Jane Street: Given some topology, assume it rained and settled, return a new map of the collected rain fall.
(ns rain-topology)
;; An Interview Question from Jane Street:
;; Given some topology, assume it rained and settled,
;; return a new array of the collected rain fall.
;; _
;; _| | _
;; _| | _| |
;; | |_| |
;;
@film42
film42 / map.cpp
Last active August 29, 2015 14:03
Implementing generic map and reduce functions for certain collections in c++11 using lambda `std::function`
#include <iostream>
#include <vector>
#include <list>
template<typename T, typename V>
T map(T list, std::function<V (V)> fn) {
T new_list;
for(V& value : list) {
new_list.push_back( fn(value) );
}
@film42
film42 / knn.hpp
Last active August 29, 2015 14:04
(WIP) Starting to do a K Nearest Neighbor example. Repo with latest here: https://github.com/film42/knn-property-categorization
//
// knn.h
// k_nearest_neighbor
//
// http://burakkanber.com/blog/machine-learning-in-js-k-nearest-neighbor-part-1/
//
// Created by Garrett Thornburg on 8/1/14.
// Copyright (c) 2014 gt. All rights reserved.
//
@film42
film42 / rxcpp_pi.cpp
Last active August 29, 2015 14:04
RxCPP PI Stream
auto pi_series = []( long limit ){
return rxcpp::observable<>::range(1, limit)
.map([](int k) {
return ( k % 2 == 0 ? -4 : 4 ) / ( long double )( ( 2 * k ) - 1 );
})
.sum()
.as_dynamic();
};
@film42
film42 / a_stock_pattern_matching.cpp
Last active August 29, 2015 14:04
(WIP) Pattern Matching Algorithm using Stock Tick Data: Uses FooPlot for Rendering Graphs
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <cmath>
#include "functional.h"
#include "graph.h"
// DATA PARSING
@film42
film42 / broker.hpp
Last active August 29, 2015 14:04
Pub/Sub Broker in C++ but it's not threaded
#include <vector>
#include <map>
namespace postal {
template< class T >
class broker {
public:
typedef std::vector< std::function< void ( T ) > > FuncVector;

Keybase proof

I hereby claim:

  • I am film42 on github.
  • I am film42 (https://keybase.io/film42) on keybase.
  • I have a public key whose fingerprint is CF06 2F6F 984C 0FA7 F955 A9D4 B42B B29C 5E42 9824

To claim this, I am signing this object:

@film42
film42 / MatrixSpiral.java
Created October 9, 2014 05:40
I saw someone mention this as a fun problem, so I did it.
public class SpiralMatrix {
public static void spiralPrint( int[][] matrix ) {
int height = matrix.length;
int width = matrix[0].length;
int currCol = 0;
int currRow = 0;