Skip to content

Instantly share code, notes, and snippets.

@SaahilClaypool
SaahilClaypool / cloudSettings
Created March 20, 2017 15:04
Visual Studio Code Sync Settings Gist
{"lastUpload":"2017-03-20T15:04:16.360Z","extensionVersion":"v2.6.1"}
@SaahilClaypool
SaahilClaypool / cloudSettings
Last active September 27, 2018 22:58
Visual Studio Code Sync Settings Gist
{"lastUpload":"2018-09-27T22:58:03.448Z","extensionVersion":"v3.1.2"}
set noautofocus " The opposite of autofocus; this setting stops
let mapleader = ","
map K previousTab
map J nextTab
map <Leader>t :buffer<Space>
map <Leader>h :history<Space>
map <Leader>H :tabhistory<Space>
map m* setMark
@SaahilClaypool
SaahilClaypool / SelfSignedAspNetCore.md
Last active November 9, 2020 16:59
Dotnet core self signed certificate on linux

install certificates for asp.net core

openssl genrsa -des3 -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem  -addext "subjectAltName = DNS:localhost"
openssl pkcs12 -export -out certificate.pfx -inkey rootCA.key -in rootCA.pem 
openssl pkcs12 -in certificate.pfx -clcerts -out pfx.pem
sudo cp pfx.pem /usr/local/share/ca-certificates/pfx.crt
sudo cp pfx.pem /usr/share/ca-certificates/pfx.crt
sudo bash -c "echo "pfx.crt" &gt;&gt; /etc/ca-certificates.conf"
@SaahilClaypool
SaahilClaypool / JWT_Startup.cs
Created January 12, 2021 19:22
Google JWT (without secret validation)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@SaahilClaypool
SaahilClaypool / private-build-plans.toml
Last active June 6, 2021 16:27
Iosevka build plans
[buildPlans.iosevka-saapro]
family = "Iosevka SaaPro"
desc = "Hybrid, like iA Writer’s Duo"
spacing = "quasi-proportional"
no-cv-ss = true
no-ligation = false
snapshotFamily = 'iosevka-saapro'
[buildPlans.iosevka-saapro.variants]
inherits = "ss20"
@SaahilClaypool
SaahilClaypool / UnitTests.csproj
Created April 25, 2021 01:59
In-project unit tests c#
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
<!-- This stops c# from creating th stub main automatically -->
<!-- https://andrewlock.net/fixing-the-error-program-has-more-than-one-entry-point-defined-for-console-apps-containing-xunit-tests/ -->
</PropertyGroup>
@SaahilClaypool
SaahilClaypool / Result.cs
Last active September 20, 2024 07:42
C# Result & Option type
using System;
namespace Utils
{
public struct Option<T>
{
public T Value { get; set; }
public bool HasValue { get; set; }
private Option(T value, bool hasValue)
@SaahilClaypool
SaahilClaypool / either_maybe.cs
Last active June 21, 2022 01:37
EitherMaybe
public struct Maybe<T>
{
private readonly T _value;
public T Value { get => IsSome ? _value : throw new NullReferenceException(); }
public bool IsSome { get; set; }
public Maybe()
{
IsSome = false;
_value = default!;