Skip to content

Instantly share code, notes, and snippets.

View loic-sharma's full-sized avatar

Loïc Sharma loic-sharma

View GitHub Profile
@loic-sharma
loic-sharma / script.ps1
Created May 3, 2018 21:59
Script to find all packages that depend on a specific package
$package = 'Newtonsoft.Json'
$connection = "TODO..."
$done = @()
$todo = @($package.ToLowerInvariant())
while ($todo.Count -gt 0) {
$next = $todo | Select-Object -First 50
$nextIn = [string]::Join(',', @($next | % { "'$($_)'" }))
@loic-sharma
loic-sharma / Program.cs
Created May 4, 2018 20:59
Repository sign a NuGet Package
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using NuGet.Packaging.Signing;
namespace ConsoleApp7
{
using System.Threading;
using NuGet.Common;
@loic-sharma
loic-sharma / prepare.ps1
Last active October 10, 2023 20:18
Scripts to setup development VM
# Requires:
# Set-ExecutionPolicy RemoteSigned -s CurrentUser
# Install apps
iex (New-Object Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install git
scoop bucket add extras
scoop install vscode
@loic-sharma
loic-sharma / Program.cs
Last active August 3, 2018 04:32
Authenticating to a private BaGet feed using Azure Active Directory's Device Flow Authentication
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace DeviceFlow
{
class Program
using Microsoft.Azure.Search;
using Microsoft.Azure.Storage;
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading.Tasks;
namespace azs_clean
{
public class Program
BEGIN TRANSACTION;
IF NOT EXISTS (SELECT * FROM [dbo].[Dimension_PackageSet] WHERE [Name] = 'NonCommunityPackages')
BEGIN
INSERT INTO [dbo].[Dimension_PackageSet] (Name) VALUES ('NonCommunityPackages')
END
DECLARE @NonCommunityPackagesId int = (SELECT [Id] FROM [dbo].[Dimension_PackageSet] WHERE [Name] = 'NonCommunityPackages');
DELETE FROM [dbo].[Fact_Package_PackageSet]
@loic-sharma
loic-sharma / Program.cs
Last active September 11, 2019 06:47
Improving NuGetVersion parse performance
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
@loic-sharma
loic-sharma / ConsoleApp17.csproj
Last active January 22, 2020 18:13
Get the download count for all versions of a package
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Protocol" Version="5.5.0-preview.1.6319" />
</ItemGroup>
@loic-sharma
loic-sharma / ConsoleApp17.csproj
Last active January 22, 2020 19:27
Get the download count for all versions of a package
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Protocol" Version="5.5.0-preview.1.6319" />
using System;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{