Skip to content

Instantly share code, notes, and snippets.

Tuomas Hietanen Thorium

Block or report user

Report or block Thorium

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Thorium / myvisitor.fs
Created Nov 8, 2019
F# LINQ-Expression-tree visitor
View myvisitor.fs
// A simple expression tree visitor, to inject a lambda inside another lambda parameters.
open Microsoft.FSharp.Linq.RuntimeHelpers
open System
open System.Linq.Expressions
//F#-helper method for Linq.Expressions:
module Lambda =
let toExpression (``f# lambda`` : Quotations.Expr<'a>) =
``f# lambda``
|> LeafExpressionConverter.QuotationToExpression
Thorium / Program.fs
Last active Apr 24, 2019
Creating graphical visualisation of a Markov chain
View Program.fs
module GraphVizSample
open GraphVizWrapper
open GraphVizWrapper.Commands
open GraphVizWrapper.Queries
open System
open System.Configuration
open System.Drawing
open System.IO
Thorium / uaparse.fs
Last active Feb 19, 2019
Parsing UserAgent strings with FSharp
View uaparse.fs
open System
open System.IO
open System.Net
open System.Text.RegularExpressions
let req = HttpWebRequest.Create ""
let resp = (new StreamReader(req.GetResponse().GetResponseStream())).ReadToEnd()
let lines = resp.Split( [| Environment.NewLine; "\r"; "\n"; "\r\n" |], StringSplitOptions.RemoveEmptyEntries)
/// Minimal YAML-file parsing
let yamlParse =
Thorium / extension.fs
Created May 8, 2017
Visual Studio 2017 extension: Displaying Light Bulb Suggestions
View extension.fs
// Example follows this, translated to FSharp:
// Just instead of copy&pasting C#, add a new F# class library and paste this code to there,
// then add that to reference to your C#-project.
// If you want to deploy without C# project, see e.g. this:
// You need to use some VSIX-package to deploy the code:
Thorium / BtcPrice.fsx
Created Feb 2, 2017
Bitcoin current price data from
View BtcPrice.fsx
//Using FSharp.Data
type BtcData = FSharp.Data.JsonProvider<"""{
let prices = BtcData.Load("")
//prices.Eur.Buy : val it : decimal = 923.52M (at 02/02/2017)
//prices.Gbp.Sell : val it : decimal = 794.61M (at 02/02/2017)
Thorium / ml.fs
Created Mar 28, 2017
Using machine learning tool Accord.Net from F#
View ml.fs
// This example uses the same data and methods as
#I @"./packages"
#r @"FSharp.Data.2.3.2/lib/net40/FSharp.Data.dll"
#r @"Accord.3.4.0/lib/net45/Accord.dll"
#r @"Accord.MachineLearning.3.4.0/lib/net45/Accord.MachineLearning.dll"
#r @"Accord.Math.3.4.0/lib/net45/Accord.Math.Core.dll"
#r @"Accord.Math.3.4.0/lib/net45/Accord.Math.dll"
#r @"Accord.Statistics.3.4.0/lib/net45/Accord.Statistics.dll"
Thorium / DecisionTree.fs
Last active May 16, 2018
Wine-quality decision-tree using Accord.Net from F#
View DecisionTree.fs
Install-Package FSharp.Data
Install-Package Accord
Install-Package Accord.MachineLearning
Install-Package Accord.Math
Install-Package Accord.Statistics
Thorium / bitbucket-pipelines.yml
Last active May 14, 2018
Bitbucket pipelines test to build FSharp repository
View bitbucket-pipelines.yml
# Take FSharp docker image and run Fake build script using Paket FSharp and Gulp.
image: fsharp:latest
- step:
- echo "Runs on branches that don't have specific pipeline."
# Install general utilities for building
- apt-get -qq update
Thorium / BlockChain.fs
Last active Apr 25, 2018
Using NBitcoin to create private BlockChain with F# (FSharp)
View BlockChain.fs
// This is just an initial example / tech-demo.
#I "./../packages/NBitcoin/lib/net45/"
#I "./../packages/Newtonsoft.Json/lib/net45"
#r "NBitcoin.dll"
#r "Newtonsoft.Json.dll"
module BlockChain
Thorium / GoogleAnalytics.ts
Last active Apr 23, 2018
Google Analytics Typescript
View GoogleAnalytics.ts
/// <reference path="./../../paket-files/borisyankov/DefinitelyTyped/" />
export var gaNewElem : any = {};
export var gaElems : any = {};
function gaInit(){
var currdate : any = new Date();
/* tslint:disable:no-string-literal */
/* tslint:disable:semicolon */
You can’t perform that action at this time.