This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$global:WeatherJob = Start-ThreadJob { | |
while($true) { | |
(irm "wttr.in?format=3").Trim() -replace "^.*:\s*"; sleep 300 | |
} | |
} -Name WeatherQuery | |
$null = Register-ObjectEvent -InputObject $WeatherJob.Output -EventName DataAdded -Action { | |
# The $Sender is the actual Output collection | |
# $EventArgs includes the index at which the output was added | |
# Update the Window Title with the weather each time it updates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -module ActiveDirectory | |
function Get-ActiveADServers { | |
param( | |
[String]$SearchBase, | |
[String]$Server, | |
[PSCredential]$Credential, | |
[DateTime]$After = (get-date).AddMonths(-1) | |
) | |
$GetADComputerParams = @{ | |
Filter = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Description | |
This script was written to solve the Based challenge from PicoCTF 2019. | |
This script connects to a target computer nad port and converts the output from Base2, Base8, and Base16. | |
It establishes a tcp connection, answers the questions and returns the flag for this challenge. | |
#> | |
[cmdletbinding()] | |
param( | |
[string]$computer = '2019shell1.picoctf.com', | |
$port = '44303', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-PublicIPInfo { | |
<# | |
.Description | |
Returns Public IP info from ip.nf | |
.Parameter IPAddress | |
Supply an IP address that you would like to lookup. | |
.Parameter ComputerName | |
Names of computers to run this command on. | |
.Parameter Credential | |
Credential used by Invoke-Command when performing the lookup on a remote machine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MmaEvent { | |
<# | |
.Description | |
Returns upcoming MMA events from https://www.whenarethefights.com/ | |
#> | |
$request = Invoke-WebRequest -Uri 'https://www.whenarethefights.com/' | |
# Only grab the events that have a countdown. | |
$content = $request.Links.outertext | Where-Object {$_ -like '*days*'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Send-SendGridMailMessage { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory)][String[]]$To, | |
[Parameter(Mandatory)][String]$Subject, | |
[String]$Body, | |
[Parameter(Mandatory)][String]$From, | |
[Switch]$BodyAsHtml, | |
[String]$SendGridApiKey = $env:SENDGRID_API_KEY | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to the profile when installed from the Windows Store. | |
$profilePath = "C:\Users\$Env:Username\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json" | |
# Remove existing comments from the profiles.json file. | |
$profile = (Get-Content $ProfilePath) -replace '(?m)(?<=^([^"]|"[^"]*")*)//.*' -replace '(?ms)/\*.*?\*/' | Out-String | ConvertFrom-Json | |
$backupProfilePath = "$home\Documents\WindowsTerminalprofiles.json" | |
Write-Verbose "Backing up profile to $backupProfilePath" | |
$profile | ConvertTo-Json | Set-Content $backupProfilePath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"name": "Italics", | |
"scope": [ | |
"comment", | |
"punctuation.definition.comment", | |
"keyword", | |
"storage", | |
"entity.other.attribute-name", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-GlyphNerdFonts ($Name) { | |
$cache = [Runtime.Caching.MemoryCache]::Default | |
if ($cache['poshglyph-nfcollection']) { | |
$nfCollection = $cache['poshglyph-nfcollection'] | |
} else { | |
[Regex]$glyphRegex = '<span><div class="class-name">(?<name>[\S<>]+)</div><div class="codepoint">(?<codepoint>\w+)</div></span>' | |
$glyphRegexMatches = $glyphRegex.Matches((Invoke-RestMethod -useb 'https://www.nerdfonts.com/')) | |
$nfcollection = [ordered]@{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-GitIoLink { | |
<# | |
.SYNOPSIS | |
Creates a git.io shortened link to a git file | |
.DESCRIPTION | |
Git.IO link shortener, useful for making short links to repositories or files for use in weblinks, twitter, or tools such as iex (iwr -useb $uri) for running snippets of code | |
*WARNING* Once you create a link, it becomes immutable, so be very careful and practice on non-essential links first! | |
.EXAMPLE | |
New-GitIoLink 'https://www.github.com/notarealsitehopefully' | |
Create a link with a random shortname |
NewerOlder