Snippets created by Faisal Waris

  • Heatmap Color Generating Function

    Function to generate color values to reflect the relative intensity of numeric values in a range. --- Fixed edge case of when max=min

    4 people like this

    Posted: 7 years ago by Faisal Waris

  • Twitter OAuth

    Generates the value string for the "Authorization:" header given Twitter application/user keys and tokens and the parameters for the request being authorized. Slightly updated to allow additional oauth parameters to be included in the header. This version handles the case when the token is not yet available, i.e. when you want to request a new token/token_secret pair.

    2 people like this

    Posted: 7 years ago by Faisal Waris

  • Bin Packing

    Implementation of the 'best fit' heuristic algorithm for bin packing problems. Incudes an implementation of 'binary tree with duplicates'. See this blog post for details: http://fwaris.wordpress.com/2013/04/01/best-fit-bin-packing/ Update: Bug fixes and added 'worst fit' heuristic implementation

    5 people like this

    Posted: 6 years ago by Faisal Waris

  • Simple Crypto

    Simple symmetric key cryptogrphy. Ok for low security usages.

    5 people like this

    Posted: 6 years ago by Faisal Waris

  • Minimum Spanning Tree

    An implementation of a minimum spanning tree calculation algorithm based on Kruskal's algorithm

    2 people like this

    Posted: 6 years ago by Faisal Waris

  • Verify Azure-ACS issued OAuth Simple Web Token

    Verifies the OAuth SWT (simple web token) issued by Azure ACS The SWT may be obtained by many methods; one way is: - "How to: Request a Token from ACS via the OAuth WRAP Protocol" (http://msdn.microsoft.com/en-us/library/windowsazure/hh674475.aspx) (Note I used the userid/password method to obtain the token on behalf of a 'service identity' set up in ACS) The token is normally verifed by a 'relying party' such as an ASP.Net website hosting a Web API General ACS documentation is here: http://msdn.microsoft.com/en-us/library/gg429788.aspx

    0 people like this

    Posted: 5 years ago by Faisal Waris

  • groupAdjacent

    A variation of another snippet "Seq.groupWhen". This one groups adjacent elements based on a predicate that accepts two arguments - the previous and current elements

    5 people like this

    Posted: 5 years ago by Faisal Waris

  • xorshift128plus PRNG that mimics System.Random

    Faster with much better quality random numbers than System.Random. See https://en.wikipedia.org/wiki/Xorshift

    0 people like this

    Posted: 3 years ago by Faisal Waris

  • Observable Agent

    Extension to Control.Observable module to create an Observable linked to a MailboxProcessor. Messages posted to the mailbox are published to subscribers. Requires a cancelation token which when cancelled sends OnComplete to subscribers. Only the Post method is exposed from the internally created MailboxProcessor.

    2 people like this

    Posted: 2 years ago by Faisal Waris

  • Live chart of CNTK Error Rate

    CNTK is Microsoft's deep learning toolkit. This snippets allows one to view the live error rate on a chart. It relies on FSharp.Charting and FSharp.Control.Reactive and a couple of other F# snippets the links for which are referenced in the code. Use 'track' function to start viewing live charts.

    1 people like this

    Posted: 2 years ago by Faisal Waris

  • OAuth signed authorization header generator

    Generates the authorization header for an OAuth 1.0 enabled service. Tested with Twitter and one other API

    1 people like this

    Posted: 1 year ago by Faisal Waris

  • Sentiment Classification with ML.Net - Sample

    ML.Net sentiment classification example using Gradient Boosted trees Needs to be compiled in a dotnet core F# project Uses F# 4.1 struct tuples which is required by the ML.Net API

    2 people like this

    Posted: 10 months ago by Faisal Waris

  • unix-like tail function

    A simple function that lets you tail log files on windows

    1 people like this

    Posted: 10 months ago by Faisal Waris

  • Seq strided chunks

    Overlapping chunks from a sequence - a mix of 'windowed' and 'chunkBySize'. Useful for chopping up sequences for a variety of time-domain analysis tasks

    1 people like this

    Posted: 7 months ago by Faisal Waris

  • Sankey Diagram extension to FSharp.Plotly

    Extension of FSharp.Plotly to draw Sankey diagrams by leveraging the underlying capability offered by Plotly.js

    3 people like this

    Posted: 5 months ago by Faisal Waris

  • Configure F# Interactive to use Microsoft.ML.Net

    Until FSI gets package references, we are to reference DLLs individually. This script sets up the FSI session to use ML.Net - assuming the required packages are loaded in the default location for the solution. Normally, referencing the latest AutoML and TimeSeries packages will net all the packages listed here.

    2 people like this

    Posted: 9 days ago by Faisal Waris