This file contains 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
namespace Icm | |
{ | |
using System.Collections.Generic; | |
using System.Linq; | |
using Roslyn.Compilers.CSharp; | |
/// <summary> | |
/// This syntax walker collects all the calls to the specified targets. | |
/// </summary> | |
public class CallsCollector : SyntaxWalker |
This file contains 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
public class ResultCheckException : Exception | |
{ | |
public ResultCheckException(string message) | |
: base(message) | |
{ | |
} | |
} | |
/// <summary> | |
/// Utilities for retrying a block of code a number of times. |
This file contains 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
/// <summary> | |
/// For each document of a collection, remove it and add it again with a new | |
/// Id generated by a provided function. | |
/// </summary> | |
/// <param name="connectionString">MongoClient connection string.</param> | |
/// <param name="databaseName">The database name</param> | |
/// <param name="collectionName">The collection name.</param> | |
/// <param name="idFunction">The Id generation function.</param> | |
/// <returns>List of concern results.</returns> | |
public static IEnumerable<WriteConcernResult> MigrateIds( |
This file contains 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
[TestClass] | |
public class TaskTests | |
{ | |
[TestMethod] | |
public async Task Trololo() | |
{ | |
Console.WriteLine("Starting"); | |
var tokenSource = new CancellationTokenSource(); | |
var token = tokenSource.Token; | |
Task task1 = Task.Run(async () => |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Icm | |
{ | |
public class Dependency<T> where T : class | |
{ | |
public Dependency(T node, T parent = null, IEnumerable<T> dependencies = null) | |
{ |
This file contains 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
// transition:('State -> 'Input -> 'State) -> isFinish:('State -> bool) -> initialState:'State -> input:seq<'Input> -> 'State list | |
let interactiveConsole transition isFinish initialState input = | |
input | |
|> Seq.scan transition initialState | |
|> Seq.takeWhile (not << isFinish) | |
|> Seq.toList | |
// unit -> seq<string> | |
let consoleInput = | |
Seq.initInfinite (fun _ -> Console.ReadLine()) |
This file contains 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
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex | |
choco install ruby -y | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") | |
$hsg = iwr -Uri https://rubygems.org/pages/download | |
$hsg.Links | where class -eq 'download__format' | where innerText -eq 'zip' | % {iwr -Uri $_.href -OutFile rubygems.zip} | |
Expand-Archive .\rubygems.zip | |
cd rubygems | |
ls | cd | |
ruby setup.rb |
This file contains 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
@ECHO OFF | |
@REM taskkill without /f so that the icon is removed. | |
taskkill /im vpnui.exe | |
net stop vpnagent | |
net start vpnagent | |
@REM vpn_credentials.txt should have two lines, first with the username and second with the password. | |
"C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" connect rackspace-vpn.frontiersin.net -s < vpn_credentials.txt | |
START "" "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe" |
This file contains 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
public static IEnumerable<T> Merge<T, TKey>(this IEnumerable<IEnumerable<T>> lists, Func<T, TKey> selector) where TKey : IComparable<TKey> | |
{ | |
var enumerators = lists.Select(x => x.GetEnumerator()).ToList(); | |
try | |
{ | |
enumerators.RemoveAll(x => !x.MoveNext()); | |
while (enumerators.Any()) | |
{ | |
var minEnumerator = enumerators.MinBy(x => selector(x.Current))!; |
This file contains 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
<script setup lang="ts"> | |
import { ref, useTemplateRef, watch } from 'vue'; | |
import Plyr from 'plyr'; | |
import { useIntersectionObserver } from '@vueuse/core' | |
const props = defineProps<{ | |
src: string | |
poster?: string | |
time?: number | |
}>() |