Skip to content

Instantly share code, notes, and snippets.

Jeremy Bellows JeremyBellows

Block or report user

Report or block JeremyBellows

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JeremyBellows
JeremyBellows / gramschmidt.fsx
Created Mar 29, 2017
Gram Schmidt in fsharp
View gramschmidt.fsx
type Vector = {Vector : float list} with
static member Create vector =
{ Vector = vector }
member this.InnerProduct otherVector =
List.zip this.Vector otherVector.Vector
|> List.map (fun (vectorOneNumber, vectorTwoNumber) -> vectorOneNumber * vectorTwoNumber)
|> List.sum
member this.Length =
@JeremyBellows
JeremyBellows / MnistDataReader.ex
Last active Mar 10, 2017
Elixir functions for parsing Mnist binary data - http://yann.lecun.com/exdb/mnist/
View MnistDataReader.ex
defmodule MnistDataReader do
def read_training_image_data(path) do
{:ok, data} = File.read path
parse_training_image_data data
end
def read_training_label_data(path) do
{:ok, data} = File.read path
parse_training_label_data data
View LiveEvolutionTicTac.fsx
#I "../NeuralFish"
#load "NeuralFish_dev.fsx"
open NeuralFish.Types
open NeuralFish.Core
open NeuralFish.EvolutionChamber
open NeuralFish.Exporter
type SquareId = int
@JeremyBellows
JeremyBellows / App.elm
Created Oct 5, 2016
Example app for Elm 0.17
View App.elm
module App exposing (..)
import Html exposing (Html, h1, text)
import Html.App
type alias Model = String
init : ( Model, Cmd Msg )
init =
( "Hello", Cmd.none )
@JeremyBellows
JeremyBellows / DiscriminatedUnionWithMembers.fsx
Created Jun 16, 2016
Example of a discriminated union type with member functions attached
View DiscriminatedUnionWithMembers.fsx
type test =
| One
| Two
member this.Add =
let number =
match this with
| One -> 1
| Two -> 2
(fun secondNumber -> number + secondNumber)
@JeremyBellows
JeremyBellows / learningMailboxes.fsx
Created Apr 29, 2016
Example of reprogrammable 'actors' or 'Mailboxes'
View learningMailboxes.fsx
let behavior () = printfn "1"
type Actions =
| Run
| Learn of (unit->unit)
| Die
let mailbox =
MailboxProcessor.Start(fun inbox ->
let rec loop learnedBehavior =
@JeremyBellows
JeremyBellows / monoSigInt.fs
Created Apr 8, 2016
Handle Sigint on Unix using Mono
View monoSigInt.fs
//This is to handle the unix ctrl+c signal
let handleSigInt () =
let quitApplication () =
Async.CancelDefaultToken()
async {
let mutable signals =
[|
new Mono.Unix.UnixSignal (Mono.Unix.Native.Signum.SIGINT)
new Mono.Unix.UnixSignal (Mono.Unix.Native.Signum.SIGTERM)
|]
View test.org

Test Org File

First Header

**SubHeader ***SubSubHeader

  • Plain List 1
  • Item 2
  • Item 3

Plain lists

  • this works
  • 2nd item
@JeremyBellows
JeremyBellows / MonoFsharpCentos6.sh
Last active Jun 5, 2017
Install Fsharp on Centos6
View MonoFsharpCentos6.sh
#Set the terminal session with super user privileges
sudo -s
#Install dependencies for compiling code
yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
#Download Mono, extract the files, make, and make install
cd /usr/local/src
wget http://download.mono-project.com/sources/mono/mono-5.0.1.1.tar.bz2
tar jxf mono-4.3.2.467.tar.bz2
@JeremyBellows
JeremyBellows / YearConverter.fsx
Created Nov 30, 2015
Converts Human Years to Cat Years or TimeLord Years
View YearConverter.fsx
let readInput = System.Console.ReadLine
[<Measure>] type HumanYear
[<Measure>] type CatYear
[<Measure>] type TimeLordYear
let averageCatLifeSpan = 15<HumanYear>
let averageHumanLifeSpan = 80<HumanYear>
let averageTimeLordLifeSpan = 7000<HumanYear>
You can’t perform that action at this time.