Skip to content

Instantly share code, notes, and snippets.

Stephen Owen 1RedOne

Block or report user

Report or block 1RedOne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
1RedOne / Foodtrucks.ps1
Last active Mar 3, 2019
Parsing out foodtruck times with PowerShell and REST
View Foodtrucks.ps1
$FoodTruckEvents = Invoke-RestMethod'
#this endpoint gives us a JSON response with multiple events, so we parse out each event
ForEach ($event in ${
#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 /
Last active Jan 17, 2019
Backup of post from reddit


Sure, but if you want to be objective about it you can't deny that one side is more tribal then the other.

1RedOne /
Last active Apr 29, 2019
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.

1RedOne / Resolve-UniqueKBRecords.ps1
Created Nov 7, 2018
Search for matching records in a big csv using the .Where Method for speed
View Resolve-UniqueKBRecords.ps1
$csv = ConvertFrom-CSV "ComputerName,KBNeeded
$uniquePCs = $csv | Group-Object -Property ComputerName | Select -ExpandProperty Name
1RedOne / Join-VideoDirectory.ps1
Created Oct 29, 2018
Join Video Files with FFMPEG and PowerShell
View Join-VideoDirectory.ps1
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){
$cmdScript += "ffmpeg -i `"$($item.Name)`" -f mpegts -c copy file-0$i.mpeg.ts`n"
1RedOne / Lottery.Md
Last active Oct 19, 2018
Why you don't want to win the lottery
View Lottery.Md
1RedOne / DataGridsAreFun.ps1
Created Sep 20, 2018
WPF Example of using and populating a DataGrid with objects in PowerShell
View DataGridsAreFun.ps1
#Sample for this question on SO
$inputXML = @"
<Window x:Class="WpfApp2.MainWindow"
Title="MainWindow" Height="450" Width="800">
1RedOne /
Last active Aug 16, 2018
Parsing Malformed HTML via SQL

First off the source HTML has a lot of issues, as we can see here:

'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<STYLE type=text/css> P, UL, OL, DL, DIR, MENU, PRE { margin: 0 auto;}</STYLE>
<META name=GENERATOR content="MSHTML 11.00.10586.35"></HEAD>

<BODY leftMargin=1 topMargin=1 rightMargin=1>
1RedOne / AddSurNametoUpper.ps1
Last active Aug 8, 2018
A scratch of swapping a dash for a period in AD>
View AddSurNametoUpper.ps1
if ($user.Surname){
"$user has a surname"
$newSurname = $user.Surname.ToUpper()
"changing to $newSurname"
$user | Set-ADUser -Surname $newSurname -WhatIf
1RedOne / Sample.ps1
Created Jul 2, 2018
GUI Post 2 Final XAML
View Sample.ps1
<Window x:Class="WpfApplication2.MainWindow"
Title="FoxDeploy Awesome Tool" Height="416.794" Width="598.474" Topmost="True">
<Grid Margin="0,0,45,0">
<Image x:Name="image" HorizontalAlignment="Left" Height="100" Margin="24,28,0,0" VerticalAlignment="Top" Width="100" Source="C:\Users\Stephen\Dropbox\Docs\blog\foxdeploy favicon.png"/>
You can’t perform that action at this time.