This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Sample template to deliver events from Amazon EventBridge to CloudWatch Logs | |
| Resources: | |
| TestEventBus: | |
| Type: AWS::Events::EventBus | |
| Properties: | |
| Name: test-bus | |
| LogsRule: | |
| Type: AWS::Events::Rule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Set-CertificatePermission() | |
| { | |
| [CmdletBinding()] | |
| param | |
| ( | |
| [Parameter(Position=1, Mandatory=$true)] | |
| [ValidateNotNullOrEmpty()] | |
| [string]$ThumbPrint, | |
| [Parameter(Position=2, Mandatory=$true)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # snapshotter.ps1 - Snapshots all volumes in current region, and trims existing snapshots back to the specified number. | |
| # | |
| # USAGE: | |
| # snapshotter.ps1 [-region regionName] [-preserve numOfSnapshots] | |
| # | |
| # -region: Specify the region in which to find volumes and create snapshots. If not specified, must be specified by the environment | |
| # variable AWS_DEFAULT_REGION. | |
| # -preserve: Number of past snapshots to preserve. If not specified, defaults to 2. | |
| param ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Write-Host "Getting memory usage for w3p" | |
| $instanceId = (new-object net.webclient).DownloadString('http://169.254.169.254/latest/meta-data/instance-id') | |
| $memUsed = Get-WmiObject Win32_process -ComputerName $env:COMPUTERNAME | where CommandLine -Match "w3wp" | ForEach { "{0}" -f $_.VM } | Measure-Object -Sum | Select -ExpandProperty Sum | |
| Write-Host "W3WP memory = $memUsed on InstanceID = $instanceId" | |
| Write-Host "Pushing metrics to Cloudwatch" | |
| . aws cloudwatch put-metric-data --namespace HttpServerMetrics --metric-name HttpServerMemUtilization --dimension InstanceId=$instanceId --value $memUsed --unit "Kilobytes" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| start /wait msiexec /i Octopus.Tentacle.<version>.msi /quiet INSTALLLOCATION=C:\Octopus | |
| cd C:\Octopus\Agent | |
| tentacle configure --appdir="C:\Applications" --port=10933 --trust=<server-thumbprint> | |
| tentacle new-certificate | |
| tentacle install | |
| tentacle register-with --server=<server-url> --environment=<environment> --role=<role> --apikey=<some-user-apikey> | |
| octo deploy-release --project=<project-name> --deployto=<environment-to-deploy> --version=<version-to-deploy> --server=<server-url> --apikey=<some-user-apikey> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $frameworkDirectory = $([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) | |
| Set-Alias aspnet_regiis (Join-Path $frameworkDirectory "aspnet_regiis.exe") | |
| aspnet_regiis -pef "connectionStrings" $WebsitePhysicalPath -prov "RsaProtectedConfigurationProvider" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Set-Location $PSScriptRoot | |
| $config = (Get-Content .\run_config.json) -join "`n" | ConvertFrom-Json -ErrorAction Stop | |
| # Create website root directory. | |
| $rootExists = Test-Path -Path $config.WebsiteRootDirectory | |
| if(!$rootExists) { | |
| Write-Host "Creating root directory" -ForegroundColor Yellow -BackgroundColor Black |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #$installedCert = Add-Certificate -pfxPath "C:\dev\certs\criminalinvestigationact-dev.pfx" -pfxPassword "TAIYe76GVaRNdqxSzSje" | |
| #Write-Host $installedCert.ThumbPrint | |
| #Set-CertificatePermission -pfxThumbPrint $installedCert.ThumbPrint -serviceAccount "police\svcCiaDev" #-$containerName $installedCert.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName | |
| <# | |
| .SYNOPSIS | |
| Installs pfx certificate | |
| .DESCRIPTION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Credit: Chris Patterson http://blog.phatboyg.com/2012/11/29/idisposable-done-right/ | |
| public class DisposableClass : | |
| IDisposable | |
| { | |
| bool _disposed; | |
| public void Dispose() | |
| { | |
| Dispose(true); |