Skip to content

Instantly share code, notes, and snippets.

@cloudRoutine
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
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
cloudRoutine / fsharp_advent_2016_12_10.md
Created Dec 18, 2018 — forked from mrange/fsharp_advent_2016_12_10.md
F# Advent 2016 (English) - December 10 - Implementing a persistent hash map.
View fsharp_advent_2016_12_10.md
@cloudRoutine
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
[<RequireQualifiedAccess>]
module Folds =
// These are the fast implementations we actually want to use
@cloudRoutine
cloudRoutine / msbuild-xaml.md
Last active Jul 24, 2017
MSBUILD XAML Reference
View msbuild-xaml.md
@cloudRoutine
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
cloudRoutine / optimizing_performance.md
Created Oct 12, 2016 — forked from mrange/optimizing_performance.md
Optimizing a simple problem in F# and C++
View optimizing_performance.md

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

View json_transform.md
@cloudRoutine
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
let STEP = STEPS
let GRADATION = GRADATIONS
@cloudRoutine
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__