Skip to content

Instantly share code, notes, and snippets.

View agloyd01's full-sized avatar

Adam Gloyd agloyd01

View GitHub Profile
@agloyd01
agloyd01 / psscriptanalyzer.yml
Created June 25, 2022 13:24
GitHub action config file for PSScriptAnalyzer
name: ScriptAnalyzer
on: push
jobs:
invoke-scriptanalyzer:
name: Invoke-ScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
@agloyd01
agloyd01 / terraform_debug.log
Created June 23, 2022 13:39
Debug logging for terraform validate command
2022-06-23T08:24:06.779-0500 [INFO] Terraform version: 1.2.3
2022-06-23T08:24:06.779-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.0.0
2022-06-23T08:24:06.779-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.12.0
2022-06-23T08:24:06.779-0500 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-06-23T08:24:06.779-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-06-23T08:24:06.779-0500 [DEBUG] using github.com/zclconf/go-cty v1.10.0
2022-06-23T08:24:06.779-0500 [INFO] Go runtime version: go1.18.1
2022-06-23T08:24:06.779-0500 [INFO] CLI args: []string{"/opt/homebrew/Cellar/tfenv/2.2.3/versions/1.2.3/terraform", "validate"}
2022-06-23T08:24:06.779-0500 [TRACE] Stdout is a terminal of width 185
2022-06-23T08:24:06.779-0500 [TRACE] Stderr is a terminal of width 185
@agloyd01
agloyd01 / Advanced-Function.ps1
Last active May 4, 2022 18:15
PowerShell - Advanced Function Template
Function My-Function {
<#
.NOTES
2021-06-09 - 1.0.0 - created by Adam Gloyd
.SYNOPSIS
Basic description; gist of what the function does.
.DESCRIPTION
Detailed description of what the function does and how it works.
@agloyd01
agloyd01 / Python 8 - Functions.md
Last active April 18, 2022 00:18
Notes on Python functions.

Functions

  • A process for executing a task
  • It can accept input and return an output
  • Useful way for executing similar procuderes over and over

Or it's a way to package up a bunch of lines of code and make them reusable.

Using Functions

colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo']
@agloyd01
agloyd01 / Python 7 - Tuples and Sets.md
Last active April 4, 2022 19:27
Python notes on working with Tuples and Sets
@agloyd01
agloyd01 / Python 6 - Dictionaries.md
Last active August 29, 2022 14:30
Python notes on dictionaries and dictionary comprehensions

Dictionaries and Dictionary Comprehensions

Dictionaries

Limitations of lists

Lists are great for storing simple data types, typically all of the same type. They aren't a great fit for more complex data structures.

instructor = [ "Colt", True, 4, "Python", False ]

Above is just a collection of information with no context to help us make sense of it. Dictionaries can solve that problem.

What is a dictionary?

@agloyd01
agloyd01 / Python 5 - Lists.md
Last active August 26, 2022 19:01
Python notes on lists and list comprehensions

Lists and List Comprehensions

Lists

Lists are a simple collection of data (basically an array).

List Basics

Lists are usually homegenous like this:

tasks = ["Install Python", "Learn Python", "Take a break"]
@agloyd01
agloyd01 / Python 4 - Loops.md
Created April 3, 2022 02:20
Python notes on looping

Loops

Loops act on iterable objects (objects that are collections of data) to simply performing repetitive tasks.

For

A for loop is like a for loop and foreach loop in PowerShell combined.

for item in iterable_item:
    # do something with the item
@agloyd01
agloyd01 / Python 3 - Booleans and Conditionals.md
Created April 3, 2022 02:16
Notes on Python Boolean values and conditional logic

Booleans and Conditional Logic

User Input

User input can be obtained via the input() function.

Basic example

User prompt

name = input("Enter your name here: ")
@agloyd01
agloyd01 / Python 3 - Strings.md
Created April 3, 2022 02:09
Notes on working with strings in Python

Working with Strings

Escape sequences

This is a list of standard values supported in most languges:

Character Description
\newline Backslash and newline ignored
\ Backslash ()
' Single quote (')
" Double quote (")
\a ASCII Bell (BEL)