Skip to content

Instantly share code, notes, and snippets.

View sergiorykov's full-sized avatar
💭
🐲

Sergio Rykov sergiorykov

💭
🐲
View GitHub Profile
public sealed class LibLogXUnitLogger : ILogProvider
{
private readonly ITestOutputHelper _output;
public LibLogXUnitLogger(ITestOutputHelper output)
{
// based on https://github.com/damianh/LibLog/blob/master/src/LibLog.Example.ColoredConsoleLogProvider/ColoredConsoleLogProvider.cs
_output = output;
}
13:17:32.312 |I| Runs | Installer started.
13:17:32.336 |I| Runs | Application created.
13:17:32.343 |I| Runs | WaveInfo: Wave: 4
13:17:32.355 |I| | For per machine install searching for conflicting installations
13:17:32.360 |I| | HasPerUserInstallations Root: C:\Users
13:17:32.364 |I| | HasPerUserInstallations Child: C:\Users\All Users
13:17:32.365 |I| | HasPerUserInstallations Checking: C:\Users\All Users\AppData\Local
13:17:32.365 |I| | HasPerUserInstallations Child: C:\Users\Default
13:17:32.365 |I| | HasPerUserInstallations Checking: C:\Users\Default\AppData\Local
13:17:32.365 |I| | HasPerUserInstallations Child: C:\Users\Default User
@sergiorykov
sergiorykov / Browser.cs
Last active September 1, 2016 14:58
Open Browser C#
using System;
using System.Diagnostics;
namespace Mojito.Core
{
public static class Browser
{
public static void Open(Uri address)
{
// http://stackoverflow.com/questions/58024/open-a-url-from-windows-forms
@sergiorykov
sergiorykov / SanitizedFileName.cs
Created September 1, 2016 14:57
Sanitized File Name C#
using System.IO;
using System.Text.RegularExpressions;
namespace Mojito.Core
{
public class SanitizedFileName
{
// https://msdn.microsoft.com/en-us/library/aa365247.aspx#naming_conventions
// http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames
private static readonly Regex removeInvalidChars = new Regex($"[{Regex.Escape(new string(Path.GetInvalidFileNameChars()))}]",
@sergiorykov
sergiorykov / UnixZipFile.cs
Last active September 9, 2016 10:18
Create zip archive on Windows for Linux/Debian with valid file names
using System.IO.Compression;
using System.Text;
namespace Mojito.Core.FileSystem
{
public static class UnixZipFile
{
public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName)
{
// http://stackoverflow.com/questions/27289115/system-io-compression-zipfile-net-4-5-output-zip-in-not-suitable-for-linux-mac
@sergiorykov
sergiorykov / QrCodeFactory.cs
Created October 15, 2016 20:21
Creates QR-code url
using System;
namespace Mojito.Core
{
public static class QrCodeFactory
{
public static Uri CreateUri(string content)
{
// Image Size 3: value 4
// Image Size 4: value 6
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace Mojito.Core.Extensions
{
public static class ResultExtensions
{
[DebuggerStepThrough]
public static async Task<Result<TValue>> OnFailureAsync<TValue>(this Result<TValue> result,
@sergiorykov
sergiorykov / sample.ini
Last active February 13, 2017 13:43
Windows Batch reads simple.ini and sets environment variables
keya=valuea
keyb=%keya%-withb
@sergiorykov
sergiorykov / _NT_SYMBOL_PATH
Created June 15, 2017 12:58 — forked from matijagrcic/_NT_SYMBOL_PATH
Process Explorer and WinDbg
#for VS
_NT_SYMBOL_PATH
SRV*C:\SYMBOLS\PUBLIC*http://referencesource.microsoft.com/symbols;SRV*C:\SYMBOLS\PUBLIC*https://msdl.microsoft.com/download/symbols
#for Process Explorer
"C:\Program Files\Windows Kits\10\Debuggers\x64\symstore" add /f "PATHTOYURPDBs\*.pdb" /s "C:\SYMBOLS\PUBLIC" /t NAME
#for Process Explorer
C:\Program Files\Windows Kits\10\Debuggers\x64\dbghelp.dll
SRV*C:\SYMBOLS\PUBLIC*http://referencesource.microsoft.com/symbols;SRV*C:\SYMBOLS\PUBLIC*https://msdl.microsoft.com/download/symbols
@sergiorykov
sergiorykov / simplest_optimization.go
Created August 17, 2017 16:14
ML gortex example
package main
import (
g "github.com/vseledkin/gortex"
"fmt"
)
func main() {
X := float32(1)
Y := float32(1)