View outputfix.ps1
This file contains 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
$PSStyle.OutputRendering = [System.Management.Automation.OutputRendering]::PlainText |
View pipeline-example.yml
This file contains 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
variables: | |
npm_config_cache: $(Pipeline.Workspace)/.npm | |
steps: | |
#shallow depth git checkout for faster checkout and artifact download speeds | |
- checkout: self | |
fetchDepth: 10 | |
- task: Cache@2 |
View Fargate_Container_Override.ps1
This file contains 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
$envkeypair = New-Object Amazon.ECS.Model.KeyValuePair | |
$envkeypair.Name = "ENVIRONMENT_KEY" | |
$envkeypair.Value = "ENVIRONMENT_VALUE" | |
$containeroverride = New-Object Amazon.ECS.Model.ContainerOverride | |
$containeroverride.Name = "CONTAINER_NAME" | |
$containeroverride.Environment.Add($envkeypair) | |
View Show-ThisPSOddity.ps1
This file contains 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 Show-ThisPsOddity { | |
param( | |
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][ValidateSet("foo", "bar", "baz", "match")][String]$UserInput, | |
[ValidateRange(1,2)][int]$Variant = 1 | |
) | |
switch($variant) { | |
1 { if($UserInput -eq "match"){ $UserInput = @("foo", "bar", "baz") } } | |
View EnsurePlex.ps1
This file contains 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
$plexstatus = (systemctl | grep plex) | Out-String | |
if($plexstatus.length -eq 0 ){ $startplex = $true } | |
try{ $plexfind = $plexstatus.trim().Split('loaded ')[1].Split(' ')[1]} | |
catch { $plexfind = $null } | |
if ($plexfind -ne 'running') { $startplex = $true } | |
if($startplex){ | |
systemctl start plexmediaserver.service | |
Add-Content /srv/logs/plexstart.log "$(Get-Date) Started plex." | |
} else { Write-Output 'Plex check completed, no need to start plex. Exiting.' } |
View Set-S3BucketEncryption.ps1
This file contains 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-S3BucketEncryption -BucketName BucketNameGoesHere -ServerSideEncryptionConfiguration_ServerSideEncryptionRule @{ServerSideEncryptionByDefault=@{ServerSideEncryptionAlgorithm="AES256"}} |
View us-east-1-dynamic-vpc-20170904-102113.template
This file contains 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", | |
"Resources": { | |
"IGWAttachment": { | |
"Properties": { | |
"InternetGatewayId": { | |
"Ref": "InternetGateway" | |
}, | |
"VpcId": { | |
"Ref": "VPC" |
View DynamicPublicVPC.py
This file contains 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
import boto3 | |
import time | |
import os | |
from troposphere import Base64, FindInMap, GetAtt, Join, Output | |
from troposphere import Parameter, Ref, Tags, Template | |
from troposphere.ec2 import PortRange, NetworkAcl, Route, \ | |
SubnetRouteTableAssociation, Subnet, RouteTable, \ | |
VPCGatewayAttachment, VPC, NetworkInterfaceProperty, NetworkAclEntry, \ | |
SubnetNetworkAclAssociation, EIP, Instance, InternetGateway |
View Test-ReadRouting.ps1
This file contains 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
##replace variables as needed## | |
$Server = 'AvailabilityGroupListener.fqdn.com' | |
$Database = 'DatabaseInsideAvailabilityGroup' | |
$Connection = New-Object System.Data.SQLClient.SQLConnection | |
$Connection.ConnectionString = "Server=$($Server);Database=$($Database);Integrated Security=True;MultiSubnetFailover=True" | |
$Connection.Open() | |
$Command = New-Object System.Data.SQLClient.SQLCommand | |
$Command.Connection = $Connection |
View solution.py
This file contains 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
from __future__ import division | |
from __future__ import print_function | |
def answer(s): | |
if not bool(s): | |
return 0 | |
result = 0 | |
howlong = len(s) | |
i = howlong | |
while i > 0: |
NewerOlder