Skip to content

Instantly share code, notes, and snippets.


Trevor Sullivan pcgeek86

View GitHub Profile
pcgeek86 / build-aws-vpc.ps1
Last active Jul 20, 2021
2021-07-15 Use PowerShell Imperative Commands to Create EC2 VPC with Two Public Subnets and Two Private Subnets with Internet Access
View build-aws-vpc.ps1
- Creates an Amazon Web Services (AWS) Virtual Private Cloud (VPC) in the us-west-2 (Oregon) region.
- VPC contains two public subnets and two private subnets.
- NAT Gateway is created to handle outbount Internet traffic from private subnets.
- Internet Gateway is created to handle in/outbound Internet traffic for public subnets.
- iex (iwr
function Add-EC2NameTag {
View gist:c4c48ed7589b3f6ffa2a8e5c05f9c429
# Author: Trevor Sullivan <>
# Install pip3 package manager for Python 3.x
sudo apt install python3-pip --yes
# Upgrade pip3
sudo -H pip3 install --upgrade pip
pcgeek86 / script.ps1
Created Jun 16, 2020
Use PowerShell PSTypeNames and custom FormatData to limit default properties emitted from objects
View script.ps1
$Object = [PSCustomObject]@{
FirstName = 'Trevor'
LastName = 'Sullivan'
$FormatData = @'
<?xml version="1.0" encoding="utf-8" ?>
pcgeek86 / email-domain-blacklist.txt
Created May 26, 2020
My personal list of blacklisted e-mail domains who have sent me spam.
View email-domain-blacklist.txt
pcgeek86 / gist:3842663d784f97c767d6ce57c1b2e41e
Last active Mar 18, 2020
WIP: Install Ultimaker Cura on ChromeOS v71 with Crostini (Linux apps) container support
View gist:3842663d784f97c767d6ce57c1b2e41e
# Trevor Sullivan
# I want to install Ultimaker Cura on ChromeOS, under the Crostini container environment.
# Cura is distributed officially as the Linux AppImage format, not a Debian package.
# Crostini doesn't support AppImage as of December 2018, due to dependency on FUSE, which isn't supported.
# Crostini is compatible with Debian packages.
# There is an Ubuntu Personal Package Archive (PPA) with Debian packages for Cura.
# However, Crostini starts as a Debian Stretch environment.
# The Cura package is only available for Debian Buster.
pcgeek86 / Get-YouTubeVideoRuntime.ps1
Created Feb 7, 2020
Retrieves your YouTube video run-time, in hours, using dependency-free PowerShell code
View Get-YouTubeVideoRuntime.ps1
$ErrorActionPreference = 'stop'
function Get-YouTubeChannel {
param (
[Parameter(Mandatory = $true)]
[string] $Username,
[Parameter(Mandatory = $true)]
[string] $AccessToken
pcgeek86 / Get-WavBitDepth.ps1
Created Feb 6, 2020
Get WAV file bit depth using PowerShell
View Get-WavBitDepth.ps1
# Create an empty Byte array, with a length of 1 byte
$Data = [System.Byte[]]::new(1)
# Open a FileStream to the specified file path
$Stream = [System.IO.File]::Open("$HOME/wav1.wav", [System.IO.FileMode]::Open)
# Seek to Byte 35
$null = $Stream.Seek(34, [System.IO.SeekOrigin]::Begin)
# Read a single byte, from the current position, into the specified Byte array
pcgeek86 / workspaces.ps1
Created Jan 19, 2020
Create VPC, AWS Directory Service, and Amazon WorkSpace, using AWS PowerShell module
View workspaces.ps1
$ErrorActionPreference = 'Stop'
Install-Module -Name AWS.Tools.DirectoryService, AWS.Tools.EC2, AWS.Tools.WorkSpaces -Scope CurrentUser -Force
$VPC = New-EC2Vpc -CidrBlock
pcgeek86 / powershell-ansi-color.ps1
Created Sep 14, 2019
Apply 24-bit colors to your text using PowerShell and ANSI escape sequences
View powershell-ansi-color.ps1
while ($true) {
$Red = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255
$Green = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255
$Blue = Get-Random -SetSeed (Get-Date).Ticks.ToString().Substring(10,8) -Maximum 255
Write-Host -Object ("$([char]27)[38;2;{0};{1};{2}mtrevor" -f $Red, $Green, $Blue)