This file contains 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
$screenshotsDir = "$($env:userprofile)\OneDrive\Pictures\Screenshots" | |
$fileType = "png" | |
$images = Get-ChildItem -Path $screenshotsDir -filter "*.$fileType" | |
for ($i=0; $i -lt $images.Length; $i++) { | |
$monthYearString = $images[$i].CreationTime.Year.ToString() + "-" + $images[$i].CreationTime.Month.ToString().PadLeft(2,"0") | |
$folder = Join-Path $screenshotsDir $monthYearString | |
if (-not (Test-Path -Path $folder -PathType Container)) { |
This file contains 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
alias: Bedroom - Electric Blanket Question 2130 | |
description: "Prompts to turn the electric blanket on if the temperature is below 13 deg C at 2130 and I'm home." | |
trigger: | |
- platform: time | |
at: "21:30:00" | |
condition: | |
- condition: zone | |
entity_id: person.me | |
zone: zone.home | |
- condition: template |
This file contains 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
# ------------------------------------------------------------------------------- | |
# Script: Get-MessageSizeLimits.ps1 | |
# Author: Chris Brown | |
# Date: 28/04/2011 | |
# ------------------------------------------------------------------------------- | |
# Import the Exchange Snap-ins | |
if ( (Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue) -eq $null) { | |
Write-Verbose "Exchange 2010 snapin is not loaded. Loading it now." | |
try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; Write-Verbose "Loaded Exchange 2010 snapin" } | |
catch { Write-Error "Could not load Exchange 2010 snapins!"; } |
This file contains 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
PS /Users/chris> Write-Log "Hello!" | |
[2018-09-14T08:27:35] Hello! | |
PS /Users/chris> Get-Content ./somelogfilename.log | |
[2018-09-14T08:27:35] Hello! | |
PS /Users/chris> |
This file contains 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
#!/usr/local/bin/python | |
import argparse | |
import boto3 | |
def resetPassword(instanceId, password, region, profile): | |
session = boto3.Session(profile_name=profile, region_name=region) | |
client = session.client('ssm') | |
runPwshDocument = 'AWS-RunPowerShellScript' |
This file contains 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
$HHUrl = "http://happyhour.virginaustralia.com/sale-on" | |
$page = Invoke-WebRequest -Uri $HHUrl | |
$flightDivs = $page.ParsedHtml.body.getElementsByClassName('card-flight') | |
foreach ($flightDiv in $flightDivs) { | |
New-Object -TypeName PSObject -Property @{ | |
"From" = $flightDiv.getElementsByTagName("h3")[0].innerText.Split("`n")[0].Trim() -replace '\ to', '' |
This file contains 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
$CameraIp = "192.168.0.10" | |
$DateFrom = Get-Date "29 December 2017" | |
function Invoke-OLApiCommand { | |
Param( | |
[String]$Command, | |
[String]$Arguments | |
) | |
$CommandVerb = $Command.Split("_")[0] |
This file contains 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
param( | |
[String] | |
$Path, #the path to the files to be uploaded | |
[String] | |
$siteUrl, #this is the URL of the Group in the format https://contoso.sharepoint.com/sites/yourGroupName | |
[String] | |
$listName = "Shared Documents" | |
#this is the path within the site to the place where you want to put the files |
This file contains 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 Invoke-Gist { | |
Param( | |
[String] | |
$Identity, | |
[String] | |
$Arguments | |
) | |
$gistBase = "https://api.github.com/gists/" |
This file contains 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
New-Object -TypeName PSObject -Property @{Message="Hello, again!"} |
NewerOlder