Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Owen 1RedOne

View GitHub Profile
@1RedOne
1RedOne / New-MoqMethodConfiguration.ps1
Created Aug 14, 2020
PowerShell Function to handle Moq Setup and Verifies for you!
View New-MoqMethodConfiguration.ps1
<#
.Synopsis
Creates your Moq.Setups for you!
.DESCRIPTION
Provide a method signature to receive an example of a basic, lazy Mock for the method
.EXAMPLE
$myMethodSignature = "
GetDeploymentStatus(
string someToken,
int someIntValue = 10,
@1RedOne
1RedOne / OnAirFlow.ps1
Created Jul 28, 2020
A functional script to turn a light on and off when entering and leaving Teams and Skype Meetings
View OnAirFlow.ps1
#Companion Code to blog post found on FoxDeploy.com 'DIY On-Air Light for Microsoft Teams'
Add-Type -Path "C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll";
$lightOnEventName = "meetingStart"
$lightOffEventName = "meetingStop"
$iftttKey = '<YourKeyGoesHere>'
$sleepInterval = 180
$lyncclient = [Microsoft.Lync.Model.LyncClient]::GetClient()
$LastState = $null
@1RedOne
1RedOne / GetKeys.ps1
Created Jul 24, 2020
Get matching keys from a hash table
View GetKeys.ps1
$hash = @{
showThisOne = 'showMe1';
showThisTwo = 'showMe2';
showThisThree = 'showMe3';
showThisFour = 'showMe4';
DontShowThis = 'hideme';
AlsoDontShowThis = 'hideme';
}
@1RedOne
1RedOne / Comment.md
Created Jul 19, 2020
From a comment on reddit : let's have a real discussion about sending kids back to school
View Comment.md

Hey guys, thought this was a really good read. Comment source was this thread on reddit here Stephen

Written by a dad in Fairfax county read. From Some Person, daughters in 8th & 10th grade in our Centreville Pyramid:

To our fellow FCPS families, this is it gang, 5 days until the 2 days in school vs. 100% virtual decision. Let’s talk it out, in my traditional mammoth TL/DR form.

Like all of you, I’ve seen my feed become a flood of anxiety and faux expertise. You’ll get no presumption of expertise here. This is how I am looking at and considering this issue and the positions people have taken in my feed and in the hundred or so FCPS discussion groups that have popped up. The lead comments in quotes are taken directly from my feed and those boards. Sometimes I try to rationalize them. Sometimes I’m just punching back at the void.

Full disclosure, we initially chose the 2 days option and are now h

View FoxDeploy_NewGui.xaml
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
mc:Ignorable="d"
Title="MainWindow" Height="1000" Width="800">
<Grid Background="#FF0B4A80">
<Grid.RowDefinitions>
View FoxDeploy_NewGui.xaml
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
mc:Ignorable="d"
Title="MainWindow" Height="1000" Width="800">
<Grid Background="#FF0B4A80">
<Grid.RowDefinitions>
@1RedOne
1RedOne / FoxDeploy_NewGUI.ps1
Last active May 8, 2020
ContinuousAutomation Part II PowerShell GUIs
View FoxDeploy_NewGUI.ps1
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
$xamlPath = "$($PSScriptRoot)\$((split-path $PSCommandPath -Leaf ).Split(".")[0]).xaml"
if (-not(Test-Path $xamlPath)){
throw "Ensure that $xamlPath is present within $PSScriptRoot"
}
$inputXML = Get-Content $xamlPath
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
[xml]$XAML = $inputXML
@1RedOne
1RedOne / Thoughts.md
Created May 6, 2020
Thoughts On Blog Direction
View Thoughts.md

Choosing what content to write about is hard. I can only spare so much time and effort to write something, and the level of quality I strive for means I really do take a lot of time per each post.

It's also somewhat like choosing which arrows to use from my quiver. Each one I put in the air takes effort and if people choose to follow the arrow all the way to the target, it will take them effort and time to understand the concepts. So I have to be very picky about which topics I cover, and pick only the highest value ones.

For instance, I'm working on a blog post now, demonstrating how to migrate from a PowerShell WPF GUI to an asp.net core web app and wow...I have fallen out of love with WPF GUIs.

I know it's ironic, I basically became an MVP off of writing how to create better and better WPF PowerShell GUIs for enterprise automation, and now I'm falling out of love with them.

But after three years of doing bootstrap asp.net webapps, I just can't conscientiously recommend people plow the 1,000 hours that

@1RedOne
1RedOne / CommentsToWordCloud.ps1
Created Jan 20, 2020
YouTubeCommentsTo WordCloud
View CommentsToWordCloud.ps1
#goes along with this - https://gist.github.com/1RedOne/ca4e1ac49bf46bb7f30a503a3cae6fd2 and the post on FoxDeploy.com
#update to match your infoOutput.json path
if (!(get-module PSWordCloud)){
write-warning "This depends on PSWordCloud being installed, please run `Install-Module PSWordCloud -Scope CurrentUser'"
break
}
$girlsFashion = get-content ".\1-9-2020-11_31_44AM-InfoOutput.json" | ConvertFrom-Json
$tags = $girlsFashion.Tags | select Tags
@1RedOne
1RedOne / VideoGather.ps1
Created Jan 18, 2020
Script to scrape YouTube video info
View VideoGather.ps1
#depends on PSYoutube.ps1
#begin by acquiring module from https://github.com/1RedOne/PSYouTube then import and run Connect-PSYoutubeAccount
#start https://console.developers.google.com/apis/dashboard?project=youtubegirlsvidsapi&pageState=(%22duration%22:(%22groupValue%22:%22PT1H%22))
#quota usage https://console.developers.google.com/apis/api/youtube/quotas?project=youtubegirlsvidsapi&duration=PT1H
if (!(gmo PSYouTube)){
"importing module"
import-module C:\git\PSYouTube -Verbose
}else{
"module already imported..."
You can’t perform that action at this time.