Skip to content

Instantly share code, notes, and snippets.

View Graham-Beer's full-sized avatar

Graham Beer Graham-Beer

View GitHub Profile
@Graham-Beer
Graham-Beer / bashrc
Created May 5, 2023 07:23
WSL bashrc profile
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# 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/)
netsh wlan show profiles |
Select-String ': *(.+)$' | ForEach-Object {
$_.Matches.Groups[1].Value
}
function Get-EC2Ami {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 0, ValueFromPipeline)]
[SupportsWildcards()]
[String] $ImageType,
[Parameter(Mandatory, Position = 1)]
[ArgumentCompleter( { (Get-AWSRegion).Region })]
[String] $Region,
# 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.
function Invoke-FileArchive {
param (
[Parameter(
Mandatory,
Position = 0,
ValueFromPipeline,
ValueFromPipelineByPropertyName
)]
[Alias('FullName')]
[System.IO.FileSystemInfo[]] $Path,
function Invoke-BalloonMessage {
Param (
[Parameter(Mandatory)]
[string] $Message,
[Parameter()]
[string] $Title = "Attention $env:username",
[Parameter()]
[ValidateSet('none', 'Info', 'Warning', 'Error')]
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
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
## 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)
}