Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Simpson mjs2600

View GitHub Profile
View ComponentCounter.re
type state = {count: int};
type action =
| Increment
| Decrement;
let component = ReasonReact.reducerComponent("State");
let make = _children => {
...component,
View theme.fish
# Theme based on Bira theme from oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/bira.zsh-theme
# Some code stolen from oh-my-fish clearance theme: https://github.com/bpinto/oh-my-fish/blob/master/themes/clearance/
function __user_host
set -l content
if [ (id -u) = "0" ];
echo -n (set_color --bold red)
else
echo -n (set_color --bold green)
end
View init.vim
if !filereadable(glob("~/.config/nvim/autoload/plug.vim"))
!curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
let g:clipboard = {
\ 'name': 'pbcopy',
\ 'copy': {
\ '+': 'pbcopy',
\ '*': 'pbcopy',
\ },
View init.vim
if !filereadable(glob("~/.config/nvim/autoload/plug.vim"))
!curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
let g:python_host_prog = $HOME . '/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog = $HOME . '/.pyenv/versions/neovim3/bin/python'
let mapleader = ' '
silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
View fizz_buzz.ex
defmodule Fizzbuzz do
def parse(range \\ 1..100) do
range
|> Enum.map(&parse_num/1)
|> Enum.join
end
defp parse_num(n) do
fizzbuzzer(n, rem(n, 3), rem(n, 5))
end
@mjs2600
mjs2600 / LongPolicyIterationTest.java
Last active Jun 13, 2017
Homework 5 Test Cases
View LongPolicyIterationTest.java
import burlap.behavior.singleagent.Policy;
import burlap.behavior.singleagent.planning.ActionTransitions;
import burlap.behavior.singleagent.planning.HashedTransitionProbability;
import burlap.behavior.singleagent.planning.PlannerDerivedPolicy;
import burlap.behavior.singleagent.planning.ValueFunctionPlanner;
import burlap.behavior.singleagent.planning.commonpolicies.GreedyDeterministicQPolicy;
import burlap.behavior.statehashing.DiscreteStateHashFactory;
import burlap.behavior.statehashing.StateHashTuple;
import burlap.domain.singleagent.graphdefined.GraphDefinedDomain;
import burlap.oomdp.core.Domain;
View gist:bf8457dd7172be148439
(define zero (lambda (f) (lambda (x) x)))
(define (add-1 n)
(lambda (f) (lambda (x) (f ((n f) x)))))
(define one
(lambda (f)
(lambda (x)
(f (((lambda (f)
(lambda (x) x)) f) x)))))
@mjs2600
mjs2600 / cost.py
Created Feb 27, 2015
NN Cost Function
View cost.py
class Trainer(object):
def __init__(self, nn, data, label):
self.nn = nn
self.data = data
self.label = label
def __call__(self, weights):
from pybrain.utilities import percentError
self.nn._setParameters(weights)
output = self.nn.activateOnDataset(self.data)
View gist:f8e6ecf9200216df42a2
(import [urllib.request :as r])
(print "Hello world!")
(-> (.urlopen r "http://python.org")
(.read)
(print))
@mjs2600
mjs2600 / HelloWorld.elm
Last active Aug 29, 2015
My first Elm program. It looks sort of like my Elixir.
View HelloWorld.elm
import Mouse
import Text
main : Signal Element
main = [constant "Hello, World! ",
lift show Mouse.position]
|> combine
|> lift display
display : [String] -> Element
You can’t perform that action at this time.