Skip to content

Instantly share code, notes, and snippets.

Avatar

Nico Sap NicoJuicy

View GitHub Profile
@NicoJuicy
NicoJuicy / Message.cs
Created Sep 9, 2021 — forked from pedroreys/Message.cs
Defining a custom JsonConverter and using it with the built-in JsonConverterAttribute
View Message.cs
public class Message
{
[JsonConverter(typeof(SHA256StringJsonConverter))]
public string Password { get; set; }
}
View ProfileClaimsService.cs
public class ProfileClaimsService<TUser> : IProfileService
where TUser : class {
private readonly IUserClaimsPrincipalFactory<TUser> _claimsFactory;
private readonly UserManager<TUser> _userManager;
public ProfileClaimsService(UserManager<TUser> userManager, IUserClaimsPrincipalFactory<TUser> claimsFactory) {
_userManager = userManager;
_claimsFactory = claimsFactory;
}
@NicoJuicy
NicoJuicy / Readme.md
Created Feb 6, 2021 — forked from NickCraver/Readme.md
A simple LINQPad script I wrote for load testing SQL Server.
View Readme.md

This is a simple LINQPad script I wrote one day to load test some large SQL servers. Maybe it's useful to someone. The basic premise is defining your queries once, including which ID patterns to fetch (at the bottom), and load test a mixture. The script defines everything needed in one place, then fires up the command-line linqpad runner to run many queries at once.

Params up top:

const string LinqPadPath = @"C:\Linqpad\lprun.exe";
const bool runSequential = false;
const int defaultThreads = 1;
const int defaultIterations = 2000;
View MyExtensions.linq
<Query Kind="Program">
<NuGetReference>Newtonsoft.Json</NuGetReference>
<Namespace>Newtonsoft.Json</Namespace>
<Namespace>System.Globalization</Namespace>
</Query>
void Main()
{
// Write code to test your extensions here. Press F5 to compile and run.
}
@NicoJuicy
NicoJuicy / markdown-to-email
Created Jan 15, 2021 — forked from rtulke/markdown-to-email
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
View markdown-to-email
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---
View PredictionEngineService.cs
namespace Epi.Libraries.Commerce.Predictions
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.Linking;
View shortener.go
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
"time"
"github.com/garyburd/redigo/redis"