Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
function Add-AclAccessRule {
<#
.SYNOPSIS
Adds an access rule to an existing ACL on a folder or file.
.DESCRIPTION
Use .net methods to get the current ACL of the file or folder then generates a new rule
to which is added to the ACL of the file system object
.EXAMPLE
$splat = @{
Path = 'C:\Logs'
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Add-ACLAccessRule Tests" {
New-Item -Name Logs -Path 'TestDrive:' -ItemType Directory
$application = 'DevOpsTest'
@duffney
duffney / Enable-IISRemoteManagement.ps1
Created September 6, 2017 12:00
Enable-IISRemoteManagement.ps1
function Enable-IISRemoteManagement {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateScript({
if (-not (Test-Connection -ComputerName $_ -Quiet -Count 1)) {
throw "The computer [$_] could not be reached."
} else {
$true
}})]
@duffney
duffney / TeamCityAgentDSC.Build.ps1
Created September 19, 2017 12:14
TeamCityAgentDSC build script as of 9-19-2017
task . InstallDependencies, Analyze, Test, UpdateVersion, Clean, Archive
task InstallDependencies {
Install-Module Pester -Force
Install-Module PSScriptAnalyzer -Force
}
task Analyze {
$scriptAnalyzerParams = @{
Path = "$BuildRoot\DSCClassResources\TeamCityAgent\"
Resources:
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0a9ca0496f746e6e0
InstanceType: t2.micro
Tags:
- Key: Name
Value: "WinTest01"
- Key: NameOfService
  1. Edit ReplicationController or ReplicaSet.
    kubectl edit replicaset archetype
    
  2. Update Pod template to use a newer image.
    #within the config modify the template image
    #confirm settings with
    kubectl get replicaset archetype  -o yaml
    
apiVersion: apps/v1
kind: Deployment
metadata:
name: archetype-deployment
labels:
app: archetype
spec:
replicas: 3
selector:
matchLabels:
  1. Deploy v1 of the app
    kubectl apply -f archetype-deployment-and-service-recreate.yaml
    
  2. Change the .spec.template.spec.containers.image to v2
    kubectl set image deployment archetype-deployment archetype=duffney/archetype:v2
    
  3. Check pods & replicaset
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-config
labels:
app: mysql
data:
mysql_binlog_format.cnf: |
[mysqld]
binlog-format=mixed
@duffney
duffney / vscode-bootstrap.ps1
Last active January 26, 2020 12:36
CloudSkills Azure DevOps VS Code Extension Bootstrap script
code --install-extension 'wilfriedwoivre.arm-params-generator';
code --install-extension 'bencoleman.armview';
code --install-extension 'msazurermtools.azurerm-vscode-tools';
code --install-extension 'samcogan.arm-snippets';
code --install-extension 'ms-vscode.azure-account';
code --install-extension 'ms-azuretools.vscode-azurefunctions';
code --install-extension 'docsmsft.docs-markdown';
code --install-extension 'docsmsft.docs-authoring-pack';
code --install-extension 'ms-azure-devops.azure-pipelines';