Skip to content

Instantly share code, notes, and snippets.

Avatar

Graham Beer Graham-Beer

View GitHub Profile
View 04-05-lambda-container.sh
# Source: https://gist.github.com/7e0ada996b5d09486f2df0d7e1cbbea2
###############################################
# Amazon Lambda Containers #
# Packaging AWS Functions as Container Images #
# https://youtu.be/DsQbBVr-GwU #
###############################################
# Requirements:
# - AWS account (https://aws.amazon.com/)
View Wireless_profiles.ps1
netsh wlan show profiles |
Select-String ': *(.+)$' | ForEach-Object {
$_.Matches.Groups[1].Value
}
View Get-EC2Ami.ps1
function Get-EC2Ami {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 0, ValueFromPipeline)]
[SupportsWildcards()]
[String] $ImageType,
[Parameter(Mandatory, Position = 1)]
[ArgumentCompleter( { (Get-AWSRegion).Region })]
[String] $Region,
View AWS_Lambda_PowerOff.ps1
# PowerShell script file to be executed as an AWS Lambda function.
#
# When executing in Lambda the following variables will be predefined.
# $LambdaInput - A PSObject that contains the Lambda function input data.
# $LambdaContext - An Amazon.Lambda.Core.ILambdaContext object that contains information about the currently running Lambda environment.
#
# The last item in the PowerShell pipeline will be returned as the result of the Lambda function.
#
# To include PowerShell modules with your Lambda function, like the AWSPowerShell.NetCore module, add a "#Requires" statement
# indicating the module and version.
View Invoke-FileArchive.ps1
function Invoke-FileArchive {
param (
[Parameter(
Mandatory,
Position = 0,
ValueFromPipeline,
ValueFromPipelineByPropertyName
)]
[Alias('FullName')]
[System.IO.FileSystemInfo[]] $Path,
View Invoke-BalloonMessage.ps1
function Invoke-BalloonMessage {
Param (
[Parameter(Mandatory)]
[string] $Message,
[Parameter()]
[string] $Title = "Attention $env:username",
[Parameter()]
[ValidateSet('none', 'Info', 'Warning', 'Error')]
View Get-BitLockerStatus.ps1
function Get-BitLockerStatus {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
[Microsoft.ActiveDirectory.Management.ADComputer] $Computers,
[parameter(Mandatory)]
[pscredential] $Credential
)
process {
@Graham-Beer
Graham-Beer / Get-BinaryToText.ps1
Created December 10, 2018 09:07
Convert binary to text
View Get-BinaryToText.ps1
function Get-BinaryToText {
param (
[Parameter(ValueFromPipeline)]
[String] $string
)
process {
($string -split ' ' |
ForEach-Object {
[char](
[convert]::ToInt32($_, 2)
@Graham-Beer
Graham-Beer / aes-encryption.ps1
Created September 5, 2018 16:02
Encrypter / Decrypter
View aes-encryption.ps1
## A PowerShell conversion of the C# code in the article, https://www.c-sharpcorner.com/article/aes-encryption-in-c-sharp/ ##
using namespace System.IO
using namespace System.Security.Cryptography
class ManageAes {
static [void] Main() {
[string] $data = Read-Host -Prompt "Enter text that needs to be encrypted"
[ManageAes]::EncryptAesManaged($data)
}
@Graham-Beer
Graham-Beer / Format-Member.ps1
Last active September 4, 2018 13:10
Alternative to Get-Member with a cleaner output to host
View Format-Member.ps1
function Format-Member {
[CmdletBinding()]
[alias("fm")]
param (
[parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[System.Management.Automation.PSObject]
$InputObject
)