Skip to content

Instantly share code, notes, and snippets.

View ascjones's full-sized avatar

Andrew Jones ascjones

View GitHub Profile
@ovatsus
ovatsus / Setup.fsx
Created March 17, 2012 17:07
Script to setup F# Interactive session, loading everything in the current solution
#r "System.Xml.Linq"
open System
open System.IO
open System.Xml.Linq
let script = seq {
//TODO: this currently loads fsproj's in alphabeticall order, we should instead
//build the dependencies graph of the fsproj's and load them in topological sort order
@vjt
vjt / copy-from-time-machine.sh
Last active March 8, 2024 17:05
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@balupton
balupton / README.md
Last active April 29, 2019 11:57
DocPad: Use DocPad, GitHub & Prose as a Wiki

Use DocPad, GitHub and Prose as a Wiki

This guide will walk you through how you can use a GitHub repository to house your wiki content, have DocPad render it, and automatically update on changes. It's also really nice as we get to benefit from the github project workflow for our wiki, that is issues, pull requests, etc.

We use this workflow heavily by linking the DocPad Website and the DocPad Documentation repositories allowing us to have users edit and submit pull requests for improvements to our documentation, and once merged, the website regenerates automatically.

1. Create a new repository for your Wiki Content

#r @"packages\Streams.0.2.5\lib\Streams.Core.dll"
open System
open System.IO
open System.Collections.Generic
open Nessos.Streams
// make Visual Studio use the script directory
Directory.SetCurrentDirectory(__SOURCE_DIRECTORY__)
@akimboyko
akimboyko / 01_SayHello.fsx
Last active May 28, 2023 13:00
Samples from "Actor-based Concurrency with F# and Akka.NET" http://bit.ly/FSharpAkkaNET
#time "on"
#load "Bootstrap.fsx"
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open Akka.TestKit
// #Using Actor
data First : Nat -> Type where
MkFirst : (n : Fin 10) -> First (finToNat n)
data Second : Nat -> Type where
MkSecond : (f : First m) -> (n : Fin m) -> Second (finToNat n)
MkNoSecond : (f : First 9) -> Second 0
hit8 : Second 1
hit8 = MkSecond (MkFirst 8) (FS FZ)
@dsyme
dsyme / gist:9b18608b78dccf92ba33
Last active November 1, 2022 18:11
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.
@CarstenKoenig
CarstenKoenig / EventPlayback.fs
Created February 12, 2015 18:15
playing back events with FUN
namespace Events
type Projection<'ev, 'state, 'out> =
{ foldState : 'ev -> 'state -> 'state
; projection : 'state -> 'out
; emptyState : 'state
}
module Projections =
@ptrelford
ptrelford / randomArt.go
Created September 5, 2015 12:09
Random Art
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"math"
"math/rand"
"os"
@txus
txus / README.md
Last active July 30, 2018 20:54
Memory as a dependently-typed effect (scroll down for examples!)

Memory as an effect

What if we treated memory as a side-effect?

Idris lets us track lots of things in the type system, in order to get errors at compile-time rather than at runtime. One of the tools that lets us do this in Idris is called Effects, and they're used to keep track of state, to manage file handlers, and lots more.

In barely 40 lines of Idris (which could be less if I had any idea what I'm