Skip to content

Instantly share code, notes, and snippets.

View NicoJuicy's full-sized avatar

Nico Sap NicoJuicy

View GitHub Profile
@NicoJuicy
NicoJuicy / shortener.go
Created March 10, 2016 12:23
URL shortener
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
"time"
"github.com/garyburd/redigo/redis"
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;
@NicoJuicy
NicoJuicy / markdown-to-email
Created January 15, 2021 23:07 — 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.
#!/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
---
@NicoJuicy
NicoJuicy / MyExtensions.linq
Created February 6, 2021 00:22 — forked from emptyother/MyExtensions.linq
Linqpad extensions
<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 / Readme.md
Created February 6, 2021 01:34 — forked from NickCraver/Readme.md
A simple LINQPad script I wrote for load testing SQL Server.

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;
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 / Message.cs
Created September 9, 2021 11:11 — forked from pedroreys/Message.cs
Defining a custom JsonConverter and using it with the built-in JsonConverterAttribute
public class Message
{
[JsonConverter(typeof(SHA256StringJsonConverter))]
public string Password { get; set; }
}
@NicoJuicy
NicoJuicy / split-pull-requests.md
Created February 24, 2023 10:59 — forked from loilo/split-pull-requests.md
Split a large pull request into two