Skip to content

Instantly share code, notes, and snippets.

@MartinBodocky
MartinBodocky / RProviderPlay.fs
Last active August 29, 2015 14:03
RProvider with Fslab nuget package!
(*
BEFORE you start to play you need to add
Fslab to your project by nuget package manager
*)
#nowarn "211" // Ignore warning that a search path does not exist on #I
#I "../packages/FSharp.Data.2.0.9/lib/net40/"
#r "FSharp.Data.dll"
#I "../../bin/"
@MartinBodocky
MartinBodocky / bn.fs
Created July 22, 2014 15:57
Binomial Distribution
(* http://www.fssnip.net/nu *)
(* Factorial function *)
let rec (!!) x =
if x = 1 || x = 0 then 1
else x * !! (x-1)
(* Choose function *)
let (+?) (n:int) (x:int) =
!!n / (!!x * !!(n - x))
@MartinBodocky
MartinBodocky / gist:7d366c7d3834bdd0e396
Created September 29, 2014 13:14
Play with async calls
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace AsyncTest
{
@MartinBodocky
MartinBodocky / MSMQ_Administration.fs
Last active August 29, 2015 14:17
MSMQ Administration with F#
#I @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\"
#r "System.Messaging.dll"
open System
open System.Messaging
open System.Diagnostics
// create message queue
MessageQueue.Create(@".\private$\r_default-queue")
@MartinBodocky
MartinBodocky / RefreshNugetPackages.ps1
Created September 22, 2015 11:17
The script will reinstall all nuget packages installed in your project.
# Reinstall Nuget Packages into project
$packageFile =(Resolve-Path ".\").Path + "\packages.config"
if(Test-Path -Path $packageFile)
{
# get only packages mentioned inside packages config
[xml]$xmlContent = Get-Content $packageFile
# packages
$packages = $xmlContent.SelectNodes("//packages//package")
@MartinBodocky
MartinBodocky / GetNugetPackagesLocal.ps1
Last active September 29, 2015 09:54
The script will be download most used Nuget packages, or just those which are in packages.config file.
# --- settings ---
$feedUrlBase = "http://go.microsoft.com/fwlink/?LinkID=206669"
# the rest will be params when converting to funclet
$forceLatest = $false
$latest = $true
$overwrite = $false
$top = 500 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocalNew"
$packageFile =(Resolve-Path ".\").Path + "\packages.config"
@MartinBodocky
MartinBodocky / PCA.fsx
Last active October 4, 2016 01:21
PCA with Accord.Net and FSharp.Charting
// Inspired by http://arxiv.org/abs/1210.7463
// reference accord framework
#r "../packages/Accord.3.0.2/lib/net45/Accord.dll"
#r "../packages/Accord.Controls.3.0.2/lib/net45/Accord.Controls.dll"
#r "../packages/Accord.IO.3.0.2/lib/net45/Accord.IO.dll"
#r "../packages/Accord.Math.3.0.2/lib/net45/Accord.Math.dll"
#r "../packages/Accord.Statistics.3.0.2/lib/net45/Accord.Statistics.dll"
//reference deelde with fsharp charting
@MartinBodocky
MartinBodocky / SecomPCA.fsx
Created October 18, 2015 15:38
PCA analysis on more real data with Accord.Net with Deedle and FSharp.Charting.
// data from http://archive.ics.uci.edu/ml/machine-learning-databases/secom/
// reference accord framework
#r "../packages/Accord.3.0.2/lib/net45/Accord.dll"
#r "../packages/Accord.Controls.3.0.2/lib/net45/Accord.Controls.dll"
#r "../packages/Accord.IO.3.0.2/lib/net45/Accord.IO.dll"
#r "../packages/Accord.Math.3.0.2/lib/net45/Accord.Math.dll"
#r "../packages/Accord.Statistics.3.0.2/lib/net45/Accord.Statistics.dll"
//reference deelde with fsharp charting
#r "../packages/Deedle.1.2.4/lib/net40/Deedle.dll"
#r "../packages/FSharp.Charting.0.90.12/lib/net40/FSharp.Charting.dll"
@MartinBodocky
MartinBodocky / cooking.fsx
Last active October 30, 2015 18:31
Prototyping for What's Cooking Kaggle competition
// link to competition: https://www.kaggle.com/c/whats-cooking/
//reference deelde with fsharp charting
#r "../packages/Deedle.1.2.4/lib/net40/Deedle.dll"
#r "../packages/FSharp.Charting.0.90.12/lib/net40/FSharp.Charting.dll"
#I "../packages/FSharp.Charting.0.90.12"
#load "FSharp.Charting.fsx"
#r "../packages/Newtonsoft.Json.7.0.1/lib/net45/Newtonsoft.Json.dll"
open System
open System
open Neo4jClient
open System.Linq
[<CLIMutable>]
type Person = { Name:string; Twitter:string }
[<CLIMutable>]
type Knows = { How:string }