Skip to content

Instantly share code, notes, and snippets.

cloudRoutine / booyer-moore_knuth-morris-pratt.fs
Last active Apr 23, 2021
String Search Algorithms ( Boyer-Moore & Knuth-Morris-Pratt )
View booyer-moore_knuth-morris-pratt.fs
module StringMatching =
open System
/// Knuth-Morris-Pratt String Searching Algorithm ///
let kmp_search (text:string) (word:string) : int =
let kmp_table (word:string) =
let table = [| 1..word.Length |]
table.[0] <- -1
cloudRoutine / Microsoft.PowerShell_profile.ps1
Last active Sep 10, 2020
Powershell Profile for use with Cmder
View Microsoft.PowerShell_profile.ps1
# If this script is throwing an error near a Unicode symbol try resaving the file as UTF-8 with BOM
$psmodules = ";~\Documents\WindowsPowerShell\Modules"
# sometimes the module paths has been fucked before posh loads, but that won't stop us
$env:PSModulePath = $env:PSModulePath + $psmodules
# Set the OutputEncoding to Unicode so that the λ renders properly
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
cloudRoutine /
Created Dec 18, 2018 — forked from mrange/
F# Advent 2016 (English) - December 10 - Implementing a persistent hash map.
cloudRoutine / 01_folds.fs
Last active Dec 8, 2018
F# Transducers - they work for the most part
View 01_folds.fs
open System.Collections.Generic
open Microsoft.FSharp.Collections
module Folds =
// These are the fast implementations we actually want to use
cloudRoutine /
Last active Jul 24, 2017
cloudRoutine / user-profile.ps1
Last active Jun 30, 2017
Posh Profile for Portable Cmder with Vim Config Instructions
View user-profile.ps1
# NOTE - If there are weird character errors when trying to load this profile
# resave the file with the encoding `UTF-8 with BOM`
# ┌ ┐
# Setup Environment
# └ ┘
# change to codepage to display symbols properly
chcp 65001 | out-null
cloudRoutine /
Created Oct 12, 2016 — forked from mrange/
Optimizing a simple problem in F# and C++

Optimizing a simple problem

I was introduced to a simple optimization problem by one of my interns last week. He was about to participate in a friendly competition where they were asked to find a performant solution to the problem:

The problem

cloudRoutine / logo_turtle.fsx
Created Aug 7, 2016
Logo Turtle Computation Expression
View logo_turtle.fsx
namespace CExprs
module LogoTurtle =
type Distance_Unit = STEPS
type Rotation_Unit = GRADATIONS
type Rotation_Direction = | LEFT | RIGHT
cloudRoutine / github-downloader.fsx
Created Aug 5, 2016
Download Github release files even from behind a proxy
View github-downloader.fsx
open System
open System.IO
open System.Web
open System.Net
open System.Collections.Generic
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__