Skip to content

Instantly share code, notes, and snippets.

@dibble-james
dibble-james / clean-branches.ps1
Created March 19, 2022 21:48
A powershell function to delete pushed branches from a local git repo
function clean-branches([Switch]$d = $false) {
if (-not $d) {
Write-Host "Dry-Run, would delete:"
}
git branch -vv | where {$_ -match '\[origin/.*: gone\]'} | foreach {
$branch = $_.split(" ", [StringSplitOptions]'RemoveEmptyEntries')[0]
if ($d) {
git branch -D ($branch)
} else {
@dibble-james
dibble-james / sync-time.ps1
Created January 27, 2020 19:57
Sync Docker Desktop with Host
$datetime = Get-Date; $dt = $datetime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss');
docker run --net=host --ipc=host --uts=host --pid=host --security-opt=seccomp=unconfined --privileged --rm alpine date -s $dt
public class UmbracoStandardOwinStartup : UmbracoDefaultOwinStartup
{
private readonly static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
private readonly static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
private readonly static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
private readonly static string authority = aadInstance + tenantId;
private readonly static string loginUrl = ConfigurationManager.AppSettings["ida:PostLoginUrl"];
public override void Configuration(IAppBuilder app)
{
public static class UmbracoADAuthExtensions
{
/// <summary>
/// Configure ActiveDirectory sign-in
/// </summary>
/// <param name="app"></param>
/// <param name="tenant"></param>
/// <param name="clientId"></param>
/// <param name="postLoginRedirectUri">
@dibble-james
dibble-james / web.config
Created April 26, 2016 07:34
Umbraco AAD appsettings
<add key="ida:ClientId" value="" />
<add key="ida:AADInstance" value="https://login.microsoftonline.com/" />
<add key="ida:Domain" value="xxxxx.onmicrosoft.com" />
<add key="ida:TenantId" value="" />
<add key="ida:PostLoginUrl" value="https://localhost:44383/umbraco"/>
@dibble-james
dibble-james / Startup.cs
Created April 9, 2016 21:12
OWIN Middleware configuration for use with LetsEncrypt
using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Owin;
using Umbraco.Web;
public class Startup : UmbracoDefaultOwinStartup
{
public override void Configuration(IAppBuilder app)
{
app.Map("/.well-known", letsEncrypt =>
@dibble-james
dibble-james / Publish.ps1
Last active January 22, 2016 22:12
A Publish script for Azure Websites with multiple hostnames
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# Debug dump the enabled hostnames on the site to check it has an scm
Write-Host "Enabled Host Names"
foreach($hostname in $website.EnabledHostNames)
{
Write-Host "$hostname`n"
}
@dibble-james
dibble-james / Parameters.xml
Created June 28, 2015 19:57
Basic example of a file to create additional MSDeploy parameters
<?xml version="1.0" encoding="utf-8" ?>
<parameters>
<parameter name="ApplicationName" description="Please enter the Application Name" defaultvalue="" tags="">
<parameterentry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='ApplicationName']/@value">
</parameterentry>
</parameter>
</parameters>
@dibble-james
dibble-james / RollbarMiddleware.cs
Created June 21, 2015 16:09
Rollbar Middleware example
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Runtime;
using RollbarSharp;
@dibble-james
dibble-james / RollbarMiddleware.cs
Created June 21, 2015 16:09
Rollbar Middleware example
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Runtime;
using RollbarSharp;