Skip to content

Instantly share code, notes, and snippets.

View DamianMac's full-sized avatar
😃
Doing too much at once.

Damian Maclennan DamianMac

😃
Doing too much at once.
View GitHub Profile
@DamianMac
DamianMac / docker-compose.yml
Last active February 14, 2023 18:38
Seq and Nginx and Letsencrypt
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
restart: unless-stopped
container_name: nginx-proxy
ports:
- 80:80
@DamianMac
DamianMac / build.sh
Created March 1, 2018 05:04
Cake .NET Core 2.0 bootstrapper
#!/usr/bin/env bash
##########################################################################
# This is a Cake bootstrapper script for Linux and OS X and netcore 2.0.
# Taken and tweaked a little from
# https://adamhathcock.blog/2017/07/12/net-core-on-circle-ci-2-0-using-docker-and-cake/
##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
CAKE_VERSION=0.26.0
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
# Update Windows and reboot if necessary
Install-WindowsUpdate -AcceptEula
if (Test-PendingReboot) { Invoke-Reboot }
#Disable hibernate
@DamianMac
DamianMac / Queryprojectslifecycles.ps1
Last active April 6, 2016 13:30
Query and Update Octopus Deploy projects and lifecycles
$server = " http://yourserver/" #your octopus server
$apiKey = "API-YOURAPIKEY" #you'll need to generate an API
$command = $($server + "/api/projects")
$projects = Invoke-RestMethod -Method Get -Uri $command -Header @{"X-Octopus-ApiKey"=$apiKey}
$projects.Items | Format-Table Id, Name, lifecycleId
$command = $($server + "/api/lifecycles")
@DamianMac
DamianMac / keybase.md
Created May 26, 2015 23:39
keybase.md

Keybase proof

I hereby claim:

  • I am damianmac on github.
  • I am damianm (https://keybase.io/damianm) on keybase.
  • I have a public key whose fingerprint is 67AF B8C1 EAD1 A004 1018 5FD4 275B 9389 C485 BF68

To claim this, I am signing this object:

@DamianMac
DamianMac / logoupload.ps1
Created April 14, 2015 01:36
Upload Project Logo to Octopus Deploy with Powershell
$octopusServerUri = "http://serveraddress"
$octopusApiKey = "API-APIKEY"
$projectId = "projects-1"
$filePath = "D:\photos\picture.jpg"
Write-Verbose "Attempting to push a new logo"
$logoUri = "$octopusServerUri/api/projects/$projectID/logo?apikey=$octopusApiKey"
Write-Host $logoUri
@DamianMac
DamianMac / DbUp.cs
Last active November 22, 2021 14:02
DbUp Config to exec all stored procedure scripts from a directory
var upgrader =
DeployChanges.To
.SqlDatabase(connectionString)
.JournalTo(new NullJournal()) //means the execution won't get logged, so each script is run each time
.WithScriptsFromFileSystem("D:\\mystoredprocs\\")
.LogToConsole()
.Build();
var result = upgrader.PerformUpgrade();
@DamianMac
DamianMac / gist:8211c53211136e88e9fe
Created December 14, 2014 02:13
Set directory permissions with powershell
#create share and set permissions
New-Item -ItemType Directory $sharePathname
$inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
$propagation = [system.security.accesscontrol.PropagationFlags]"None"
$permission = 'IIS_IUSRS',"FullControl", $inherit, $propagation, "Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
@DamianMac
DamianMac / gist:cab420adb9f9a915b028
Created October 30, 2014 04:13
Create a release with Octopus Client API
var server = "http://yourserveraddress:8065/"; //Your server and IP address
var apiKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXX"; // Get this from your 'profile' page in the Octopus web portal
var endpoint = new OctopusServerEndpoint(server, apiKey);
var repository = new OctopusRepository(endpoint);
var projectId = "projects-225"; //your project id
//This pulls out the info you need, the same call that's made on the Create Release page in the UI
var template = repository.Client.Get<Octopus.Client.Model.ReleaseTemplateResource>("/api/deploymentprocesses/deploymentprocess-" + projectId + "/template");
@DamianMac
DamianMac / gist:a944c0fcab6db531e7a5
Created October 30, 2014 02:16
Executing a Script Task via the Octopus API
var server = "http://yourserveraddress:8065/"; //Your server and IP address
var apiKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXX"; // Get this from your 'profile' page in the Octopus web portal
var endpoint = new OctopusServerEndpoint(server, apiKey);
var repository = new OctopusRepository(endpoint);
var task = new Octopus.Client.Model.TaskResource();
task.Name = "AdHocScript";
task.Description = "Script invoked via API";