Skip to content

Instantly share code, notes, and snippets.

View he-dev's full-sized avatar
😵
ღ(¯`◕‿◕´¯) ♫ ♪ ♫

ᎬᏁᎶᎥᏁᎬᎬᏒ he-dev

😵
ღ(¯`◕‿◕´¯) ♫ ♪ ♫
  • ƃǝɹɯɐnʎ, ɔoןoƃnǝ
View GitHub Profile
@he-dev
he-dev / custom.app.config.xml
Created October 25, 2015 18:32
Custom app.config
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<PostBuildEvent>xcopy "$(ProjectDir)custom.app.config" "$(TargetDir)Application.config" /Y</PostBuildEvent>
</PropertyGroup>
using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes;
namespace Test {
public class PalindromNumber {
//Thanks to @Velial and @Denis
@he-dev
he-dev / repo-reset.md
Created November 19, 2017 13:55 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@he-dev
he-dev / repo-reset.md
Created November 19, 2017 13:55 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@he-dev
he-dev / DictionaryJsonConverter
Created March 27, 2018 16:36 — forked from petermorlion/DictionaryJsonConverter
Generic JsonConverter for JSON.NET and IDictionaries
// UPDATE!
// In Json.NET 7, a DictionaryKeyResolver was added.
// This might be able to fix the problem more elegantly.
// I haven't checked though.
public class DictionaryJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var dictionary = (IDictionary)value;
@he-dev
he-dev / outT.cs
Last active April 5, 2018 10:49
outT.cs
interface IRequest<out T>
{
T Create();
}
class WebRequest<T> : IRequest<T>
{
public virtual T Create() { return default; }
}
@he-dev
he-dev / SelectManyAsync.cs
Created February 15, 2019 16:18
SelectManyAsync test-case
void Main()
{
var tasks = new[]
{
Task.FromResult(new [] {1, 2, 3}.Select(x => Task.FromResult(x))),
Task.FromResult(new [] {4, 5, 6}.Select(x => Task.FromResult(x))),
};
tasks.SelectManyAsync().Select(t => t.GetAwaiter().GetResult()).Dump();
}
@he-dev
he-dev / ExceptionPrettifier-v4.cs
Created March 22, 2021 13:36
ExceptionPrettifier for prettier exception strings
void Main(params string[] args)
{
try
{
try
{
Printery.Print("abc");
}
catch (Exception ex)
{
@he-dev
he-dev / README.md
Created April 28, 2023 09:06 — forked from marcelaraujo/README.md
Convert P12 to PEM and extract RSA public and private keys

Convert P12 into PEM

openssl pkcs12 -in google-service-account-key.p12 -nocerts -nodes -out google-service-account-key.pem

openssl pkcs12 -in google-service-account-key.p12 -clcerts -nokeys -out google-service-account-crt.pem

Private RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa

Public RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa.pub -pubout