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
string json = """ | |
{ "X": 123, "Y": { "Y1": 1, "Y2": 2 } } | |
"""; | |
JsonSerializerOptions options = new(JsonSerializerDefaults.General) { WriteIndented = true }; | |
string formatted = JsonSerializer.Serialize(JsonSerializer.Deserialize<JsonElement>(json), options); | |
Console.WriteLine(formatted); | |
/* output: | |
{ | |
"X": 123, | |
"Y": { |
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
// <auto-generated/> | |
#nullable enable | |
#pragma warning disable CS0612, CS0618 // Suppress warnings about [Obsolete] member usage in generated code. | |
namespace System.Runtime.CompilerServices | |
{ | |
using System; | |
using System.CodeDom.Compiler; | |
[GeneratedCode("Microsoft.Extensions.Configuration.Binder.SourceGeneration", "8.0.8.47906")] |
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
#! /bin/bash | |
roleArn='arn:aws:iam::xxxx:role/xxxx' | |
serialNumber='arn:aws:iam::xxxx:mfa/xxxx' | |
assumerole() { | |
read -p "Enter mfa code: " mfacode | |
d=`date "+%Y%m%d%H%M%S"` | |
aws sts assume-role --role-arn $roleArn --serial-number $serialNumber --role-session-name cli${date} --token-code ${mfacode} | |
} |
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
// See https://aka.ms/new-console-template for more information | |
using System.Text; | |
using CodeHollow.FeedReader; | |
const int readCountPerFeed = 10; | |
string[] sites = new[] | |
{ | |
"https://feed.infoq.com/", |
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
<Project> | |
<PropertyGroup> | |
<Nullable>enable</Nullable> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<LangVersion>latest</LangVersion> | |
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |
<AnalysisMode>All</AnalysisMode> | |
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> | |
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | |
</PropertyGroup> |
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
# EditorConfig is awesome: https://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Don't use tabs for indentation. | |
[*] | |
indent_style = space | |
# (Please don't specify an indent_size here; that has too many unintended consequences.) |
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 FreezableObjectAttribute : Attribute | |
{ | |
public bool GenerateRecord { get; set; } | |
} | |
public class PocoFreezerGenerated : Attribute{} |
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.Diagnostics; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.ExceptionServices; | |
using System.Security; | |
using System.Security.Permissions; | |
using System.Threading; |
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.Numerics; | |
namespace Collatz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var n = new BigInteger(2); |
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 class MessagePackSerializerEx | |
{ | |
public static IEnumerable<T> LazyDeserializeArray<T>(ReadOnlyMemory<byte> bytes, | |
MessagePackSerializerOptions? options = null) | |
{ | |
options ??= MessagePackSerializer.DefaultOptions; | |
if (options.Compression != MessagePackCompression.None) | |
{ | |
throw new InvalidOperationException("lz4 圧縮には対応できません"); |
NewerOlder