Skip to content

Instantly share code, notes, and snippets.

Avatar
🍺
🥓

Trevor Sullivan pcgeek86

🍺
🥓
View GitHub Profile
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active May 19, 2022
PowerShell Cheat Sheet / Quick Reference
View cheatsheet.ps1
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@pcgeek86
pcgeek86 / Car Manufacturers.json
Last active May 18, 2022
Plain-text list of major car manufacturers
View Car Manufacturers.json
[
"Abarth",
"Alfa Romeo",
"Aston Martin",
"Audi",
"Bentley",
"BMW",
"Bugatti",
"Cadillac",
"Chevrolet",
@pcgeek86
pcgeek86 / webp_animation_to_gif.py
Last active May 12, 2022
Convert an animated .webp file to GIF with Python
View webp_animation_to_gif.py
#!/usr/bin/env python3
# Trevor Sullivan <trevor@trevorsullivan.net>
# https://trevorsullivan.net
# https://twitter.com/pcgeek86
# IMPORTANT: Install the webp Python package, using the following command:
# pip3 install --user webp
# Import the webp package
@pcgeek86
pcgeek86 / install_go_pi.sh
Last active Apr 21, 2022 — forked from random-robbie/install_go_pi.sh
Install Go Lang on Raspberry Pi
View install_go_pi.sh
cd $HOME
FileName='go1.13.4.linux-armv6l.tar.gz'
wget https://dl.google.com/go/$FileName
sudo tar -C /usr/local -xvf $FileName
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@pcgeek86
pcgeek86 / AWS Cleanup.ps1
Last active Mar 7, 2022
AWS Cleanup script using PowerShell
View AWS Cleanup.ps1
<#
Call this script:
foreach ($Region in (Get-AWSRegion).Region) {
Set-DefaultAWSRegion -Region $Region
iex (iwr https://gist.githubusercontent.com/pcgeek86/42764099021c0b1baa7f32d48afef4c2/raw).Content
}
#>
Get-LMFunctionList | Remove-LMFunction -Force
@pcgeek86
pcgeek86 / Azure Disks by Storage Account.ps1
Last active Dec 20, 2021
Azure Disk Objects :: Add a StorageAccount property
View Azure Disks by Storage Account.ps1
<#
Author: Trevor Sullivan
Date: 2015-03-29
Description: Microsoft Azure Disk objects offer the full URL to the cloud-based VHD
however, the Storage Account name is not exposed independently. We can
use PowerShell's Add-Member command to parse the URL and offer up the
Storage Account as its own property on each Disk object.
#>
Select-AzureSubscription -SubscriptionName 'Visual Studio Ultimate with MSDN';
@pcgeek86
pcgeek86 / Wait-AzureVMDscConfiguration.ps1
Created May 22, 2015
Waits for a DSC configuration to complete on an Azure Virtual Machine.
View Wait-AzureVMDscConfiguration.ps1
function Wait-AzureVMDscConfiguration {
<#
.Synopsis
Waits for a DSC configuration to complete on an Azure Virtual Machine.
.Parameter ServiceName
The name of the Azure Cloud Service containing the Virtual Machine.
.Parameter Name
The name of the Azure Virtual Machine inside the Cloud Service container.
@pcgeek86
pcgeek86 / install-mysqlsh.sh
Last active Nov 22, 2021
Install MySQL Shell utility into MySQL official Docker container image
View install-mysqlsh.sh
# Use these commands to install MySQL Shell utility into a container running
# the official MySQL distribution via Docker Hub.
#
# docker pull mysql:8.0.26
# export CONTAINER_ID=$(docker run --detach --env MYSQL_ROOT_PASSWORD=12345 mysql:8.0.26)
# docker exec --interactive --tty $CONTAINER_ID bash
apt update && apt-get install httpie --yes
# Use the Debian or Ubuntu package
@pcgeek86
pcgeek86 / gist:a1fd9d26f8ad46b51adf9513f67b95f2
Last active Oct 22, 2021
Install & test Selenium with Firefox / Gecko driver on headless Ubuntu 18.04 LTS server
View gist:a1fd9d26f8ad46b51adf9513f67b95f2
sudo apt update
sudo apt install firefox python3-pip xvfb x11-utils --yes
sudo -H pip3 install bpython selenium
export DISPLAY=:2
Xvfb $DISPLAY -ac &
export GECKO_DRIVER_VERSION='v0.24.0'
wget https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
@pcgeek86
pcgeek86 / install-balena-cli.sh
Last active Oct 17, 2021
Install Balena CLI on Debian / Ubuntu
View install-balena-cli.sh
# Trevor Sullivan <trevor@trevorsullivan.net>
export VERSION='v9.12.0'
export FILENAME="balena-cli-$VERSION-linux-x64"
export URL="https://github.com/balena-io/balena-cli/releases/download/$VERSION/$FILENAME.zip"
sudo apt update
sudo apt install httpie unzip --yes
cd $HOME