This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find binding-redirects with linq-to-xml from a .config file. | |
| // This might be useful for then parsing config-changes e.g. by System.Linq.Enumerable.Except | |
| #r @"System.Xml.Linq.dll" | |
| open System.Xml.Linq | |
| let parseBindingRedirects (filename:string) = | |
| let xn s = XName.Get(s,"urn:schemas-microsoft-com:asm.v1") | |
| let xml = XDocument.Load filename | |
| let depAssemblies = xml.Descendants(xn "dependentAssembly") | |
| seq { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function tiktokTag() { | |
| try { | |
| window.TiktokAnalyticsObject = 'ttq'; | |
| var ttq = window.ttq = window.ttq || []; | |
| ttq.methods = ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie"]; | |
| ttq.setAndDefer = function(t, e) { | |
| t[e] = function() { | |
| t.push([e].concat(Array.prototype.slice.call(arguments, 0))) | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Set of little F# (FSharp) functions as script tools to work with | |
| /// - KML files (Keyhole Markup Language) used by Google Earth and Google Maps | |
| /// - Google Maps Streetview API, | |
| /// - Oculus Wander Application (by Parkline Interactive, LLC) bookmarks: Wander_Favorites.json | |
| /// You have to first set your Google API key to environment variables as api-key and enable | |
| /// Streetview API for that | |
| // System.Environment.SetEnvironmentVariable("api-key", "...") | |
| #r "nuget: FSharp.Data" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In Windows you can press WindowsKey+"." to open Emoji menu. | |
| let ``🍕`` = "🥓" + "🍍" | |
| //val ( 🍕 ) : string = "🥓🍍" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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: fssnip.net/ts/title/F-lambda-to-C-LINQ-Expression | |
| module Lambda = | |
| let toExpression (``f# lambda`` : Quotations.Expr<'a>) = | |
| ``f# lambda`` | |
| |> LeafExpressionConverter.QuotationToExpression |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module GraphVizSample | |
| open GraphVizWrapper | |
| open GraphVizWrapper.Commands | |
| open GraphVizWrapper.Queries | |
| open System | |
| open System.Configuration | |
| open System.Drawing | |
| open System.IO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open System.IO | |
| open System.Net | |
| open System.Text.RegularExpressions | |
| let req = HttpWebRequest.Create "https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml" | |
| 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 = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Take FSharp docker image and run Fake build script using Paket FSharp and Gulp. | |
| image: fsharp:latest | |
| pipelines: | |
| default: | |
| - step: | |
| script: | |
| - echo "Runs on branches that don't have specific pipeline." | |
| # Install general utilities for building | |
| - apt-get -qq update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FTPS = SSL encrypted FTP. | |
| // SFTP = FTP over SSH. | |
| // Set this as config, as the server may change the certificate. | |
| let ``trusted server certificate hash`` = "603780E732DB12D0F6BA434BA8E04D141904A165" | |
| open System | |
| open System.IO | |
| open System.Net | |
| open System.Net.Security |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // #r "../packages/SSH.NET/lib/net40/Renci.SshNet.dll" | |
| open Renci.SshNet | |
| open System.IO | |
| /// FSharp Async wrapper for SSH.NET SFTP | |
| type SftpClient with | |
| member x.ListDirectoryAsync path = | |
| Async.FromBeginEnd((fun(iar,state) -> |