Skip to content

Instantly share code, notes, and snippets.

View techthoughts2's full-sized avatar
🕵️‍♂️
Investigating a better artifact workflow

Jake Morrison techthoughts2

🕵️‍♂️
Investigating a better artifact workflow
View GitHub Profile
$P = $env:TEMP + '\chrome_installer.exe'; Invoke-WebRequest 'https://dl.google.com/chrome/install/latest/chrome_installer.exe' -OutFile $P; Start-Process -FilePath $P -Args '/silent /install' -Verb RunAs -Wait; Remove-Item $P
[io.file]::Create("$env:temp\reallybigfile-deleteme.txt").SetLength((gwmi Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace - 1KB).Close
// This is a comment
/*
This is a section of comments
*/
Console.Read(); //this is an inline comment
int aNumber = 0; //declare value type variable
//casting
float num1 = 20.9;
Get-InstalledModule | Select-Object Name, @{n='Installed';e={$_.Version}}, @{n='Available';e={(Find-Module -Name $_.Name).Version}} | Where-Object {$_.Available -gt $_.Installed}
@techthoughts2
techthoughts2 / route53.yml
Created March 22, 2019 14:44
Creates an Amazon Route 53 hosted zone
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates an Amazon Route 53 hosted zone
Parameters:
DomainName:
Type: String
Description: The DNS name of an Amazon Route 53 hosted zone e.g. jevsejev.io
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-)
ConstraintDescription: must be a valid DNS zone name.
Resources:
DNS:
@techthoughts2
techthoughts2 / S3Site.yml
Created March 22, 2019 14:43
Creates an S3 bucket configured for hosting a static website, and a Route 53 DNS record pointing to the bucket
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates an S3 bucket configured for hosting a static website, and a Route
53 DNS record pointing to the bucket
Parameters:
DomainName:
Type: String
Description: The DNS name of an existing Amazon Route 53 hosted zone e.g. jevsejev.io
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-)
ConstraintDescription: must be a valid DNS zone name.
FullDomainName:
@techthoughts2
techthoughts2 / StaticSite.yml
Created March 22, 2019 14:42
Resources for hosting a static website (generated with Hugo for example) on Amazon Simple Storage Service (S3) & CloudFront.
AWSTemplateFormatVersion: 2010-09-09
Description: >
Resources for hosting a static website (generated with Hugo for example) on
Amazon Simple Storage Service (S3) & CloudFront.
###############################################################################
Parameters:
###############################################################################
AcmCertificateArn:
#---------------------------------------------------------------
# Evaluating if a Parameter Set has been used
if ($PSCmdlet.ParameterSetName -eq 'InstanceId') {
$target = @{Key = 'instanceids'; Values = $managedInstanceId}
}
else {
$target = @{Key = "tag:$tagName"; Values = $TagValue}
}
#---------------------------------------------------------------
#controlling multiple dependencies of parameter choices example
#region functions
function Convert-PSToVSCodeSnippet {
<#
.SYNOPSIS
Converts PowerShell Code to VSCode snippet format
.DESCRIPTION
Leverages the ConvertTo-VSCodeSnippet script available on PSGallery to convert PowerShell code to properly formatted VSCode snippet JSON
.EXAMPLE
Convert-PSToVSCodeSnippet -Name 'MySnippet' -Body $body -Prefix 'MyPrefix' -Description 'MyDescription'
https://github.com/SeeminglyScience/EditorServicesCommandSuite
Install-Module EditorServicesCommandSuite -Scope CurrentUser -AllowPrerelease -RequiredVersion 1.0.0-beta4
# Place this in your VSCode profile
Import-CommandSuite