Skip to content

Instantly share code, notes, and snippets.

View DarranShepherd's full-sized avatar

Darran Shepherd DarranShepherd

View GitHub Profile
@DarranShepherd
DarranShepherd / index.css
Last active December 19, 2019 18:21
Collapsible Sidebar
html,
body {
height: 100%;
margin: 0;
}
#wrapper {
display: flex;
height: 100%;
}
namespace Foo
{
[TableName("sequences")]
public class SequenceTableEntity : TableEntity
{
public static string CreatePartitionKey() => "DefaultPartitionKey";
public static string CreateRowKey(string name) => name.ToLowerInvariant();
public SequenceTableEntity() { }
public SequenceTableEntity(string name) : base(CreatePartitionKey(), CreateRowKey(name)) { }
public long Value { get; set; }
@DarranShepherd
DarranShepherd / ExpiringCerts.ps1
Last active April 25, 2017 12:38
List service principal certificates expiring in the next 7 days
Get-AzureRmADApplication |% {
$app = $_;
Get-AzureRmADAppCredential -ApplicationId $_.ApplicationId `
| Where-Object { $_.Type -eq "AsymmetricX509Cert" -and (Get-Date $_.EndDate) -lt (Get-Date).AddDays(7) } |% {
Write-Host "Cert for application $($app.DisplayName) ($($app.ApplicationId)) expires on $($_.EndDate)"
}
}
@DarranShepherd
DarranShepherd / iisexpresscert.ps1
Created April 20, 2017 15:15
New IIS Express self signed certificates
# Create new self signed cert with SAN
$cert = New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -DnsName localhost
$thumbprint = $cert.Thumbprint
# Add self-signed cert to trusted roots
Export-Certificate -Cert $cert -FilePath .\root.crt
Import-Certificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath .\root.crt
Remove-Item .\root.crt
# Get current configurations
public abstract class MyBaseClass { }
public class DerivedClass : MyBaseClass { }
public class SubjectClass
{
private readonly IGenericFoo foo;
public SubjectClass(IGenericFoo foo)
{
@DarranShepherd
DarranShepherd / GenericConstraintsWithReflection.cs
Created September 30, 2014 13:48
Calling a constrained generic method from another generic method without constraints
namespace ExploratoryUnitTests
{
using Machine.Specifications;
public interface IFoo
{
}
public interface IBar : IFoo
{
@DarranShepherd
DarranShepherd / Program.cs
Created September 28, 2014 18:10
C# USB HID example for mbed using hidlibrary
namespace UsbHid
{
using System;
using System.Linq;
using System.Threading;
using HidLibrary;
public class Program
{
@DarranShepherd
DarranShepherd / TrelloTest
Created September 25, 2014 20:54
Trello challenge performance comparison
namespace TrelloTest
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
public class Program
{
private const long ChallengeHash = 956446786872726;