Skip to content

Instantly share code, notes, and snippets.

View 1RedOne's full-sized avatar

Stephen Owen 1RedOne

View GitHub Profile
@1RedOne
1RedOne / CommentsToWordCloud.ps1
Created January 20, 2020 17:44
YouTubeCommentsTo WordCloud
#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 January 18, 2020 23:22
Script to scrape YouTube video info
#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..."
@1RedOne
1RedOne / Fix-CmdAutoComplete.ps1
Created September 14, 2019 15:21
Fix Tab Autocomplete for Cmd
#In the new update to Windows 10, the tab autocomplete character was changed to CTRL+D or CTRL+F
#Run PowerShell in an elevated mode to change it back to 'Tab'
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Command Processor\' -Name PathCompletionChar -Value 9
@1RedOne
1RedOne / Kindle.md
Last active August 30, 2019 01:56
Kindle Feature Suggestions

Kindle Suggestions

We bought a pair of Kindles Fire HD 8 tablets for the kids to use as a learning device. We were particularly motivated by Amazon Rapids, which my daughter loves and really has helped her reading ability. (We ever going to get new books? No new Rapids books since April of 2018!)

However my ability to control their experience wihtin the Kindle's primary usage environment, FreeTime, is way too limited for what I want. Here is how I'd like to see FreeTime ammended.

Give me Categorical Control Options

Today, there is simply way too much available in FreeTime. There are games, Movies, Videos, and way too much.

@1RedOne
1RedOne / Foodtrucks.ps1
Last active March 3, 2019 16:31
Parsing out foodtruck times with PowerShell and REST
$FoodTruckEvents = Invoke-RestMethod https://www.seattlefoodtruck.com/api/events?page=1&for_locations=51&with_active_trucks=true&include_bookings=true&with_booking_status=approved'
#this endpoint gives us a JSON response with multiple events, so we parse out each event
ForEach ($event in $FoodTruckEvents.events){
#each event seems to be one day, so we resolve the .start_time and make it human readable
$date = Get-Date $event.start_time | Select-Object -ExpandProperty DateTime
#each event could have more than one truck, so we step through them
ForEach ($booking in $event.bookings){
@1RedOne
1RedOne / Example.md
Last active December 30, 2019 16:56
Extracting content from an API from a site

Extracting Content from a site's unpublished API

Imagine that youve found a site that has a perfect list of some info you need, but the site owner's don't have it in a format you can easily use! This happens a lot, but fortunatley for us, if the data can be retrieved and displayed in a web browser, we can normally request that same data directly through a web call instead!

The problem is that the API endpoints we need to hit may not always be published publically.

For instance, this webpage has a lot of good info on beer, but no great way to export it.

https://www.systembolaget.se/sok-dryck/?subcategory=%C3%96l&type=Ale%20brittisk-amerikansk%20stil&style=Imperial%2FDubbel%20IPA&fullassortment=1

@1RedOne
1RedOne / Resolve-UniqueKBRecords.ps1
Created November 7, 2018 19:51
Search for matching records in a big csv using the .Where Method for speed
$csv = ConvertFrom-CSV "ComputerName,KBNeeded
Server01,KB1234567
Server02,KB1234567
Server03,KB1234567
Server04,KB1234567
Server05,KB1234567
Server01,KB3456789
Server01,KB5678910"
$uniquePCs = $csv | Group-Object -Property ComputerName | Select -ExpandProperty Name
@1RedOne
1RedOne / Join-VideoDirectory.ps1
Created October 29, 2018 17:41
Join Video Files with FFMPEG and PowerShell
Function Join-VideoDirectory {
$fileArray = New-Object System.Collections.ArrayList
$items = Get-childitem *.mkv,*.vob,*.mp4,*.ts
$itemCount = $items.Count
$i = 0
$cmdScript = ""
ForEach ($item in $items){
$i++
$cmdScript += "ffmpeg -i `"$($item.Name)`" -f mpegts -c copy file-0$i.mpeg.ts`n"
@1RedOne
1RedOne / Lottery.Md
Last active May 2, 2024 05:05
Why you don't want to win the lottery
@1RedOne
1RedOne / DataGridsAreFun.ps1
Created September 20, 2018 03:03
WPF Example of using and populating a DataGrid with objects in PowerShell
#Sample for this question on SO https://stackoverflow.com/questions/52405852/link-wpf-xaml-to-datagrid-in-powershell?sem=2
$inputXML = @"
<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="450" Width="800">