Skip to content

Instantly share code, notes, and snippets.

View mjs2600's full-sized avatar

Michael Simpson mjs2600

View GitHub Profile
@mjs2600
mjs2600 / ComponentCounter.re
Created June 8, 2018 19:59
ReasonML Counter
type state = {count: int};
type action =
| Increment
| Decrement;
let component = ReasonReact.reducerComponent("State");
let make = _children => {
...component,
@mjs2600
mjs2600 / theme.fish
Created April 9, 2018 12:46
My Fish Theme
# 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
@mjs2600
mjs2600 / init.vim
Last active March 5, 2019 17:47
vimrc
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',
\ },
@mjs2600
mjs2600 / init.vim
Created July 7, 2017 13:49
My `.vimrc`
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
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 June 13, 2017 16:38
Homework 5 Test Cases
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;
(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 February 27, 2015 12:14
NN Cost Function
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)
@mjs2600
mjs2600 / gist:f8e6ecf9200216df42a2
Created December 11, 2014 22:08
Hy with threading macro
(import [urllib.request :as r])
(print "Hello world!")
(-> (.urlopen r "http://python.org")
(.read)
(print))
@mjs2600
mjs2600 / HelloWorld.elm
Last active August 29, 2015 14:03
My first Elm program. It looks sort of like my Elixir.
import Mouse
import Text
main : Signal Element
main = [constant "Hello, World! ",
lift show Mouse.position]
|> combine
|> lift display
display : [String] -> Element