Snippets created by Faisal Waris

  • Twitter Stream API

    Twitter now provides a streaming API which can be used to obtain a continuous stream of tweets on any set of topics, locations, etc., in real time. Read the full details here. It would be nice to convert this stream into an F# sequence so that it can be treated just as any other sequence if F#. This provides “composability”; separation of the generation of a sequence from its consumption. Here is a snippet that does that.

    12 people like this

    Posted: 5 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.

    0 people like this

    Posted: 4 years ago by Faisal Waris

  • Porter Stemmer

    An Implementation of the Porter Stemming Algorithm in F# for text analysis. Please see: http://tartarus.org/martin/PorterStemmer/

    3 people like this

    Posted: 4 years ago by Faisal Waris

  • Gantt Chart Visualization

    Shows how to generate a Gantt chart to visualize a schedule. Note: Requires BinPacking.fs found here: http://fssnip.net/hG

    3 people like this

    Posted: 4 years ago by Faisal Waris

  • Amazon S3 API

    Partial wrapper for Amazon S3 for both the Web and SOAP APIs. Generates signatures for both APIs (which was the tricky part). Uses WSDL Type Provider for SOAP. Uses SOAP for bucket list and delete operations and WebAPI to upload/download object contents (streamed / async)

    4 people like this

    Posted: 3 years ago by Faisal Waris

  • Tiny Logging Module

    High performance asynchronous Logging module with time-based rollover and size-based file retention in under a 100 lines of F# Bug fix: Fixed log file name date time from "yyyyMMddhhmm" to yyyyMMddHHmm" (24 hour clock)

    4 people like this

    Posted: 3 years ago by Faisal Waris

  • Alternative Actor Implementation for Android

    Actor implementation (much simplified) intended for use on mobile devices. Seems to provide better memory usage behavior than native F# Mailbox Processors (MPB) (on Android). Though is not as 'smooth' as native F# MBP. Smoothness here refers to how processing is balanced between consumers and producers (most relevant to single core machines).

    8 people like this

    Posted: 3 years ago by Faisal Waris

  • Cross Join Lists

    Given a list of lists, the function crossJoin outputs all combination of elements from the inner lists, i.e. each combination is a list which contains elements from each of the inner lists in the input. Note: Order is not preserved

    3 people like this

    Posted: 2 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: 8 months 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: 8 months 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: 7 months ago 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: 5 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: 4 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: 4 years ago by Faisal Waris

  • Simple Crypto

    Simple symmetric key cryptogrphy. Ok for low security usages.

    5 people like this

    Posted: 4 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: 3 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: 3 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: 3 years ago by Faisal Waris

  • Csv Type Provider Schema Parser

    Parses the schema string format used by the CSV Type Provider from the FSharp.Data library ...because sometimes you need the metadata.

    4 people like this

    Posted: 1 years ago by Faisal Waris

  • Heatmap Color generation for RGB Colors

    Works with System.Drawing Color

    0 people like this

    Posted: 8 months ago by Faisal Waris

  • CNTK Log File Parser

    Parser for CNTK error log file (see https://www.microsoft.com/en-us/research/product/cognitive-toolkit/) tested with version 2.0 beta. The parser can be combined with other tooling such as F# chart to view live error rates, etc. (includes a unix 'tail' like function)

    1 people like this

    Posted: 8 months ago by Faisal Waris

  • Seq extensions for cross tabulation and pivot tables

    a) Organize a sequence into a table of aggregations by rows and columns. b) convert raw crosstab data into a DataTable

    3 people like this

    Posted: yesterday by Faisal Waris