Skip to content

Instantly share code, notes, and snippets.

View arebee's full-sized avatar

Richard Burte arebee

View GitHub Profile
@arebee
arebee / Get-Gravatar.ps1
Created August 29, 2019 23:37
Get a Gravatar Image from an email address using PowerShell
<#
.SYNOPSIS
Retrieve an icon from Gravatar
.DESCRIPTION
Retrieve an icon from Gravatar for the provided email address.
.EXAMPLE
PS C:\> Get-Gravatar -EmailAddress 'sally@example.com'
Requests an image from Gravatar for the email address 'sally@example.com'
If available, it will write a 300 pixel square image in the working dirctory
with the name sally@example.com.jpg
@arebee
arebee / BingImageOfTheDay.ps1
Last active March 6, 2017 18:25
Bing image of the day script - should be cross platform
# Get the bing image of the day.
$root_url = 'http://www.bing.com'
$dst_dir = Join-Path $HOME '/Documents/Pictures/deskFeed/'
if (!(Test-Path $dst_dir -PathType Container)) {
new-item -Path $dst_dir -ItemType Container | Out-Null
}
$validFileTypes = ("jpg","jpeg","png")
$targetRes = "1920x1080" # Retina MacBook Pro 2015
[Int32]$numberOfImagesToFetch = 20
@arebee
arebee / Search-FileIndex.ps1
Last active September 14, 2023 23:08
Use Windows Search from PowerShell
function Search-FileIndex {
<#
.PARAMETER Path
Absoloute or relative path. Has to be in the Search Index for results to be presented.
.PARAMETER Pattern
File name or pattern to search for. Defaults to *.*. Aliased to Filter to ergonomically match Get-ChildItem.
.PARAMETER Text
Free text to search for in the files defined by the pattern.
.PARAMETER Recurse
Add the parameter to perform a recursive search. Default is false.
@arebee
arebee / createPodcastRss.ps1
Last active February 24, 2024 01:29
Powershell script to create an RSS feed from a local set of MP3s
# Based on the format described at http://podcast411.com/howto_1.html
function createRssElement{
param(
[string]$elementName,
[string]$value,
$parent
)
$thisNode = $rss.CreateElement($elementName)
@arebee
arebee / BlueScreen.ps1
Created June 2, 2016 17:58
PowerShell snippet to scan the Windows Event Log
Get-EventLog -LogName System -newest 100 | where {$_.EventID -match '1001|1003'} | %{ $_.Message }
# or
Get-EventLog -LogName application -Newest 1000 | where {$_.EventID -match '1001|1003'} | select timewritten, message | % {
Write-Host "`n$('*'*80)"
Write-Host $_.message
)
# or
# Scans the 192.168.1.nnn hosts for http responses.
for ($i = 1; $i -ile 254; $i++) {
$testAddress = "192.168.1." + $i
$info = Test-NetConnection -ComputerName $testAddress -CommonTCPPort http -InformationLevel Quiet
if ($info -eq $true)
{
write-host "$testAddress is listening on 80 for HTTP traffic"
}
}
# Current User
dir Cert:\CurrentUser\ -Recurse | where {(($_.Issuer -ne $null) -and ($_.Issuer.ToString() -match '.*Apple.*')) }
dir Cert:\CurrentUser\ -Recurse | where {(($_.Issuer -ne $null) -and ($_.Issuer.ToString() -match '.*Microsoft.*')) }
# Current Machine
dir Cert:\LocalMachine\ -Recurse | where {(($_.Issuer -ne $null) -and ($_.Issuer.ToString() -match '.*Apple.*')) }
dir Cert:\LocalMachine\ -Recurse | where {(($_.Issuer -ne $null) -and ($_.Issuer.ToString() -match '.*Microsoft.*')) }
Import-Module Microsoft.PowerShell.Security
set-location cert:
Get-ChildItem -recurse | Where-Object {$_.Thumbprint -match "98A04E4163357790C4A79E6D713FF0AF51FE6927"} | write-host "eDellRoot Found"
@arebee
arebee / no-bom.ps1
Created November 17, 2015 02:29
PowerShell script to save as UTF-8 without a BOM
gci . -recurse -filter *.ps* | % {
$MyFile = gc $_.Fullname -raw
$MyPath = $_.Fullname
[System.IO.File]::WriteAllLines($MyPath, $MyFile, [System.Text.UTF8Encoding]($False))
}
@arebee
arebee / gist:3bb87840b1b912592a7f
Created July 30, 2015 06:06
PowerShell to get the Windows OS SKU
Get-WmiObject -Class Win32_OperatingSystem -Namespace "root\cimv2" | format-list Caption, Version