Skip to content

Instantly share code, notes, and snippets.


David Glassborow davidglassborow

View GitHub Profile
davidglassborow / fixed_header.css
Created Mar 23, 2021 — forked from Pycea/fixed_header.css
Styling improvements for the ACX Substack. To load into Safari, copy the ones you want into a file, then go to Preferences > Advanced > Style sheet and select your file.
View fixed_header.css
/* Fixes the header to the top of the page */
div#entry > div#main .main-menu-content {
position: relative !important;
top: 0 !important;
div#entry > div#main .main-menu .backdrop {
position: fixed !important;
davidglassborow / Move TempDB.sql
Created Oct 27, 2020 — forked from FlogDonkey/Move TempDB.sql
Moves SQL TempDB files to designated location, and sizes them appropriately. If there are multiple instances hosted on the same SQL Server, divide the drive size by the instance count, and create folders for each instance name on the destination drive.
View Move TempDB.sql
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive.
After you run this, SQL Server must be restarted for it to take effect
DECLARE @DriveSizeGB INT = 40
,@FileCount INT = 9
,@FileSize VARCHAR(10)
,@DrivePath VARCHAR(100) = 'T:\' + @@SERVICENAME + '\';
View Srtp and Records.fs
Sometimes you don't care about a particular type, you're interested in one field only, let's say `EntityId`.
Instead of using interface (which isn't even possible if don't own a type),
we can do structural typing in F# using SRTP and Active Patterns.
Active patterns are not required for this, but they do make code much easier to use.
// So we have 2 types with field `EntityId: string`:
davidglassborow / Ukf.fs
Created May 19, 2020 — forked from praeclarum/Ukf.fs
Unscented Kalman Filter (nonlinear version of the classic Kalman filter) in F#
View Ukf.fs
module Drone.Control.Ukf
open System
open Drone.Control.Matrix
type IDiscreteModel =
abstract Process : Matrix -> Matrix
abstract Observe : Matrix -> Matrix
abstract InitialState : Matrix
View AsyncParallelStats.fsx
// Change this to your profile folder for nuget packages
#I @"C:\Users\Isaac\.nuget\packages\"
#r @"XPlot.GoogleCharts\2.0.0\lib\netstandard2.0\XPlot.GoogleCharts.dll"
#r @"Newtonsoft.Json\12.0.3\lib\netstandard2.0\Newtonsoft.Json.dll"
#r @"Google.DataTable.Net.Wrapper\4.0.0\lib\netstandard2.0\Google.DataTable.Net.Wrapper.dll"
open System
open XPlot.GoogleCharts
/// Executes an asynchronous workflow and provides some simple statistics on the results.

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette.


Keep it simple, stupid. You ain't gonna need it.

View nested_ce.fs
type ThirdLevel =
| Payload of int
and SecondLevel =
| Nested of ThirdLevel list
| Payload of string
and FirstLevel =
| Nested of SecondLevel list
| Payload of double
| EmptyLine
and AllBuilder() =
davidglassborow / engine.c
Created Aug 18, 2019 — forked from druska/engine.c
Quant Cup 1's winning order book implementation
View engine.c
* QuantCup 1: Price-Time Matching Engine
* Submitted by: voyager
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
davidglassborow /
Created May 1, 2019 — forked from mrange/
[F#/OCaml] Implementing a data streams library using a bunch of one-liners

[F#/OCaml] Implementing a data streams library using a bunch of one-liners

A few years ago when I read the presentation motivating the design behind Nessos Streams I was struck by the beauty of simplistic push streams.

type PushStream<'T> = ('T -> bool) -> bool

LINQ (in .NET) is a pull stream, ie we pull values out of the stream by calling MoveNext + Current. One of the problems with pull streams is the constant checking "Are we done?" at each level in the stream.

View ExcelRandomCursor.fsx
// This is am example of an immediate write / random access cursor for Excel with basic formatting options.
// Implementation is based on a concrete, non generic writer monad with no payload ("do!"" only) (only state).
// Instead of directl writing to excel, an alternatives would be a random acces to a
// copy-on-write list (or even a mutable array) and then bulk-write the result to excel in one shot.
// When only forward access would have been required, a simple seq expression with yields would have been enough.
// Anyway, it is a demonstration on how to "hide" pseudo-mutable state that is passed through a computation.
// I personally use it for generating reports based on various data sources.