Skip to content

Instantly share code, notes, and snippets.

View sitereactor's full-sized avatar

Morten Christensen sitereactor

View GitHub Profile
@sitereactor
sitereactor / Root-Content.json
Created September 3, 2019 15:14
Json output of root content request to Headless on v8
{
"_creatorName": "Morten Christensen",
"_url": "/",
"_writerName": "Administrator",
"_hasChildren": true,
"_level": 1,
"_createDate": "2019-08-29T12:04:38.363Z",
"_id": "ca4249ed-2b23-4337-b522-63cabe5587d1",
"_updateDate": "2019-08-29T12:04:43.507Z",
"_links": {
Some suggestions for things to go see / experience with kids while visiting Copenhagen, Denmark.
Website about activities for kids in Copenhagen - always up-to-date.
Its in Danish so you'd need a google translator, but they list all the stuff going on currently, so you could check the week you are here or the week before.
Link: https://bornibyen.dk/koebenhavn
Tivoli obviously :)
Old historic amusement part in the central Copenhagen
https://www.tivoli.dk/en/
@sitereactor
sitereactor / Install-TopShelf-Service.ps1
Created August 30, 2018 13:22
Modified Powershell script for installing TopShelf-based Windows Services through Octopus Deploy. This script has been updated with an ArgumentList that works with username and password passed in from Variables.
$step = $OctopusParameters['Unpackage step']
$username = $OctopusParameters['Username'];
$password = $OctopusParameters['Password'];
$customExeFilename = $OctopusParameters['Exe filename'];
$outputPath = $OctopusParameters["Octopus.Action[$step].Package.CustomInstallationDirectory"]
if(!$outputPath)
{
$outputPath = $OctopusParameters["Octopus.Action[$step].Output.Package.InstallationDirectoryPath"]
}
@sitereactor
sitereactor / Install-TopShelf-Service.ps1
Created August 30, 2018 13:22
Modified Powershell script for installing TopShelf-based Windows Services through Octopus Deploy. This script has been updated with an ArgumentList that works with username and password passed in from Variables.
$step = $OctopusParameters['Unpackage step']
$username = $OctopusParameters['Username'];
$password = $OctopusParameters['Password'];
$customExeFilename = $OctopusParameters['Exe filename'];
$outputPath = $OctopusParameters["Octopus.Action[$step].Package.CustomInstallationDirectory"]
if(!$outputPath)
{
$outputPath = $OctopusParameters["Octopus.Action[$step].Output.Package.InstallationDirectoryPath"]
}
@sitereactor
sitereactor / webpi-feed.xml
Created October 4, 2017 12:59
Example of simple webpi feed used to extract a zip or install a msi
<?xml version="1.0"?>
<feed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2005/Atom">
<title>Web Platform Installer 4.0 Feed</title>
<updated>2013-12-05T16:00:10Z</updated>
<id>http://url/to/Feed.xml</id>
<link href="http://url/to/Feed.xml" />
<author>
<name>Author Name</name>
<uri>http://url</uri>
</author>
@sitereactor
sitereactor / post-checkout
Last active June 22, 2016 14:02
post-checkout hook for changing an appsetting in web.config upon checkout
#!/bin/sh
#Git hook parameters
prevHEAD=$1
newHEAD=$2
checkoutType=$3
if [ $checkoutType -eq 1 ]
then
#Set variable with name of Branch
BRANCH=$(git rev-parse --abbrev-ref HEAD)
@sitereactor
sitereactor / BulkController.cs
Created February 25, 2016 09:35
Example of an Umbraco Backoffice controller used to do a bulk upgrade of certain content items
using System.Net;
using System.Net.Http;
using Umbraco.Web.WebApi;
namespace Example.Controllers
{
/// <summary>
/// Protectec Backoffice controller - Users must be logged in to call this
/// Url: /umbraco/backoffice/api/bulk/PostPerformBulkUpdate
/// </summary>
@sitereactor
sitereactor / Start-AzureVMsOnSchedule
Created December 27, 2014 11:22
Powershell script for starting Azure VMs on a schedule in an Azure Automation runbook
workflow Start-AzureVMsOnSchedule {
param(
# The name of the VM(s) to start on schedule. Can be wildcard pattern.
[Parameter(Mandatory = $true)]
[string]$VMName,
# The service name that $VMName belongs to.
[Parameter(Mandatory = $true)]
[string]$ServiceName,
@sitereactor
sitereactor / Stop-AzureVMsOnSchedule
Created December 27, 2014 11:20
Powershell script for stopping Azure VMs on a schedule in an Azure Automation runbook
workflow Stop-AzureVMsOnSchedule {
param(
# The name of the VM(s) to start on schedule. Can be wildcard pattern.
[Parameter(Mandatory = $true)]
[string]$VMName,
# The service name that $VMName belongs to.
[Parameter(Mandatory = $true)]
[string]$ServiceName,
@sitereactor
sitereactor / MediaEventHandler.cs
Last active July 12, 2023 02:33
Renaming an image when its uploaded to a property with Alias "umbracoFile", but before its saved. The name of the image will be changed to the name of the folder it resides in. This is using the Saving event in the MediaService in Umbraco.
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Startup
{
public class MediaEventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)