Skip to content

Instantly share code, notes, and snippets.


Joel Verhagen joelverhagen

View GitHub Profile
View EntityLimitsEmulator.cs
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
namespace EntityLimits
class Program
View Output.txt
Size: 1048488 (1048576 - 1048488 = 88)... success!
Size: 1048489 (1048576 - 1048489 = 87)... Bad Request
View AsyncDisposableTest.cs
public class AsyncDisposableTest : IAsyncDisposable, IDisposable
private readonly ILogger<AsyncDisposableTest> _logger;
public AsyncDisposableTest(ILogger<AsyncDisposableTest> logger)
_logger = logger;
joelverhagen / Program.cs
Last active Sep 8, 2020
Get supported frameworks of a package
View Program.cs
using NuGet.Client;
using NuGet.ContentModel;
using NuGet.Frameworks;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.RuntimeModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
joelverhagen /
Created May 17, 2020
Convert NuGet restore logs to XES (process mining) format
import os
import collections
import urllib
from pm4py.objects.log.log import EventLog, Trace, Event
from pm4py.objects.log.exporter.xes import exporter as xes_exporter
solutionNameToSourcesToEventLog = {}
for (dirPath, dirNames, fileNames) in os.walk(r"logs"):
View standalone.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View obfuscate-usabilla.js
nuget.enableUsabilla = function (obfuscatedPath) {
// If there is an obfuscated path, hook into the outgoing AJAX request containing the feedback and obfuscate
// the URL data. This approach was provided by the Usabilla technical support.
if (obfuscatedPath) {
var obfuscatedUrl = document.createElement('a');
obfuscatedUrl.href = window.location.href;
if (obfuscatedPath.substring(0, 1) != "/") {
obfuscatedUrl.pathname = "/" + obfuscatedPath;
} else {
View gist:e31b09b46c44e23958d081f242c260c6
There are many differences between the V2 and V3 APIs. For, the main difference is how they are implemented. V2 API is built on top of SQL Server and the V3 API is built on top of Azure blob storage and Lucene for search.
As's traffic increased exponentially, it became harder and harder to mean the traffic demands with a SQL database. As you may know, Azure SQL gets very expensive as it scales up and has a maximum size it can reach. Therefore, V3 was implemented on technologies that a small team could easily manage as traffic increased. All of the V3 endpoints used for `nuget.exe restore` are implemented on top of blob storage, which has great availability, is quite cheap, and can be further improved with a CDN in front. I am glossing over details a bit but that's the key difference when V3 split off in the way it did.
V2 is a much more flexible API since it is built on top of OData and therefore supports arbitrary queries beyond the ones nuget.exe performs. For example, you can sort by
joelverhagen / ConsoleApp2.csproj
Last active Feb 4, 2019
Generate splot output
View ConsoleApp2.csproj
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
joelverhagen / Program.cs
Created Jan 31, 2019
Parallel.For and async
View Program.cs
using System;
using System.Threading.Tasks;
namespace ConsoleApp1
class Program
static void Main(string[] args)