Skip to content

Instantly share code, notes, and snippets.

View ApmeM's full-sized avatar

Artem Votintsev ApmeM

View GitHub Profile
namespace App_Code
{
using System;
using System.IdentityModel.Tokens;
using Microsoft.IdentityModel.Claims;
using Microsoft.IdentityModel.Protocols.WSIdentity;
using Microsoft.IdentityModel.Tokens;
public class CustomUserNameSecurityTokenHandler : UserNameSecurityTokenHandler
@ApmeM
ApmeM / certificate_generator.cs
Last active November 26, 2022 09:05
Generate certificates in .Net using BouncyCastle
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
@ApmeM
ApmeM / net.bat
Created November 10, 2020 18:46
Run .Net framework code from command line with a single bat file
/*
rem This is the part for .bat file.
rem It will be ignored by C# compiler (csc)
echo off
rem Find csc compiler location
rem (if you know how to make it correctly - please notice me at artem.votincev@gmail.com)
set WinDirNet=%WinDir%\Microsoft.NET\Framework
@ApmeM
ApmeM / merge_cs_files.bat
Last active June 28, 2020 09:18
Bat file that compiles and execute .net c# code in it to merge all cs files in a folder with subfolders into singe result file.
/*
rem This is the part for .bat file.
rem It will be ignored by C# compiler (csc)
rem Find csc compiler location
rem (if you know how to make it correctly - please let me know at artem.votincev@gmail.com)
IF EXIST "%WinDir%\Microsoft.NET\Framework\v2.0.50727\csc.exe" set csc="%WinDir%\Microsoft.NET\Framework\v2.0.50727\csc.exe"
IF EXIST "%WinDir%\Microsoft.NET\Framework\v3.5\csc.exe" set csc="%WinDir%\Microsoft.NET\Framework\v3.5\csc.exe"
IF EXIST "%WinDir%\Microsoft.NET\Framework\v4.0.30319\csc.exe" set csc="%WinDir%\Microsoft.NET\Framework\v4.0.30319\csc.exe"