Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Gaskell CGaskell

View GitHub Profile
@CGaskell
CGaskell / cumulusmx.service
Created Feb 10, 2021
Run CumulusMX as service on RaspberryPi
View cumulusmx.service
[Unit]
Description=CumulusMX
Documentation=https://cumuluswiki.org/a/Main_Page
After=network-online.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/mono-service -/home/pi/CumulusMX CumulusMX.exe -service
Type=forking
@CGaskell
CGaskell / RedirectToHTTPS.config
Created Dec 10, 2016
IIS Rewrite Rule - Redirect HTTP requests To HTTPS
View RedirectToHTTPS.config
<rewrite>
<rules>
<rule name="Redirect to https" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" negate="false" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
</rule>
</rules>
@CGaskell
CGaskell / CreateMongoDBService.bat
Created Nov 25, 2016
Quick script to create a windows servuice to run Mongo. Paths will need reviewing per install
View CreateMongoDBService.bat
--rmdir /s D:\MongoDB\Data
mkdir D:\MongoDB\Data\db
mkdir D:\MongoDB\Data\log
copy mongod.conf "D:\MongoDB\"
sc.exe delete MongoDB
sc.exe create MongoDB binPath= "\"%PROGRAMFILES%\MongoDB\Server\3.0\bin\mongod.exe\" --service --config=\"D:\MongoDB\mongod.conf\"" DisplayName= "MongoDB" start= "auto"
@CGaskell
CGaskell / OctopusNotification.html
Created Nov 17, 2016
Octopus Deployment Detail Email Template
View OctopusNotification.html
<html><body style="font-family: arial; font-size: 12px;"><h2>Deployment of #{Octopus.Project.Name} #{Octopus.Release.Number} to #{Octopus.Environment.Name}</h2><p>  <em>Initiated by    #{unless Octopus.Deployment.CreatedBy.DisplayName}#{Octopus.Deployment.CreatedBy.Username}#{/unless}    #{if Octopus.Deployment.CreatedBy.DisplayName}#{Octopus.Deployment.CreatedBy.DisplayName}#{/if}    #{if Octopus.Deployment.CreatedBy.EmailAddress} (<a href="mailto: #{Octopus.Deployment.CreatedBy.EmailAddress}">#{Octopus.Deployment.CreatedBy.EmailAddress}</a>)#{/if}    at #{Octopus.Deployment.Created}</em> <br> <a href="http://[OctoSvrUrl]/app#/projects/#{Octopus.Project.Name}/releases/#{Octopus.Release.Number}">Click here</a> to view the release detail</p>#{if Octopus.Release.Notes}<h3>Release notes</h3><p>#{Octopus.Release.Notes}</p>#{/if}<h3>Deployment process</h3><p>The deployment included the following actions:</p><ul>  #{each action in Octopus.Action}    <li><strong>#{action.Name}</strong> #{if action.Package.NuGetPacka
@CGaskell
CGaskell / MsBuild Publish WebApp
Created Nov 10, 2016
MS Build flags to run a publish to disk on a .NET web project. Useful in TC becore using octo.exe -pack to product nuget's
View MsBuild Publish WebApp
/t:Package /p:_PackageTempDir="c:/published_files/" /p:Configuration="Release" /p:DeleteExistingFiles="True"
@CGaskell
CGaskell / EnumList
Created Jul 31, 2014
Sitecore Enum Driven Dropdownlist. Uses [Description] attribute if defined.
View EnumList
using System;
using System.ComponentModel;
using Sitecore.Web.UI.HtmlControls;
namespace DetangledDigital.Sc.FieldTypes
{
/*
*
* @CGaskell
* Custom field type. Renders a dropdown list based on a specified enum.
@CGaskell
CGaskell / AliasRedirector
Created Jul 30, 2014
AliasRedirector for Sitecore. `This replaces the built in AliasResolver
View AliasRedirector
using System.Web;
using Sitecore;
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Links;
using Sitecore.Pipelines.HttpRequest;
using Sitecore.Resources.Media;
namespace DetangledDigital.SC.Pipelines
@CGaskell
CGaskell / gist:8913779
Last active Aug 29, 2015
XElementHelper Safely read and cast values provided through the System.Xml.Linq.XElement
View gist:8913779
namespace DetangledDigital.Services.Helpers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
// @CGASKELL: Some XElement helpers to assist with safely reading XML
public static class XElementHelper
{