Skip to content

Instantly share code, notes, and snippets.

View mwjcomputing's full-sized avatar

Matthew Johnson mwjcomputing

View GitHub Profile
@mwjcomputing
mwjcomputing / Get-PublicIP.ps1
Created January 28, 2022 19:08
Get a host's public IP
function Get-PublicIP {
param (
[Parameter(HelpMessage='Return IPv6 info if available.')]
[switch] $ipV6
)
if ($ipV6)
{
$ipifyURL = 'https://api64.ipify.org'
}
@mwjcomputing
mwjcomputing / New-MTail.ps1
Created January 28, 2022 18:39
New PowerShell Tail
function New-MTail {
param (
[Parameter(Mandatory = $true)]
[string]$File,
[Parameter(Mandatory = $true)]
[string]$SearchTerm
)
Get-Content -Path $File -tail 100 -wait | Select-String $SearchTerm
@mwjcomputing
mwjcomputing / Set-WindowsTheme.ps1
Last active December 3, 2021 14:54
Sets the Windows 11 theme between Dark and Light.
function Set-WindowsTheme {
param (
[ValidateSet("light","dark")]
[Parameter(Mandatory=$true)]
[string] $Mode
)
if ('dark' -eq $Mode) {
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force

Keybase proof

I hereby claim:

  • I am mwjcomputing on github.
  • I am mwjcomputing (https://keybase.io/mwjcomputing) on keybase.
  • I have a public key ASDjbB9syjr0bJDeZecBVrhgEp4X90o9cJzEBq-UA5UuNgo

To claim this, I am signing this object:

@mwjcomputing
mwjcomputing / DaysTilLConverge2020.ps1
Created September 26, 2019 17:51
A simple PowerShell script to calculate days until Converge 2020.
# ==================================================
# = FileName: daysTillConverge2020.ps1
# = Author: Matt Johnson (@mwjcomputing)
# = Description: Calculates days until Converge 2020
# ==================================================
# Set start of Converge 2020 date and time
$ConvergeDate = Get-Date -Year 2020 -Month 5 -Day 14 -Hour 8 -Minute 0
# Get current date and time
$Today = Get-Date
@mwjcomputing
mwjcomputing / DaysTillConverge2020.py
Last active September 26, 2019 17:44
A simple Python script to calculate days until Converge 2020.
# ==================================================
# = FileName: daysTillConverge2020.py
# = Author: Matt Johnson (@mwjcomputing)
# = Description: Calculates days until Converge 2020
# ==================================================
# Import datetime module
import datetime
# Set start of Converge 2020 date and time
@mwjcomputing
mwjcomputing / DaysTillConverge2020.go
Created September 26, 2019 16:39
A simple Go script to calculate days until Converge 2020.
// ==================================================
// = FileName: daysTillConverge2020.go
// = Author: Matt Johnson (@mwjcomputing)
// = Description: Calculates days until Converge 2020
// ==================================================
package main
import (
"fmt"
@mwjcomputing
mwjcomputing / Copy-VSCodeUserSnippets.ps1
Created May 17, 2018 13:43
Copy-VSCodeUserSnippets copies the VS Code User Snippet Files to a directory for backup.
function Copy-VSCodeUserSnippets {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, HelpMessage="Enter the destination address")]
[String] $Destination
)
# Global Variables
$SnippetFolder = "C:\Users\$ENV:Username\AppData\Roaming\Code\User\snippets\"
$Computer = 'localhost'
Get-EventLog -ComputerName $Computer System -Source Microsoft-Windows-Winlogon | select $UserProperty,$TypeProperty,$TimeProeprty
@mwjcomputing
mwjcomputing / Test-IPv4Address.ps1
Created July 24, 2014 13:05
This function shows a cleanly written and well documented function.
function Test-IPv4Address {
[CmdletBinding()]
param(
[parameter(Mandatory=$true, ValueFromPipeline=$true, HelpMessage='Enter data to validate as IP Address.')]
[alias('IPAddress')]
[string]$IP
)
begin{}
process{