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
| public static class ExceptionExtensions | |
| { | |
| public static T Rethrow<T>(this T exception) | |
| where T: Exception | |
| { | |
| ExceptionDispatchInfo.Capture(exception).Throw(); | |
| // it never actually gets returned, but allows to do some syntactic trick sometimes | |
| return exception; | |
| } |
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
| public static Func<string> Defer(this string message) | |
| { | |
| return () => message ?? "<null>"; | |
| } | |
| public static Func<string> Defer(Exception exception) | |
| { | |
| return () => { | |
| if (exception == null) | |
| return "<null>"; |
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
| curl -L -o 7z.exe http://bit.ly/2o0eAeK | |
| curl -L -o net20-empty.zip http://bit.ly/2y4rWM1 | |
| curl -L -o paket.cmd http://bit.ly/2yJ6lWg | |
| curl -L -o fake.cmd http://bit.ly/2nu6TcJ | |
| curl -L -o build.fsx http://bit.ly/2pksTem | |
| curl -L -o protoc.cmd http://bit.ly/2n2h8cI |
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 "System.Management.dll" | |
| module Process = | |
| open System | |
| open System.Diagnostics | |
| open System.Threading.Tasks | |
| open System.Management | |
| let fix (proc: Process option) = | |
| match proc with |
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
| rem This must be executed as administrator | |
| rem it requires double % if ran as batch file, but single % if copying-pasting lines | |
| assoc .ps1=PowerShell.Script | |
| ftype PowerShell.Script=powershell.exe -ExecutionPolicy RemoteSigned -File %%1 %%* | |
| setx PATHEXT %PATHEXT%;.PS1 | |
| rem This is just a test and may require clicking a checkbox (but only first time) | |
| echo Write-Host 'Hello from PS1' > %temp%\test.ps1 |
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
| private static IObservable<T> Observe<T>( | |
| this NetMQSocket socket, | |
| ISocketPollableCollection poller, | |
| Func<NetMQSocket, T> reader) | |
| { | |
| IEnumerable<T> ReadMany(NetMQSocket sckt) | |
| { | |
| while (sckt.HasIn) | |
| yield return reader(sckt); | |
| } |
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
| private static IObservable<string> ObserveConsole() => | |
| Observable.Create<string>( | |
| observer => { | |
| var input = new StreamReader(System.Console.OpenStandardInput()); | |
| return Observable | |
| .FromAsync(() => input.ReadLineAsync()) | |
| .Repeat() | |
| .TakeWhile(line => line != null) | |
| .Subscribe(observer!); | |
| }).Publish().RefCount(); |
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
| Param( | |
| [string] $root = "." | |
| ) | |
| $protoc_folder = "$PSScriptRoot/.tools/protoc" | |
| $protoc_executable = "$protoc_folder/bin/protoc.exe" | |
| $protoc_includes = "$protoc_folder/include" | |
| $protoc_version = "3.6.0" | |
| $protoc_url = "https://github.com/google/protobuf/releases/download/v$protoc_version/protoc-$protoc_version-win32.zip" |
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
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| function Unzip([string] $zipfile, [string] $outpath) { | |
| [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | |
| } | |
| function Download([string] $url, [string] $path) { | |
| $temp = [System.IO.Path]::GetTempFileName() | |
| Invoke-WebRequest "$url" -OutFile "$temp" | |
| Unzip "$temp" "$path" |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <TargetFramework>netstandard1.5</TargetFramework> | |
| <RootNamespace>Proto.Persistence.MySql</RootNamespace> | |
| </PropertyGroup> | |
| <PropertyGroup> | |
| <Version>0.1.14</Version> | |
| <AssemblyVersion>0.1.14</AssemblyVersion> | |
| <FileVersion>0.1.14</FileVersion> |