Skip to content

Instantly share code, notes, and snippets.

View goswinr's full-sized avatar

Goswin Rothenthal goswinr

View GitHub Profile
@goswinr
goswinr / RTree.fs
Created October 26, 2022 13:55 — forked from Horusiath/RTree.fs
RTree implementation for 2D spatial data
(*
An immutable R-Tree implementation in F#.
Based on: https://github.com/swimos/swim-rust/tree/main/swim_utilities/swim_rtree (licensed on Apache 2.0)
Author: Bartosz Sypytkowski <b.sypytkowski at gmail.com>
*)
namespace Demos.RTree
@goswinr
goswinr / Rpc.fs
Created August 23, 2022 15:04 — forked from deviousasti/Rpc.fs
Fast inter-process RPC using shared memory
open SharedMemory
open MBrace.FsPickler
module Rpc =
type RpcContext<'command, 'message> =
{ name: string; buffer: RpcBuffer; post: 'command -> Async<'message>} with
interface IDisposable with
member this.Dispose() = this.buffer.Dispose()
let createHost name (handler : 'command -> Async<'message>) =
@goswinr
goswinr / Dat.fs
Last active August 23, 2022 12:20 — forked from OnurGumus/Dat.fs
three.js fable
// You need to add missing types manually to IExport in Three.fs if you need.
// https://twitter.com/OnurGumusDev/status/1548282140806115330
module rec Dat
open Browser.Types
open Fable.Core
open System
@goswinr
goswinr / GhFsharpTest.fs
Created June 12, 2019 07:09 — forked from jesterKing/GhFsharpTest.fs
F# sample component for testing on Mac Rhino Grasshopper (v6, aka WIP)
namespace GhFsharpTest
open Grasshopper.Kernel
open Grasshopper.Kernel.Types
type Priority() =
inherit GH_AssemblyPriority()
override u.PriorityLoad() =
GH_LoadingInstruction.Proceed
@goswinr
goswinr / on-tail-recursion.md
Created March 21, 2019 07:50 — forked from mrange/on-tail-recursion.md
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
@goswinr
goswinr / Deploy.md
Created February 7, 2019 08:56 — forked from alfonsogarciacaro/Deploy.md
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)
@goswinr
goswinr / App.fs
Created January 14, 2019 16:25 — forked from mathias-brandewinder/App.fs
Lorentz attractor in Fable-Elmish
(*
Simulation of the Lorentz attractor, using Fable.
If you want to see this code in action, just copy this code into the Fable REPL:
https://fable.io/repl/
*)
module App
open Elmish
open Elmish.React
@goswinr
goswinr / gist:76508c7dd4c2349d8b3a7ec7c62c3102
Created January 3, 2019 20:08 — forked from dsyme/gist:9b18608b78dccf92ba33
Working self-contained getting-started sample for Suave Web Scripting
//==========================================
// Working fully self-contained getting-started example for Suave Web Server scripting
//
// Note you don't need to have _anything_ installed before starting with this script. Nothing
// but F# Interactive and this script.
//
// This script fetches the Paket.exe component which is referenced later in the script.
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been
// downloaded by the user (by executing the first part of the script) the reference
// shows as resolved and can be used.
#I __SOURCE_DIRECTORY__
#r "libs/NuGet.Core.dll"
#r "System.Xml.Linq"
open NuGet
open System
open System.IO
module NuGet =
@goswinr
goswinr / 01_LAD in Revit.fsx
Last active April 12, 2017 13:44
Generating the model of Louvre Abu Dhabi in Revit with Mantis in F#
// Generating the full model using my custom DLLs for geometry input
// F# editor: https://gist.github.com/moloneymb/5e5608c129337cfefa40
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitDBAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPIUI.dll"
#r @"C:\Program Files\Mantis\Tsunami.IDEDesktop.dll"
#r @"C:\work\goswin\30_F#\16-135_LAD\LAD\GosLib\bin\Release\GosLib.dll"
#r @"C:\work\goswin\30_F#\16-135_LAD\LAD\LAD\bin\Release\LAD.dll"
open Autodesk.Revit.DB