Skip to content

Instantly share code, notes, and snippets.

View sergey-tihon's full-sized avatar
🦀

Sergey Tihon sergey-tihon

🦀
View GitHub Profile
#r @"packages\Streams.0.2.5\lib\Streams.Core.dll"
open System
open System.IO
open System.Collections.Generic
open Nessos.Streams
// make Visual Studio use the script directory
Directory.SetCurrentDirectory(__SOURCE_DIRECTORY__)
@sergey-tihon
sergey-tihon / gist:8325391
Created January 8, 2014 22:10
F# MongoDB sample (C# Driver)
#I @"..\packages\mongocsharpdriver.1.8.3\lib\net35\"
#r "MongoDB.Driver.dll"
#r "MongoDB.Bson.dll"
open System
open MongoDB.Bson
open MongoDB.Bson.Serialization.Attributes
open MongoDB.Driver
open MongoDB.Driver.Builders
open MongoDB.Driver.Linq
asnp *SharePoint* -ErrorAction SilentlyContinue
// URL of the Web App to change the Application Pool of.
$WebAppURL = "http://WebApp"
// name of the name Application Pool that will be created.
$NewAppPoolName = "NewAppPool"
//the user account that the Application Pool will run under the context of.
$NewAppPoolUserName = "contoso\apppool"
@sergey-tihon
sergey-tihon / data.txt
Created September 30, 2019 07:30
Fast file parser
the -0.071549 0.093459 0.023738 -0.090339 0.056123 0.32547 -0.39796 -0.092139 0.061181 -0.1895 0.13061 0.14349 0.011479 0.38158 0.5403 -0.14088 0.24315 0.23036 -0.55339 0.048154 0.45662 3.2338 0.020199 0.049019 -0.014132 0.076017 -0.11527 0.2006 -0.077657 0.24328 0.16368 -0.34118 -0.06607 0.10152 0.038232 -0.17668 -0.88153 -0.33895 -0.035481 -0.55095 -0.016899 -0.43982 0.039004 0.40447 -0.2588 0.64594 0.26641 0.28009 -0.024625 0.63302 -0.317 0.10271 0.30886 0.097792 -0.38227 0.086552 0.047075 0.23511 -0.32127 -0.28538 0.1667 -0.0049707 -0.62714 -0.24904 0.29713 0.14379 -0.12325 -0.058178 -0.001029 -0.082126 0.36935 -0.00058442 0.34286 0.28426 -0.068599 0.65747 -0.029087 0.16184 0.073672 -0.30343 0.095733 -0.5286 -0.22898 0.064079 0.015218 0.34921 -0.4396 -0.43983 0.77515 -0.87767 -0.087504 0.39598 0.62362 -0.26211 -0.30539 -0.022964 0.30567 0.06766 0.15383 -0.11211 -0.09154 0.082562 0.16897 -0.032952 -0.28775 -0.2232 -0.090426 1.2407 -0.18244 -0.0075219 -0.041388 -0.011083 0.078186 0.38511 0.23334 0.14414 -0.
@sergey-tihon
sergey-tihon / packet.lock
Last active September 24, 2019 08:28
Paket from FAKE CLI vs Paket CLI
STORAGE: NONE
RESTRICTION: == netstandard2.0
NUGET
remote: https://www.nuget.org/api/v2
BlackFox.VsWhere (1.0)
FSharp.Core (>= 4.2.3)
Fake.Core.CommandLineParsing (5.16.1)
FParsec (>= 1.0.3)
FSharp.Core (>= 4.7)
Fake.Core.Context (5.16.1)
/**************************************************************************************************
* SuperSDG v2.2 release *
* Copyright (c) 2002-2008 Ravent *
* All rights reserved *
* Нарушение авторских прав карается жесотким и мучительным угрызением совести. *
**************************************************************************************************/
#pragma comment (lib,"glut32.lib")
#pragma comment (lib,"glaux.lib")
#include <gl/glaux.h>
@sergey-tihon
sergey-tihon / OpenNlp.NET-CustomNER-Trains.fsx
Last active May 15, 2019 15:46
The sample of training custom NER model using OpenNLP.NET https://github.com/sergey-tihon/OpenNLP.NET
#load "common.fsx"
open java.nio.charset
open java.io
#I "../packages/OpenNLP.NET/lib/"
#r "opennlp-tools-1.8.4.dll"
#r "opennlp-uima-1.8.4.dll"
open opennlp.tools.util
open opennlp.tools.namefind
DefinitionName TypeName Schema
#/definitions/ODataQueryOptions[AccountApi] ODataQueryOptionsAccountApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[AccountBalanceAPI] ODataQueryOptionsAccountBalanceApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[AccountTypesAPI] ODataQueryOptionsAccountTypesApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[AllocationPeriodApi] ODataQueryOptionsAllocationPeriodApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[ArticleAccountCodingAPI] ODataQueryOptionsArticleAccountCodingApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[ArticleApi] ODataQueryOptionsArticleApi https://eaccountingapi-sandbox.test.vismaonline.com/swagger/docs/v2
#/definitions/ODataQueryOptions[ArticleLabelApi] ODataQueryOptionsArticleLabelApi htt
public static class TplHelpers
{
public static async Task<List<T2>> ExecuteInParallel<T1,T2>(this IEnumerable<T1> collection,
Func<T1, Task<T2>> processor,
int degreeOfParallelism)
{
var queue = new ConcurrentQueue<T1>(collection);
var result = new ConcurrentBag<T2>();
var tasks = Enumerable.Range(0, degreeOfParallelism).Select(async _ =>
{