Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Threading;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
public class C {
public ValueTask<int> ReceiveFromAsync(
Memory<byte> buffer,
SocketFlags socketFlags,
@fredrikhr
fredrikhr / DotnetCommandLineApiBindCommandLine.cs
Last active March 19, 2024 08:31
Using BindCommandLine for options in dotnet/command-line-api
using System;
using System.CommandLine;
using System.CommandLine.Binding;
using System.CommandLine.Builder;
using System.CommandLine.Hosting;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.CommandLine.Parsing;
using System.Threading;
using System.Threading.Tasks;
@fredrikhr
fredrikhr / GoogleOrToolsDotnetCore.dockerfile
Last active June 24, 2020 22:02
GoogleOrToolsDotnetCore
# docker build -t fredrikhr/googleortools-tsp-sample-dotnetcore -f GoogleOrToolsDotnetCore.dockerfile https://gist.github.com/6cae577fcedba6311402c7e4ccefc021.git
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
WORKDIR /app/GoogleOrToolsDotnetCore
# Install curl
RUN set -x \
# APT Update & Upgrade
&& apt-get update \
&& apt-get upgrade --yes 2>&1 \

Create Windows Terminal shortcut in Windows + X context menu

Windows Terminal shortcut in WinX context menu

In Windows PowerShell do the following:

$folderPath = "$ENV:LOCALAPPDATA\Microsoft\Windows\WinX\Group3"
$adminFilePath = Join-Path $folderPath "00 - Windows Terminal.lnk"
$normalFilePath = Join-Path $folderPath "00a - Windows Terminal.lnk"
@fredrikhr
fredrikhr / .editorconfig
Last active February 7, 2020 18:17
Eto.Forms Cross-platform sample
root = true
# Defaults
[*]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.{xml,json,js,ts,jsx,tsx,vue,css,styl,*proj,targets,html,props,yml,nim,nimble,nim.cfg,wsdl,wadl,cmake}]
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<UserSecretsId>0864c15e-1de4-426a-97df-a43cb2700536</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.2.0" />
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.3.100.5" />