This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System; | |
open System.Net; | |
open System.Net.NetworkInformation; | |
let GetLocalIpv4Address() = | |
let interfaces = NetworkInterface.GetAllNetworkInterfaces() | |
let unicastAddresses = | |
interfaces |> Seq.map (fun i -> i.GetIPProperties().UnicastAddresses) |> Seq.concat |> Seq.toList | |
let item = | |
unicastAddresses |> Seq.find (fun a -> a.IPv4Mask.ToString() <> "0.0.0.0" && a.IPv4Mask.ToString() <> "255.0.0.0") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let phpMd5 (dataToHash:string) = | |
use md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); | |
let encodedBytes = dataToHash |> System.Text.ASCIIEncoding.Default.GetBytes |> md5.ComputeHash | |
System.Text.RegularExpressions.Regex.Replace(System.BitConverter.ToString(encodedBytes), "-", "").ToLower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nuget packages: Owin, Microsoft.Owin, Microsoft.Owin.Hosting, Microsoft.Owin.Host.HttpListener, Owin.Compression, Microsoft.Owin.StaticFiles, Microsoft.Owin.FileSystems | |
#if INTERACTIVE | |
#I @"./packages/Owin/lib/net40" | |
#I @"./packages/Owin.Compression/lib/net45" | |
#I @"./packages/Microsoft.Owin/lib/net45" | |
#I @"./packages/Microsoft.Owin.Hosting/lib/net45" | |
#I @"./packages/Microsoft.Owin.Host.HttpListener/lib/net45" | |
#I @"./packages/Microsoft.Owin.StaticFiles/lib/net45" | |
#I @"./packages/Microsoft.Owin.FileSystems/lib/net45" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="./../../paket-files/borisyankov/DefinitelyTyped/google.analytics/ga.d.ts" /> | |
export var gaNewElem : any = {}; | |
export var gaElems : any = {}; | |
function gaInit(){ | |
var currdate : any = new Date(); | |
/* tslint:disable:no-string-literal */ | |
/* tslint:disable:semicolon */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
open Logary | |
open Logary.Configuration | |
open Logary.Targets | |
open Logary.Metrics | |
#if INTERACTIVE | |
#else | |
[<EntryPoint>] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Microsoft.FSharp.Linq.RuntimeHelpers | |
open System | |
open System.Linq.Expressions | |
module Lambda = | |
let toExpression (``f# lambda`` : Quotations.Expr<'a>) = | |
``f# lambda`` | |
|> LeafExpressionConverter.QuotationToExpression | |
|> unbox<Expression<'a>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Memoize | |
//More generic variant of http://www.fssnip.net/c4 | |
open System.Collections.Concurrent | |
let cache = ConcurrentDictionary<(string * obj) option,Lazy<obj>>() | |
let memoizeConcurrent (caller:string) (f: ('a -> 'b)) = | |
fun (x :'a) -> | |
(cache.GetOrAdd(Some (caller, x|>box), lazy ((f x)|>box)).Force() |> unbox) : 'b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In MONO, won't work in interactive, you need to make a project and compile a dll. | |
#if INTERACTIVE | |
#r @"./packages/FSharp.Data/lib/net40/FSharp.Data.dll" | |
#r @"./packages/SQLProvider/lib/net40/FSharp.Data.SqlProvider.dll" | |
// OWIN and SignalR-packages: | |
#I @"./packages/Microsoft.AspNet.SignalR.Core/lib/net45" | |
#r @"./packages/Microsoft.AspNet.SignalR.Core/lib/net45/Microsoft.AspNet.SignalR.Core.dll" | |
#I @"./packages/Microsoft.Owin/lib/net45" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
RUN apt-get -y update | |
# Install Mono (and fsharp) | |
RUN apt-get -y install mono-devel autoconf pkg-config make git libtool | |
RUN git clone https://github.com/fsharp/fsharp | |
RUN cd fsharp && ./autogen.sh --prefix /usr && make && make install | |
# Add some files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib/ | |
paket-files/ | |
[Pp]ackages/ |