Skip to content

Instantly share code, notes, and snippets.

<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.2" Build="11.0.5343.0">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementText="CREATE PROCEDURE nre_repo&#xD;&#xA;AS&#xD;&#xA;BEGIN&#xD;&#xA;&#x9;CREATE TABLE #replies ( Id int NOT NULL PRIMARY KEY );&#xD;&#xA;&#xD;&#xA;" StatementId="1" StatementCompId="52" StatementType="CREATE TABLE" RetrievedFromCache="true" />
<StmtSimple StatementText="&#x9;Insert Into #replies&#xD;&#xA;&#x9;exec sp_executesql N'select 1'&#xD;&#xA;&#xD;&#xA;" StatementId="2" StatementCompId="53" StatementType="INSERT EXEC" RetrievedFromCache="true" StatementSubTreeCost="0.0132841" StatementEstRows="1" StatementOptmLevel="TRIVIAL" QueryHash="0xD6FBD67832A8F4DD" QueryPlanHash="0xD754250DFD9DD669">
<StatementSetOptions QUOTED_IDENTIFIER="true" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="true" ANSI_NULLS="true" ANSI_PADDING="true" ANSI_WARNINGS="true" NUMERIC_ROUNDABORT="false" />
<QueryPlan CachedP
<#
This is a begining of a script that will allow you to install a Telligent instance onto a clean vm.
Prequisites:
* Powershell 5 - https://www.microsoft.com/en-us/download/details.aspx?id=50395
* SQL 2016 - http://go.microsoft.com/fwlink/?LinkID=799009
SQL May be automatable, needs some more work. Powershell is not easily automatable as
installation of Powershell 5 will require a reboot, which will interupt script execution
#>
#This script calculates how many PRs each person merged
param(
[Parameter(Mandatory=$true)]
[string]$PersonalAccessToken,
[Parameter(Mandatory=$true)]
[string]$OrgOrUser,
[Parameter(Mandatory=$true)]
[string]$RepoName
)
$base64Token = [Convert]::ToBase64String([char[]]$PersonalAccessToken)
@afscrome
afscrome / InstallSolr.ps1
Created November 28, 2016 23:26
Script for installing solr as a windows service
#Requires -Version 3.0
<#
.Description
Installs Apache Solr
.Example
.\ServiceInstall.ps1
Installs Apache Solr as the 'solr' service running on port 8983.
@afscrome
afscrome / BackgroundRefreshable.cs
Created June 25, 2018 16:07
Background Refreshable
using NUnit.Framework;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace BackgroundRefreshable
{
///<summary>
/// Provides support for loading, storing and refreshing a value asyncronously.
///
@afscrome
afscrome / Program.cs
Created October 23, 2019 17:28
Cosmos Slow Opening
// If you run the following with the cosmos emulator disabled, it takes about 2 minutes before the OpenAsync call fails
// Comment out the SetLocation line, and it takes about 8.
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.Azure.Documents.Client;
namespace CosmosTimeoutTest
{
@afscrome
afscrome / Program.cs
Created November 1, 2019 15:20
Cosmos Slow Networking
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
namespace Cosmos
{
class Program
{
public class BackgroundRefreshableCache<TKey, TValue>
{
public TimeSpan RefreshInterval { get; }
private readonly Func<TKey, Task<TValue>> _loader;
private ImmutableDictionary<TKey, Task<TValue>> _cache = ImmutableDictionary<TKey, Task<TValue>>.Empty;
public BackgroundRefreshableCache(Func<TKey, Task<TValue>> loader)
{
_loader = loader;
}
@afscrome
afscrome / DelayStartAnnotation.cs
Last active May 16, 2024 11:28
Aspire Readiness checks
public class DelayStartAnnotation(IResource waitForResource) : IResourceAnnotation
{
public IResource WaitForResource { get; } = waitForResource;
}
@afscrome
afscrome / ConfigFiles.cs
Last active June 10, 2024 16:44
Writing Config Files with Aspire
public record class ConfigFileContext(
DistributedApplicationModel AppModel,
Stream Stream,
CancellationToken CancellationToken
);
[DebuggerDisplay($"{{{nameof(Path)},nq}}")]
public class ConfigFileAnnotation(string path, Func<ConfigFileContext, Task> generator) : IResourceAnnotation
{
public FileInfo Path { get; } = new FileInfo(path);