Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

type Timed<'T> =
{ Timestamp: DateTimeOffset
Value: 'T }
type Clock = unit -> DateTimeOffset
let Timed (c: Clock) v =
{ Timestamp = c ()
Value = v }
namespace Fsion
open System.Threading
[<Struct;NoEquality;NoComparison>]
type Cancel =
private
| Cancel of bool ref * children: Cancel list ref
module internal Cancel =
type ChangesRequestSchemeBasedOnXForwardedProto(next : RequestDelegate) =
member this.Invoke(context : HttpContext) =
let xForwardedProto = context.Request.Headers.["X-Forwarded-Proto"]
if xForwardedProto = (StringValues "https") then
context.Request.Scheme <- "https"
else
()
next.Invoke(context)
module WerknemerInRooster
module Types =
open System
open Common.Validation
type Werknemer = {
WerknemerId : string
WerknemerInternalId : Guid
RoosterId : Guid
@aaronmu
aaronmu / Async.fs
Created January 2, 2019 22:18 — forked from kspeakman/Async.fs
Helpers
namespace Utils
module Async =
let retn x =
async { return x }
let lift f =
f >> retn
@aaronmu
aaronmu / fix-ubuntu-18.10-on-dell-xps-9570
Last active December 1, 2018 13:25 — forked from leoheck/fix-ubuntu-18.10-on-dell-xps-9570
Fix Ubuntu 18.10 on Dell XPS 9570
#
# Run this from the Live USB.
#
#############################
# EDIT YOUR PARTITIONS HERE #
#############################
root_partition=/dev/nvm0n1p2
sudo mount ${root_partition} /mnt
@aaronmu
aaronmu / log.txt
Last active November 30, 2018 21:24
foo@bar:~$ sudo apt-get install openvpn
Reading package lists... Done
Building dependency tree
Reading state information... Done
openvpn is already the newest version (2.4.6-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up gcc (4:8.2.0-1ubuntu1) ...
@aaronmu
aaronmu / Deploy.md
Created August 14, 2018 22:17 — 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)
af724c8c-16c3-4889-98d0-bc72b3f98542
1d76283e-fa3a-4591-8cd9-8215df662446
6678be79-4cdd-4381-ad95-63c61b702dde
f38b26b5-df17-474b-bc36-71925bc96e88
@aaronmu
aaronmu / FunWithBaskets.cs
Created June 8, 2018 11:10 — forked from yreynhout/FunWithBaskets.cs
How can I use child entities?
public class Basket : EventSource
{
private int Id;
private List<Item> Items = new List<Item>();
public Basket()
{
On<ItemAddedToBasket>(e => {
var item = new Item(@event =>