Instantly share code, notes, and snippets.

Cody Rioux codyrioux

View GitHub Profile
View ensime-vim.log
2016-03-17 21:41:55.866424: __init__: in
2016-03-17 21:41:55.931150: [(<frame object at 0x109001a00>, '/Users/crioux/.vim/plugged/ensime-vim/ensime_shared/', 168, 'lazy_initialize_ensime', [' self.log(str(inspect.stack()))\n'], 0), (<frame object at 0x1090c1440>, '/Users/crioux/.vim/plugged/ensime-vim/ensime_shared/', 188, 'setup', [' return lazy_initialize_ensime() and ready_to_connect()\n'], 0), (<frame object at 0x108c0a650>, '/Users/crioux/.vim/plugged/ensime-vim/ensime_shared/', 1010, 'client_for', [' if client.setup(quiet=quiet, create_classpath=create_classpath):\n'], 0), (<frame object at 0x7feb3b6433e0>, '/Users/crioux/.vim/plugged/ensime-vim/ensime_shared/', 986, 'current_client', [' create_client=create_client)\n'], 0), (<frame object at 0x7feb3b641830>, '/Users/crioux/.vim/plugged/ensime-vim/ensime_shared/', 928, 'wrapper2', [' create_client=create_client)\n'], 0), (<frame object at 0x108fdc
View .ensime.gradle
(:root-dir "/Users/crioux/src/stash/hello"
:cache-dir "/Users/crioux/src/stash/hello/.ensime.cache.d"
:name "hello"
:java-home "/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home"
:formatting-prefs nil
:scala-version "2.11.8"
:compiler-args ("-Xlint")
:subprojects ((:name "hello"
:source-roots ("/Users/crioux/src/stash/hello/src/main/resources" "/Users/crioux/src/stash/hello/src/main/java" "/Users/crioux/src/stash/hello/src/main/scala" "/Users/crioux/src/stash/hello/src/test/resources" "/Users/crioux/src/stash/hello/src/test/java" "/Users/crioux/src/stash/hello/src/test/scala")
:reference-source-roots ("/Users/crioux/.gradle/caches/modules-2/files-2.1/com.typesafe.akka/akka-actor_2.11/2.3.14/4f0b9a84b193fad2678fb12080c258a1abb85949/akka-actor_2.11-2.3.14-sources.jar" "/Users/crioux/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-reflect/2.11.7/c4d5a9d0a7a6956720809bcebca1b2fe978e5dc6/scala-reflect-2.11.7-sources.jar" "/Users/crioux/.gradle/caches/modules-2/files-2.1/org.apache.commons/com
# Drift Generator
class DriftingDistributionGenerator(Generator):
A generator which takes two distinct distributions and a changepoint and returns
random variates from the first distribution until it has reached the changepoint
where it linearly drifts to the second distribution.
View LinkedList
public class LinkedList {
public static class Node {
public int data;
public Node next;
public static Node reverse(Node head) {
if (head == null || == null) {
return head;
View gist:9437194
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.lang.Iterable;
import java.util.NoSuchElementException;
import javax.naming.OperationNotSupportedException;
View fizzbuzz_rl.c
/* Author: Cody Rioux <>
* Description: A simple toy program to implement fizzbuzz using reinfocement learning.
* Notes: This learner is very tightly coupled to the FizzBuzz specific implementation
* functions. This is obviously not a favorable situation. Consider using libCello to
* make a general SARSA learner that takes function parameters for the general case.
#include <stdio.h>
#include <assert.h>
View tfidf.clj
"A term-frequency inverse-document-frequency implementation in idiomatic clojure.
A term is a single token, doc is a seq of terms and docs is a seq of docs.")
(defn- log [x] (Math/log x))
(defn- t-in-d? [t, d] (some #{t} d))
(defn- f [t doc] (count (filter #(= t %) doc)))
(defn tf [t doc] (+ 0.5 (/ (* 0.5 (f t doc)) (apply max (map #(f % doc) doc)))))
(defn idf [t docs] (log (/ (count docs) (count (filter (partial t-in-d? t) docs)))))
View genetic-algorithm.clj
(ns genetic-algorithm.core
(:use (clojure set))
(defn ga
"Main function for running the genetic algorithm.
This will perform the fitness -> selection -> crossover -> mutation cycle
until we have reached the maximum number of generations or our termination
condition specified by terminate? is satisfied.
View positioning.erl
% A naive extension of minimax to solve a multi-player positioning game.
% Author: Cody Rioux
% Email:
% Site:
% A word of caution, this algorithm has a high computational complexity and takes a very long
% time to run with inputs greater than four players. I mean it. I'd recommend making supper
% after setting the algorithm loose on six or more players. Ten or more I'd recommend letting
% it run while you're on vacation.
View prime.erl
start(Max) -> io:format("Solution: ~p ~n", [sieve(lists:seq(2, Max), Max)]).
sieve([H|T], Max) -> if H * H > Max -> [H] ++ T; true -> [H] ++ sieve(mark(H, T), Max) end.
mark(X, List) -> lists:filter(fun(Y) -> (Y rem X =/= 0) end, List).