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 thisPosted: 13 years ago by Faisal Waris
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 thisPosted: 12 years ago by Faisal Waris
An Implementation of the Porter Stemming Algorithm in F# for text analysis. Please see: http://tartarus.org/martin/PorterStemmer/
3 people like thisPosted: 12 years ago by Faisal Waris
Shows how to generate a Gantt chart to visualize a schedule. Note: Requires BinPacking.fs found here: http://fssnip.net/hG
3 people like thisPosted: 11 years ago by Faisal Waris
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 thisPosted: 11 years ago by Faisal Waris
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)
6 people like thisPosted: 11 years ago by Faisal Waris
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 thisPosted: 10 years ago by Faisal Waris
Faster with much better quality random numbers than System.Random. See https://en.wikipedia.org/wiki/Xorshift
0 people like thisPosted: 8 years ago by Faisal Waris
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 thisPosted: 8 years ago by Faisal Waris
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 thisPosted: 7 years ago by Faisal Waris
This is a commonly used algorithm for 'market basket' type analysis. It finds frequent itemsets from a series of transactions. Frequent itemsets are the item combinations that are frequently purchased together. See usage comment for example
0 people like thisPosted: 6 years ago by Faisal Waris
ML.Net sentiment classification and cross-validation example using Gradient Boosted trees Needs to be compiled in a dotnet core F# project. Uses F# 4.6 anonymous records which work well with the ML.Net API static api
2 people like thisPosted: 5 years ago by Faisal Waris
Parses the schema string format used by the CSV Type Provider from the FSharp.Data library ...because sometimes you need the metadata. Support for names with underscore
5 people like thisPosted: 5 years ago by Faisal Waris
A good use case for demonstrating the use of active patterns
6 people like thisPosted: 4 years ago by Faisal Waris
Function that associates a time window with each element of a sequence. The resulting sequence can then be grouped by the time windows for further processing
3 people like thisPosted: 4 years ago by Faisal Waris
Replicate an AsyncSeq n-ways. The consumption rate of the resulting consumers are kept in check against each other so that a single consumer does not race too far ahead
3 people like thisPosted: 3 years ago by Faisal Waris
Fast Sudoku solver in less than 100 lines of F#
6 people like thisPosted: 3 years ago by Faisal Waris
Sample to estimate and visualize kernel densities of multiple distributions for visual comparison. Here the distributions of NY taxi fares are being compared by payment type (e.g. cash, credit card, etc.)
1 people like thisPosted: 1 year ago by Faisal Waris
Overlapping chunks from a sequence - a mix of 'windowed' and 'chunkBySize'. Useful for chopping up sequences for a variety of time-domain analysis tasks (re-write to remove deprecated F# syntax)
1 people like thisPosted: 1 year ago by Faisal Waris
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 thisPosted: 12 years ago by Faisal Waris
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 thisPosted: 12 years ago by Faisal Waris
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 thisPosted: 11 years ago by Faisal Waris
Simple symmetric key cryptogrphy. Ok for low security usages.
5 people like thisPosted: 11 years ago by Faisal Waris
An implementation of a minimum spanning tree calculation algorithm based on Kruskal's algorithm
2 people like thisPosted: 11 years ago by Faisal Waris
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 thisPosted: 10 years ago by Faisal Waris
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 thisPosted: 9 years ago by Faisal Waris
Works with System.Drawing Color
1 people like thisPosted: 8 years ago by Faisal Waris
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 thisPosted: 8 years ago by Faisal Waris
Generates the authorization header for an OAuth 1.0 enabled service. Tested with Twitter and one other API
1 people like thisPosted: 6 years ago by Faisal Waris
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 thisPosted: 5 years ago by Faisal Waris
A simple function that lets you tail log files on windows
1 people like thisPosted: 5 years ago by Faisal Waris
Shows how to use ML.Net AutoML capability for binary classification. Now with progress reporting
2 people like thisPosted: 5 years ago by Faisal Waris
invokes op_Implicit when applied (for implicit conversions). I have found this to be very convenient when using C# libraries
6 people like thisPosted: 4 years ago by Faisal Waris
Updated to use the new "nuget:..." style references. At this time a workaround is needed to properly load some of the native libraries.
1 people like thisPosted: 3 years ago by Faisal Waris
Solve a sample problem from the book "Think Bayes" by Allen B. Downey. Shows how the problem can be modeled with Infer.Net and also provide the manual solution as presented in the book. The code relies on the Infer.Net "FSharpWrapper" project which is not included in the nuget package (as of now).
4 people like thisPosted: 3 years ago by Faisal Waris
Push-relabel algorithm for Max Flow problems in flow graphs. (Does not check if graph has improper back edges)
3 people like thisPosted: 2 years ago by Faisal Waris
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
2 people like thisPosted: 1 year ago by Faisal Waris